diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a81f7f..5418363 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### [0.14.0](https://github.com/elven-js/elven.js/releases/tag/v0.14.0) (2023-11-25) +- add tools for signing messages with all supported providers (`ElvenJS.signMessage`). Find more details in the [demo example]((/example/index.html)) and [documentation]((https://www.elvenjs.com)). +- update dependencies + ### [0.13.0](https://github.com/elven-js/elven.js/releases/tag/v0.13.0) (2023-10-27) - add xAlias login support `ElvenJS.login('x-alias')` (check the [docs](https://www.elvenjs.com) and [demo example](/example/index.html)) - update dependencies diff --git a/build/elven.js b/build/elven.js index 5f9eced..7fcf0ab 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,9 +1,10 @@ -var s5=Object.create;var Yl=Object.defineProperty;var o5=Object.getOwnPropertyDescriptor;var a5=Object.getOwnPropertyNames;var u5=Object.getPrototypeOf,c5=Object.prototype.hasOwnProperty;var JI=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)Yl(t,r,{get:e[r],enumerable:!0})},Kl=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a5(e))!c5.call(t,i)&&i!==r&&Yl(t,i,{get:()=>e[i],enumerable:!(n=o5(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Kl(t,e,"default"),r&&Kl(r,e,"default")),_e=(t,e,r)=>(r=t!=null?s5(u5(t)):{},Kl(e||!t||!t.__esModule?Yl(r,"default",{value:t,enumerable:!0}):r,t)),ct=t=>Kl(Yl({},"__esModule",{value:!0}),t);var C0=m(Jl=>{"use strict";c();Jl.byteLength=f5;Jl.toByteArray=d5;Jl.fromByteArray=y5;var Xr=[],Sr=[],l5=typeof Uint8Array<"u"?Uint8Array:Array,T0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Es=0,XI=T0.length;Es0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function f5(t){var e=ZI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function h5(t,e,r){return(e+r)*3/4-r}function d5(t){var e,r=ZI(t),n=r[0],i=r[1],s=new l5(h5(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Sr[t.charCodeAt(u)]<<2|Sr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Sr[t.charCodeAt(u)]<<10|Sr[t.charCodeAt(u+1)]<<4|Sr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function p5(t){return Xr[t>>18&63]+Xr[t>>12&63]+Xr[t>>6&63]+Xr[t&63]}function g5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Xr[e>>2]+Xr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Xr[e>>10]+Xr[e>>4&63]+Xr[e<<2&63]+"=")),i.join("")}});var N0=m(x0=>{c();x0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,g=r?-1:1,w=t[e+d];for(d+=g,s=w&(1<<-f)-1,w>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=g,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};x0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,E=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=g/u:e+=g*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=T*128}});var hS=m(vo=>{"use strict";c();var O0=C0(),Eo=N0(),eS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vo.Buffer=z;vo.SlowBuffer=b5;vo.INSPECT_MAX_BYTES=50;var Xl=2147483647;vo.kMaxLength=Xl;z.TYPED_ARRAY_SUPPORT=m5();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function m5(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Xl)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B0(t)}return nS(t,e,r)}z.poolSize=8192;function nS(t,e,r){if(typeof t=="string")return E5(t,e);if(ArrayBuffer.isView(t))return v5(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Zr(t,ArrayBuffer)||t&&Zr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Zr(t,SharedArrayBuffer)||t&&Zr(t.buffer,SharedArrayBuffer)))return P0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);var i=A5(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return nS(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function iS(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function w5(t,e,r){return iS(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return w5(t,e,r)};function B0(t){return iS(t),qn(t<0?0:L0(t)|0)}z.allocUnsafe=function(t){return B0(t)};z.allocUnsafeSlow=function(t){return B0(t)};function E5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=sS(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function D0(t){for(var e=t.length<0?0:L0(t.length)|0,r=qn(e),n=0;n=Xl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xl.toString(16)+" bytes");return t|0}function b5(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(Zr(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),Zr(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?z.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function sS(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Zr(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return R0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fS(t).length;default:if(i)return n?-1:R0(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=sS;function _5(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return R5(this,e,r);case"utf8":case"utf-8":return aS(this,e,r);case"ascii":return D5(this,e,r);case"latin1":case"binary":return P5(this,e,r);case"base64":return N5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function vs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};eS&&(z.prototype[eS]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(Zr(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,F0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:tS(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):tS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function tS(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,g=0;gi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return I5(this,e,r,n);case"utf8":case"utf-8":return S5(this,e,r,n);case"ascii":case"latin1":case"binary":return T5(this,e,r,n);case"base64":return C5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function N5(t,e,r){return e===0&&r===t.length?O0.fromByteArray(t):O0.fromByteArray(t.slice(e,r))}function aS(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return O5(n)}var rS=4096;function O5(t){var e=t.length;if(e<=rS)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Rt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Rt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Rt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Rt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!1,52,8)};function or(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;or(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;or(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function uS(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function cS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,4,34028234663852886e22,-34028234663852886e22),Eo.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return cS(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return cS(this,e,r,!1,n)};function lS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,8,17976931348623157e292,-17976931348623157e292),Eo.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return lS(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return lS(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function M5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function fS(t){return O0.toByteArray(F5(t))}function Zl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Zr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function F0(t){return t!==t}var q5=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var mS=m((Sie,yS)=>{c();var mt=yS.exports={},en,tn;function M0(){throw new Error("setTimeout has not been defined")}function U0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?en=setTimeout:en=M0}catch{en=M0}try{typeof clearTimeout=="function"?tn=clearTimeout:tn=U0}catch{tn=U0}})();function dS(t){if(en===setTimeout)return setTimeout(t,0);if((en===M0||!en)&&setTimeout)return en=setTimeout,setTimeout(t,0);try{return en(t,0)}catch{try{return en.call(null,t,0)}catch{return en.call(this,t,0)}}}function V5(t){if(tn===clearTimeout)return clearTimeout(t);if((tn===U0||!tn)&&clearTimeout)return tn=clearTimeout,clearTimeout(t);try{return tn(t)}catch{try{return tn.call(null,t)}catch{return tn.call(this,t)}}}var Vn=[],Ao=!1,As,ef=-1;function H5(){!Ao||!As||(Ao=!1,As.length?Vn=As.concat(Vn):ef=-1,Vn.length&&pS())}function pS(){if(!Ao){var t=dS(H5);Ao=!0;for(var e=Vn.length;e;){for(As=Vn,Vn=[];++ef1)for(var r=1;r{h=_e(hS()),p=_e(mS()),G5=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=G5});var Gt=m((wS,tf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function w(I){var N,_,S,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),Q=20,V=4,k=-7,K=21,pe=-1e7,ue=1e7,re=!1,Y=1,se=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ie="0123456789abcdefghijklmnopqrstuvwxyz";function M(y,v){var b,P,C,O,L,x,F,H,q=this;if(!(q instanceof M))return new M(y,v);if(v==null){if(y&&y._isBigNumber===!0){q.s=y.s,!y.c||y.e>ue?q.c=q.e=null:y.e=10;L/=10,O++);O>ue?q.c=q.e=null:(q.e=O,q.c=[y]);return}H=String(y)}else{if(!r.test(H=String(y)))return S(q,H,x);q.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(O=H.indexOf("."))>-1&&(H=H.replace(".","")),(L=H.search(/e/i))>0?(O<0&&(O=L),O+=+H.slice(L+1),H=H.substring(0,L)):O<0&&(O=H.length)}else{if(B(v,2,ie.length,"Base"),v==10)return q=new M(y),oe(q,Q+q.e+1,V);if(H=String(y),x=typeof y=="number"){if(y*0!=0)return S(q,H,x,v);if(q.s=1/y<0?(H=H.slice(1),-1):1,M.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+y)}else q.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(b=ie.slice(0,v),O=L=0,F=H.length;LO){O=F;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,L=-1,O=0;continue}return S(q,String(y),x,v)}x=!1,H=_(H,v,10,q.s),(O=H.indexOf("."))>-1?H=H.replace(".",""):O=H.length}for(L=0;H.charCodeAt(L)===48;L++);for(F=H.length;H.charCodeAt(--F)===48;);if(H=H.slice(L,++F)){if(F-=L,x&&M.DEBUG&&F>15&&(y>l||y!==i(y)))throw Error(o+q.s*y);if((O=O-L-1)>ue)q.c=q.e=null;else if(O=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||b!==i(b))break e;if(b!==0)return!0}}}else if(P===null&&C===null&&(O===null||O===1||O===-1))return!0;throw Error(s+"Invalid BigNumber: "+y)},M.maximum=M.max=function(){return ae(arguments,R.lt)},M.minimum=M.min=function(){return ae(arguments,R.gt)},M.random=function(){var y=9007199254740992,v=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var P,C,O,L,x,F=0,H=[],q=new M(J);if(b==null?b=Q:B(b,0,g),L=n(b/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(H.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(H.push(x%1e14),F+=7);F=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(b,P,C,O,L){var x,F,H,q,Z,we,Ae,Re,tt=b.indexOf("."),lt=Q,Oe=V;for(tt>=0&&(q=se,se=0,b=b.replace(".",""),Re=new M(P),we=Re.pow(b.length-tt),se=q,Re.c=v(A(T(we.c),we.e,"0"),10,C,y),Re.e=Re.c.length),Ae=v(b,P,C,L?(x=ie,y):(x=y,ie)),H=q=Ae.length;Ae[--q]==0;Ae.pop());if(!Ae[0])return x.charAt(0);if(tt<0?--H:(we.c=Ae,we.e=H,we.s=O,we=N(we,Re,lt,Oe,C),Ae=we.c,Z=we.r,H=we.e),F=H+lt+1,tt=Ae[F],q=C/2,Z=Z||F<0||Ae[F+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>q||tt==q&&(Oe==4||Z||Oe==6&&Ae[F-1]&1||Oe==(we.s<0?8:7)),F<1||!Ae[0])b=Z?A(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(Ae.length=F,Z)for(--C;++Ae[--F]>C;)Ae[F]=0,F||(++H,Ae=[1].concat(Ae));for(q=Ae.length;!Ae[--q];);for(tt=0,b="";tt<=q;b+=x.charAt(Ae[tt++]));b=A(b,H,x.charAt(0))}return b}}(),N=function(){function y(P,C,O){var L,x,F,H,q=0,Z=P.length,we=C%d,Ae=C/d|0;for(P=P.slice();Z--;)F=P[Z]%d,H=P[Z]/d|0,L=Ae*F+H*we,x=we*F+L%d*d+q,q=(x/O|0)+(L/d|0)+Ae*H,P[Z]=x%O;return q&&(P=[q].concat(P)),P}function v(P,C,O,L){var x,F;if(O!=L)F=O>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function b(P,C,O,L){for(var x=0;O--;)P[O]-=x,x=P[O]1;P.splice(0,1));}return function(P,C,O,L,x){var F,H,q,Z,we,Ae,Re,tt,lt,Oe,Ue,Ot,hi,ms,ws,sr,Un,$t=P.s==C.s?1:-1,Dt=P.c,$e=C.c;if(!Dt||!Dt[0]||!$e||!$e[0])return new M(!P.s||!C.s||(Dt?$e&&Dt[0]==$e[0]:!$e)?NaN:Dt&&Dt[0]==0||!$e?$t*0:$t/0);for(tt=new M($t),lt=tt.c=[],H=P.e-C.e,$t=O+H+1,x||(x=a,H=E(P.e/u)-E(C.e/u),$t=$t/u|0),q=0;$e[q]==(Dt[q]||0);q++);if($e[q]>(Dt[q]||0)&&H--,$t<0)lt.push(1),Z=!0;else{for(ms=Dt.length,sr=$e.length,q=0,$t+=2,we=i(x/($e[0]+1)),we>1&&($e=y($e,we,x),Dt=y(Dt,we,x),sr=$e.length,ms=Dt.length),hi=sr,Oe=Dt.slice(0,sr),Ue=Oe.length;Ue=x/2&&ws++;do{if(we=0,F=v($e,Oe,sr,Ue),F<0){if(Ot=Oe[0],sr!=Ue&&(Ot=Ot*x+(Oe[1]||0)),we=i(Ot/ws),we>1)for(we>=x&&(we=x-1),Ae=y($e,we,x),Re=Ae.length,Ue=Oe.length;v(Ae,Oe,Re,Ue)==1;)we--,b(Ae,sr=10;$t/=10,q++);oe(tt,O+(tt.e=q+H*u-1)+1,L,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(y,v,b,P){var C,O,L,x,F;if(b==null?b=V:B(b,0,8),!y.c)return y.toString();if(C=y.c[0],L=y.e,v==null)F=T(y.c),F=P==1||P==2&&(L<=k||L>=K)?U(F,L):A(F,L,"0");else if(y=oe(new M(y),v,b),O=y.e,F=T(y.c),x=F.length,P==1||P==2&&(v<=O||O<=k)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=O-x,v>0)for(O+1==x&&(F+=".");v--;F+="0");return y.s<0&&C?"-"+F:F}function ae(y,v){for(var b,P=1,C=new M(y[0]);P=10;C/=10,P++);return(b=P+b*u-1)>ue?y.c=y.e=null:b=10;x/=10,C++);if(O=v-C,O<0)O+=u,L=v,F=Z[H=0],q=F/we[C-L-1]%10|0;else if(H=n((O+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));F=q=0,C=1,O%=u,L=O-u+1}else break e;else{for(F=x=Z[H],C=1;x>=10;x/=10,C++);O%=u,L=O-u+C,q=L<0?0:F/we[C-L-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(L<0?F:F%we[C-L-1]),P=b<4?(q||P)&&(b==0||b==(y.s<0?3:2)):q>5||q==5&&(b==4||P||b==6&&(O>0?L>0?F/we[C-L]:0:Z[H-1])%10&1||b==(y.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=y.e+1,Z[0]=we[(u-v%u)%u],y.e=-v||0):Z[0]=y.e=0,y;if(O==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=we[u-O],Z[H]=L>0?i(F/we[C-L]%we[L])*x:0),P)for(;;)if(H==0){for(O=1,L=Z[0];L>=10;L/=10,O++);for(L=Z[0]+=x,x=1;L>=10;L/=10,x++);O!=x&&(y.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=x,Z[H]!=a)break;Z[H--]=0,x=1}for(O=Z.length;Z[--O]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?U(v,b):A(v,b,"0"),y.s<0?"-"+v:v)}return R.absoluteValue=R.abs=function(){var y=new M(this);return y.s<0&&(y.s=1),y},R.comparedTo=function(y,v){return D(this,new M(y,v))},R.decimalPlaces=R.dp=function(y,v){var b,P,C,O=this;if(y!=null)return B(y,0,g),v==null?v=V:B(v,0,8),oe(new M(O),y+O.e+1,v);if(!(b=O.c))return null;if(P=((C=b.length-1)-E(this.e/u))*u,C=b[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},R.dividedBy=R.div=function(y,v){return N(this,new M(y,v),Q,V)},R.dividedToIntegerBy=R.idiv=function(y,v){return N(this,new M(y,v),0,1)},R.exponentiatedBy=R.pow=function(y,v){var b,P,C,O,L,x,F,H,q,Z=this;if(y=new M(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(v!=null&&(v=new M(v)),x=y.e>14,!Z.c||!Z.c[0]||Z.c[0]==1&&!Z.e&&Z.c.length==1||!y.c||!y.c[0])return q=new M(Math.pow(+ce(Z),x?2-W(y):+ce(y))),v?q.mod(v):q;if(F=y.s<0,v){if(v.c?!v.c[0]:!v.s)return new M(NaN);P=!F&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}else{if(y.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||x&&Z.c[1]>=24e7:Z.c[0]<8e13||x&&Z.c[0]<=9999975e7)))return O=Z.s<0&&W(y)?-0:0,Z.e>-1&&(O=1/O),new M(F?1/O:O);se&&(O=n(se/u+2))}for(x?(b=new M(.5),F&&(y.s=1),H=W(y)):(C=Math.abs(+ce(y)),H=C%2),q=new M(J);;){if(H){if(q=q.times(Z),!q.c)break;O?q.c.length>O&&(q.c.length=O):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(y=y.times(b),oe(y,y.e+1,1),y.e>14)H=W(y);else{if(C=+ce(y),C===0)break;H=C%2}Z=Z.times(Z),O?Z.c&&Z.c.length>O&&(Z.c.length=O):P&&(Z=Z.mod(v))}return P?q:(F&&(q=J.div(q)),v?q.mod(v):O?oe(q,se,V,L):q)},R.integerValue=function(y){var v=new M(this);return y==null?y=V:B(y,0,8),oe(v,v.e+1,y)},R.isEqualTo=R.eq=function(y,v){return D(this,new M(y,v))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(y,v){return D(this,new M(y,v))>0},R.isGreaterThanOrEqualTo=R.gte=function(y,v){return(v=D(this,new M(y,v)))===1||v===0},R.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(y,v){return D(this,new M(y,v))<0},R.isLessThanOrEqualTo=R.lte=function(y,v){return(v=D(this,new M(y,v)))===-1||v===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(y,v){var b,P,C,O,L=this,x=L.s;if(y=new M(y,v),v=y.s,!x||!v)return new M(NaN);if(x!=v)return y.s=-v,L.plus(y);var F=L.e/u,H=y.e/u,q=L.c,Z=y.c;if(!F||!H){if(!q||!Z)return q?(y.s=-v,y):new M(Z?L:NaN);if(!q[0]||!Z[0])return Z[0]?(y.s=-v,y):new M(q[0]?L:V==3?-0:0)}if(F=E(F),H=E(H),q=q.slice(),x=F-H){for((O=x<0)?(x=-x,C=q):(H=F,C=Z),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(O=(x=q.length)<(v=Z.length))?x:v,x=v=0;v0)for(;v--;q[b++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(b=0,we=Ot[C]%lt,Ae=Ot[C]/lt|0,L=F,O=C+L;O>C;)H=Ue[--L]%lt,q=Ue[L]/lt|0,x=Ae*H+q*we,H=we*H+x%lt*lt+Re[O]+b,b=(H/tt|0)+(x/lt|0)+Ae*q,Re[O--]=H%tt;Re[O]=b}return b?++P:Re.splice(0,1),fe(y,Re,P)},R.negated=function(){var y=new M(this);return y.s=-y.s||null,y},R.plus=function(y,v){var b,P=this,C=P.s;if(y=new M(y,v),v=y.s,!C||!v)return new M(NaN);if(C!=v)return y.s=-v,P.minus(y);var O=P.e/u,L=y.e/u,x=P.c,F=y.c;if(!O||!L){if(!x||!F)return new M(C/0);if(!x[0]||!F[0])return F[0]?y:new M(x[0]?P:C*0)}if(O=E(O),L=E(L),x=x.slice(),C=O-L){for(C>0?(L=O,b=F):(C=-C,b=x),b.reverse();C--;b.push(0));b.reverse()}for(C=x.length,v=F.length,C-v<0&&(b=F,F=x,x=b,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),fe(y,x,L)},R.precision=R.sd=function(y,v){var b,P,C,O=this;if(y!=null&&y!==!!y)return B(y,1,g),v==null?v=V:B(v,0,8),oe(new M(O),y,v);if(!(b=O.c))return null;if(C=b.length-1,P=C*u+1,C=b[C]){for(;C%10==0;C/=10,P--);for(C=b[0];C>=10;C/=10,P++);}return y&&O.e+1>P&&(P=O.e+1),P},R.shiftedBy=function(y){return B(y,-l,l),this.times("1e"+y)},R.squareRoot=R.sqrt=function(){var y,v,b,P,C,O=this,L=O.c,x=O.s,F=O.e,H=Q+4,q=new M("0.5");if(x!==1||!L||!L[0])return new M(!x||x<0&&(!L||L[0])?NaN:L?O:1/0);if(x=Math.sqrt(+ce(O)),x==0||x==1/0?(v=T(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=E((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),b=new M(v)):b=new M(x+""),b.c[0]){for(F=b.e,x=F+H,x<3&&(x=0);;)if(C=b,b=q.times(C.plus(N(O,C,H,1))),T(C.c).slice(0,x)===(v=T(b.c)).slice(0,x))if(b.e0&&Re>0){for(O=Re%x||x,q=Ae.substr(0,O);O0&&(q+=H+Ae.slice(O)),we&&(q="-"+q)}P=Z?q+(b.decimalSeparator||"")+((F=+b.fractionGroupSize)?Z.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):Z):q}return(b.prefix||"")+P+(b.suffix||"")},R.toFraction=function(y){var v,b,P,C,O,L,x,F,H,q,Z,we,Ae=this,Re=Ae.c;if(y!=null&&(x=new M(y),!x.isInteger()&&(x.c||x.s!==1)||x.lt(J)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Re)return new M(Ae);for(v=new M(J),H=b=new M(J),P=F=new M(J),we=T(Re),O=v.e=we.length-Ae.e-1,v.c[0]=f[(L=O%u)<0?u+L:L],y=!y||x.comparedTo(v)>0?O>0?v:H:x,L=ue,ue=1/0,x=new M(we),F.c[0]=0;q=N(x,v,0,1),C=b.plus(q.times(P)),C.comparedTo(y)!=1;)b=P,P=C,H=F.plus(q.times(C=H)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(y.minus(b),P,0,1),F=F.plus(C.times(H)),b=b.plus(C.times(P)),F.s=H.s=Ae.s,O=O*2,Z=N(H,P,O,V).minus(Ae).abs().comparedTo(N(F,b,O,V).minus(Ae).abs())<1?[H,P]:[F,b],ue=L,Z},R.toNumber=function(){return+ce(this)},R.toPrecision=function(y,v){return y!=null&&B(y,1,g),le(this,y,v,2)},R.toString=function(y){var v,b=this,P=b.s,C=b.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(y==null?v=C<=k||C>=K?U(T(b.c),C):A(T(b.c),C,"0"):y===10?(b=oe(new M(b),Q+C+1,V),v=A(T(b.c),b.e,"0")):(B(y,2,ie.length,"Base"),v=_(A(T(b.c),C,"0"),10,y,P,!0)),P<0&&b.c[0]&&(v="-"+v)),v},R.valueOf=R.toJSON=function(){return ce(this)},R._isBigNumber=!0,I!=null&&M.set(I),M}function E(I){var N=I|0;return I>0||I===N?N:N-1}function T(I){for(var N,_,S=1,R=I.length,J=I[0]+"";SK^_?1:-1;for(V=(k=R.length)<(K=J.length)?k:K,Q=0;QJ[Q]^_?1:-1;return k==K?0:k>K^_?1:-1}function B(I,N,_,S){if(I_||I!==i(I))throw Error(s+(S||"Argument")+(typeof I=="number"?I_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(I))}function W(I){var N=I.c.length-1;return E(I.e/u)==N&&I.c[N]%2!=0}function U(I,N){return(I.length>1?I.charAt(0)+"."+I.slice(1):I)+(N<0?"e":"e+")+N}function A(I,N,_){var S,R;if(N<0){for(R=_+".";++N;R+=_);I=R+I}else if(S=I.length,++N>S){for(R=_,N-=S;--N;R+=_);I+=R}else N{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ErrIsCompletedFieldIsMissingOnTransaction=he.ErrGasLimitShouldBe0ForInnerTransaction=he.ErrInvalidRelayedV2BuilderArguments=he.ErrInvalidRelayedV1BuilderArguments=he.ErrNotImplemented=he.ErrContractInteraction=he.ErrCodec=he.ErrCannotParseTransactionOutcome=he.ErrCannotParseContractResults=he.ErrMissingFieldOnEnum=he.ErrMissingFieldOnStruct=he.ErrTypingSystem=he.ErrMock=he.ErrContractHasNoAddress=he.ErrContract=he.ErrExpectedTransactionEventsNotFound=he.ErrExpectedTransactionStatusNotReached=he.ErrTransactionWatcherTimeout=he.ErrAsyncTimerAborted=he.ErrAsyncTimerAlreadyRunning=he.ErrInvalidFunctionName=he.ErrSignatureCannotCreate=he.ErrTransactionOptionsInvalid=he.ErrTransactionVersionInvalid=he.ErrNonceInvalid=he.ErrNotEnoughGas=he.ErrAddressEmpty=he.ErrAddressBadHrp=he.ErrAddressCannotCreate=he.ErrUnexpectedCondition=he.ErrInvariantFailed=he.ErrBadType=he.ErrUnsupportedOperation=he.ErrInvalidArgument=he.Err=void 0;var De=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};he.Err=De;var q0=class extends De{constructor(e,r){super(`Invalid argument: ${e}`,r)}};he.ErrInvalidArgument=q0;var V0=class extends De{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};he.ErrUnsupportedOperation=V0;var H0=class extends De{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};he.ErrBadType=H0;var G0=class extends De{constructor(e){super(`Invariant failed: [${e}]`)}};he.ErrInvariantFailed=G0;var k0=class extends De{constructor(e){super(`Unexpected condition: [${e}]`)}};he.ErrUnexpectedCondition=k0;var j0=class extends De{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};he.ErrAddressCannotCreate=j0;var Q0=class extends De{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};he.ErrAddressBadHrp=Q0;var W0=class extends De{constructor(){super("Address is empty")}};he.ErrAddressEmpty=W0;var $0=class extends De{constructor(e){super(`Not enough gas provided: ${e}`)}};he.ErrNotEnoughGas=$0;var z0=class extends De{constructor(e){super(`Invalid nonce: ${e}`)}};he.ErrNonceInvalid=z0;var K0=class extends De{constructor(e){super(`Invalid transaction version: ${e}`)}};he.ErrTransactionVersionInvalid=K0;var Y0=class extends De{constructor(e){super(`Invalid transaction options: ${e}`)}};he.ErrTransactionOptionsInvalid=Y0;var J0=class extends De{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};he.ErrSignatureCannotCreate=J0;var X0=class extends De{constructor(){super("Invalid function name")}};he.ErrInvalidFunctionName=X0;var Z0=class extends De{constructor(){super("Async timer already running")}};he.ErrAsyncTimerAlreadyRunning=Z0;var em=class extends De{constructor(){super("Async timer aborted")}};he.ErrAsyncTimerAborted=em;var tm=class extends De{constructor(){super("TransactionWatcher has timed out")}};he.ErrTransactionWatcherTimeout=tm;var rm=class extends De{constructor(){super("Expected transaction status not reached")}};he.ErrExpectedTransactionStatusNotReached=rm;var nm=class extends De{constructor(){super("Expected transaction events not found")}};he.ErrExpectedTransactionEventsNotFound=nm;var rf=class extends De{constructor(e){super(e)}};he.ErrContract=rf;var im=class extends rf{constructor(){super(` +var N5=Object.create;var sf=Object.defineProperty;var O5=Object.getOwnPropertyDescriptor;var D5=Object.getOwnPropertyNames;var P5=Object.getPrototypeOf,R5=Object.prototype.hasOwnProperty;var hS=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var fe=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ct=(t,e)=>{for(var r in e)sf(t,r,{get:e[r],enumerable:!0})},nf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of D5(e))!R5.call(t,i)&&i!==r&&sf(t,i,{get:()=>e[i],enumerable:!(n=O5(e,i))||n.enumerable});return t},Gt=(t,e,r)=>(nf(t,e,"default"),r&&nf(r,e,"default")),be=(t,e,r)=>(r=t!=null?N5(P5(t)):{},nf(e||!t||!t.__esModule?sf(r,"default",{value:t,enumerable:!0}):r,t)),ft=t=>nf(sf({},"__esModule",{value:!0}),t);var P0=E(of=>{"use strict";l();of.byteLength=L5;of.toByteArray=M5;of.fromByteArray=V5;var rn=[],Tr=[],B5=typeof Uint8Array<"u"?Uint8Array:Array,D0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(bs=0,dS=D0.length;bs0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function L5(t){var e=pS(t),r=e[0],n=e[1];return(r+n)*3/4-n}function F5(t,e,r){return(e+r)*3/4-r}function M5(t){var e,r=pS(t),n=r[0],i=r[1],s=new B5(F5(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Tr[t.charCodeAt(u)]<<2|Tr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Tr[t.charCodeAt(u)]<<10|Tr[t.charCodeAt(u+1)]<<4|Tr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function U5(t){return rn[t>>18&63]+rn[t>>12&63]+rn[t>>6&63]+rn[t&63]}function q5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(rn[e>>2]+rn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(rn[e>>10]+rn[e>>4&63]+rn[e<<2&63]+"=")),i.join("")}});var B0=E(R0=>{l();R0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,h=r?i-1:0,g=r?-1:1,y=t[e+h];for(h+=g,s=y&(1<<-f)-1,y>>=-f,f+=a;f>0;s=s*256+t[e+h],h+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+h],h+=g,f-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(y?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(y?-1:1)*o*Math.pow(2,s-n)};R0.write=function(t,e,r,n,i,s){var o,a,u,c=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,m=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?e+=g/u:e+=g*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=f?(a=0,o=f):o+h>=1?(a=(e*u-1)*Math.pow(2,i),o=o+h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+y]=a&255,y+=m,a/=256,i-=8);for(o=o<0;t[r+y]=o&255,y+=m,o/=256,c-=8);t[r+y-m]|=T*128}});var CS=E(Io=>{"use strict";l();var L0=P0(),bo=B0(),gS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Io.Buffer=$;Io.SlowBuffer=W5;Io.INSPECT_MAX_BYTES=50;var af=2147483647;Io.kMaxLength=af;$.TYPED_ARRAY_SUPPORT=H5();!$.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function H5(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function kn(t){if(t>af)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return q0(t)}return wS(t,e,r)}$.poolSize=8192;function wS(t,e,r){if(typeof t=="string")return k5(t,e);if(ArrayBuffer.isView(t))return j5(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(nn(t,ArrayBuffer)||t&&nn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(nn(t,SharedArrayBuffer)||t&&nn(t.buffer,SharedArrayBuffer)))return M0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return $.from(n,e,r);var i=Q5(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}$.from=function(t,e,r){return wS(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function ES(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function G5(t,e,r){return ES(t),t<=0?kn(t):e!==void 0?typeof r=="string"?kn(t).fill(e,r):kn(t).fill(e):kn(t)}$.alloc=function(t,e,r){return G5(t,e,r)};function q0(t){return ES(t),kn(t<0?0:V0(t)|0)}$.allocUnsafe=function(t){return q0(t)};$.allocUnsafeSlow=function(t){return q0(t)};function k5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=vS(t,e)|0,n=kn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function F0(t){for(var e=t.length<0?0:V0(t.length)|0,r=kn(e),n=0;n=af)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+af.toString(16)+" bytes");return t|0}function W5(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(nn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),nn(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?$.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function vS(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||nn(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return TS(t).length;default:if(i)return n?-1:U0(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=vS;function z5(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return n4(this,e,r);case"utf8":case"utf-8":return bS(this,e,r);case"ascii":return t4(this,e,r);case"latin1":case"binary":return r4(this,e,r);case"base64":return Z5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i4(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Is(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}$.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};gS&&($.prototype[gS]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(nn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n),h=0;h2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,H0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:yS(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):yS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function yS(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(y,m){return s===1?y[m]:y.readUInt16BE(m*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){for(var h=!0,g=0;gi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return $5(this,e,r,n);case"utf8":case"utf-8":return K5(this,e,r,n);case"ascii":case"latin1":case"binary":return Y5(this,e,r,n);case"base64":return J5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Z5(t,e,r){return e===0&&r===t.length?L0.fromByteArray(t):L0.fromByteArray(t.slice(e,r))}function bS(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,c,f,h;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(h=(s&31)<<6|u&63,h>127&&(o=h));break;case 3:u=t[i+1],c=t[i+2],(u&192)===128&&(c&192)===128&&(h=(s&15)<<12|(u&63)<<6|c&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(h=(s&15)<<18|(u&63)<<12|(c&63)<<6|f&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return e4(n)}var mS=4096;function e4(t){var e=t.length;if(e<=mS)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),bo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),bo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),bo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),bo.read(this,e,!1,52,8)};function ur(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;ur(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;ur(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);ur(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);ur(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function IS(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _S(t,e,r,n,i){return e=+e,r=r>>>0,i||IS(t,e,r,4,34028234663852886e22,-34028234663852886e22),bo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return _S(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return _S(this,e,r,!1,n)};function SS(t,e,r,n,i){return e=+e,r=r>>>0,i||IS(t,e,r,8,17976931348623157e292,-17976931348623157e292),bo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return SS(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return SS(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function a4(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function TS(t){return L0.toByteArray(o4(t))}function uf(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function nn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function H0(t){return t!==t}var c4=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var PS=E((fse,DS)=>{l();var mt=DS.exports={},sn,on;function G0(){throw new Error("setTimeout has not been defined")}function k0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?sn=setTimeout:sn=G0}catch{sn=G0}try{typeof clearTimeout=="function"?on=clearTimeout:on=k0}catch{on=k0}})();function xS(t){if(sn===setTimeout)return setTimeout(t,0);if((sn===G0||!sn)&&setTimeout)return sn=setTimeout,setTimeout(t,0);try{return sn(t,0)}catch{try{return sn.call(null,t,0)}catch{return sn.call(this,t,0)}}}function l4(t){if(on===clearTimeout)return clearTimeout(t);if((on===k0||!on)&&clearTimeout)return on=clearTimeout,clearTimeout(t);try{return on(t)}catch{try{return on.call(null,t)}catch{return on.call(this,t)}}}var jn=[],_o=!1,_s,cf=-1;function f4(){!_o||!_s||(_o=!1,_s.length?jn=_s.concat(jn):cf=-1,jn.length&&NS())}function NS(){if(!_o){var t=xS(f4);_o=!0;for(var e=jn.length;e;){for(_s=jn,jn=[];++cf1)for(var r=1;r{d=be(CS()),p=be(PS()),h4=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=h4});var kt=E((RS,lf)=>{l();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,g=1e9;function y(_){var N,I,S,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),Q=20,V=4,k=-7,K=21,ge=-1e7,ue=1e7,re=!1,Y=1,se=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ie="0123456789abcdefghijklmnopqrstuvwxyz";function M(w,v){var b,P,C,D,L,x,F,H,q=this;if(!(q instanceof M))return new M(w,v);if(v==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>ue?q.c=q.e=null:w.e=10;L/=10,D++);D>ue?q.c=q.e=null:(q.e=D,q.c=[w]);return}H=String(w)}else{if(!r.test(H=String(w)))return S(q,H,x);q.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(D=H.indexOf("."))>-1&&(H=H.replace(".","")),(L=H.search(/e/i))>0?(D<0&&(D=L),D+=+H.slice(L+1),H=H.substring(0,L)):D<0&&(D=H.length)}else{if(B(v,2,ie.length,"Base"),v==10)return q=new M(w),oe(q,Q+q.e+1,V);if(H=String(w),x=typeof w=="number"){if(w*0!=0)return S(q,H,x,v);if(q.s=1/w<0?(H=H.slice(1),-1):1,M.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+w)}else q.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(b=ie.slice(0,v),D=L=0,F=H.length;LD){D=F;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,L=-1,D=0;continue}return S(q,String(w),x,v)}x=!1,H=I(H,v,10,q.s),(D=H.indexOf("."))>-1?H=H.replace(".",""):D=H.length}for(L=0;H.charCodeAt(L)===48;L++);for(F=H.length;H.charCodeAt(--F)===48;);if(H=H.slice(L,++F)){if(F-=L,x&&M.DEBUG&&F>15&&(w>c||w!==i(w)))throw Error(o+q.s*w);if((D=D-L-1)>ue)q.c=q.e=null;else if(D=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||b!==i(b))break e;if(b!==0)return!0}}}else if(P===null&&C===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+w)},M.maximum=M.max=function(){return ae(arguments,R.lt)},M.minimum=M.min=function(){return ae(arguments,R.gt)},M.random=function(){var w=9007199254740992,v=Math.random()*w&2097151?function(){return i(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var P,C,D,L,x,F=0,H=[],q=new M(J);if(b==null?b=Q:B(b,0,g),L=n(b/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(H.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(H.push(x%1e14),F+=7);F=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(b,P,C,D,L){var x,F,H,q,Z,we,Ae,Re,tt=b.indexOf("."),lt=Q,Oe=V;for(tt>=0&&(q=se,se=0,b=b.replace(".",""),Re=new M(P),we=Re.pow(b.length-tt),se=q,Re.c=v(A(T(we.c),we.e,"0"),10,C,w),Re.e=Re.c.length),Ae=v(b,P,C,L?(x=ie,w):(x=w,ie)),H=q=Ae.length;Ae[--q]==0;Ae.pop());if(!Ae[0])return x.charAt(0);if(tt<0?--H:(we.c=Ae,we.e=H,we.s=D,we=N(we,Re,lt,Oe,C),Ae=we.c,Z=we.r,H=we.e),F=H+lt+1,tt=Ae[F],q=C/2,Z=Z||F<0||Ae[F+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>q||tt==q&&(Oe==4||Z||Oe==6&&Ae[F-1]&1||Oe==(we.s<0?8:7)),F<1||!Ae[0])b=Z?A(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(Ae.length=F,Z)for(--C;++Ae[--F]>C;)Ae[F]=0,F||(++H,Ae=[1].concat(Ae));for(q=Ae.length;!Ae[--q];);for(tt=0,b="";tt<=q;b+=x.charAt(Ae[tt++]));b=A(b,H,x.charAt(0))}return b}}(),N=function(){function w(P,C,D){var L,x,F,H,q=0,Z=P.length,we=C%h,Ae=C/h|0;for(P=P.slice();Z--;)F=P[Z]%h,H=P[Z]/h|0,L=Ae*F+H*we,x=we*F+L%h*h+q,q=(x/D|0)+(L/h|0)+Ae*H,P[Z]=x%D;return q&&(P=[q].concat(P)),P}function v(P,C,D,L){var x,F;if(D!=L)F=D>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function b(P,C,D,L){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,C,D,L,x){var F,H,q,Z,we,Ae,Re,tt,lt,Oe,Ue,Ot,gi,vs,As,ar,Gn,$t=P.s==C.s?1:-1,Dt=P.c,ze=C.c;if(!Dt||!Dt[0]||!ze||!ze[0])return new M(!P.s||!C.s||(Dt?ze&&Dt[0]==ze[0]:!ze)?NaN:Dt&&Dt[0]==0||!ze?$t*0:$t/0);for(tt=new M($t),lt=tt.c=[],H=P.e-C.e,$t=D+H+1,x||(x=a,H=m(P.e/u)-m(C.e/u),$t=$t/u|0),q=0;ze[q]==(Dt[q]||0);q++);if(ze[q]>(Dt[q]||0)&&H--,$t<0)lt.push(1),Z=!0;else{for(vs=Dt.length,ar=ze.length,q=0,$t+=2,we=i(x/(ze[0]+1)),we>1&&(ze=w(ze,we,x),Dt=w(Dt,we,x),ar=ze.length,vs=Dt.length),gi=ar,Oe=Dt.slice(0,ar),Ue=Oe.length;Ue=x/2&&As++;do{if(we=0,F=v(ze,Oe,ar,Ue),F<0){if(Ot=Oe[0],ar!=Ue&&(Ot=Ot*x+(Oe[1]||0)),we=i(Ot/As),we>1)for(we>=x&&(we=x-1),Ae=w(ze,we,x),Re=Ae.length,Ue=Oe.length;v(Ae,Oe,Re,Ue)==1;)we--,b(Ae,ar=10;$t/=10,q++);oe(tt,D+(tt.e=q+H*u-1)+1,L,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(w,v,b,P){var C,D,L,x,F;if(b==null?b=V:B(b,0,8),!w.c)return w.toString();if(C=w.c[0],L=w.e,v==null)F=T(w.c),F=P==1||P==2&&(L<=k||L>=K)?U(F,L):A(F,L,"0");else if(w=oe(new M(w),v,b),D=w.e,F=T(w.c),x=F.length,P==1||P==2&&(v<=D||D<=k)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=D-x,v>0)for(D+1==x&&(F+=".");v--;F+="0");return w.s<0&&C?"-"+F:F}function ae(w,v){for(var b,P=1,C=new M(w[0]);P=10;C/=10,P++);return(b=P+b*u-1)>ue?w.c=w.e=null:b=10;x/=10,C++);if(D=v-C,D<0)D+=u,L=v,F=Z[H=0],q=F/we[C-L-1]%10|0;else if(H=n((D+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));F=q=0,C=1,D%=u,L=D-u+1}else break e;else{for(F=x=Z[H],C=1;x>=10;x/=10,C++);D%=u,L=D-u+C,q=L<0?0:F/we[C-L-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(L<0?F:F%we[C-L-1]),P=b<4?(q||P)&&(b==0||b==(w.s<0?3:2)):q>5||q==5&&(b==4||P||b==6&&(D>0?L>0?F/we[C-L]:0:Z[H-1])%10&1||b==(w.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=w.e+1,Z[0]=we[(u-v%u)%u],w.e=-v||0):Z[0]=w.e=0,w;if(D==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=we[u-D],Z[H]=L>0?i(F/we[C-L]%we[L])*x:0),P)for(;;)if(H==0){for(D=1,L=Z[0];L>=10;L/=10,D++);for(L=Z[0]+=x,x=1;L>=10;L/=10,x++);D!=x&&(w.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=x,Z[H]!=a)break;Z[H--]=0,x=1}for(D=Z.length;Z[--D]===0;Z.pop());}w.e>ue?w.c=w.e=null:w.e=K?U(v,b):A(v,b,"0"),w.s<0?"-"+v:v)}return R.absoluteValue=R.abs=function(){var w=new M(this);return w.s<0&&(w.s=1),w},R.comparedTo=function(w,v){return O(this,new M(w,v))},R.decimalPlaces=R.dp=function(w,v){var b,P,C,D=this;if(w!=null)return B(w,0,g),v==null?v=V:B(v,0,8),oe(new M(D),w+D.e+1,v);if(!(b=D.c))return null;if(P=((C=b.length-1)-m(this.e/u))*u,C=b[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},R.dividedBy=R.div=function(w,v){return N(this,new M(w,v),Q,V)},R.dividedToIntegerBy=R.idiv=function(w,v){return N(this,new M(w,v),0,1)},R.exponentiatedBy=R.pow=function(w,v){var b,P,C,D,L,x,F,H,q,Z=this;if(w=new M(w),w.c&&!w.isInteger())throw Error(s+"Exponent not an integer: "+ce(w));if(v!=null&&(v=new M(v)),x=w.e>14,!Z.c||!Z.c[0]||Z.c[0]==1&&!Z.e&&Z.c.length==1||!w.c||!w.c[0])return q=new M(Math.pow(+ce(Z),x?2-W(w):+ce(w))),v?q.mod(v):q;if(F=w.s<0,v){if(v.c?!v.c[0]:!v.s)return new M(NaN);P=!F&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}else{if(w.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||x&&Z.c[1]>=24e7:Z.c[0]<8e13||x&&Z.c[0]<=9999975e7)))return D=Z.s<0&&W(w)?-0:0,Z.e>-1&&(D=1/D),new M(F?1/D:D);se&&(D=n(se/u+2))}for(x?(b=new M(.5),F&&(w.s=1),H=W(w)):(C=Math.abs(+ce(w)),H=C%2),q=new M(J);;){if(H){if(q=q.times(Z),!q.c)break;D?q.c.length>D&&(q.c.length=D):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(w=w.times(b),oe(w,w.e+1,1),w.e>14)H=W(w);else{if(C=+ce(w),C===0)break;H=C%2}Z=Z.times(Z),D?Z.c&&Z.c.length>D&&(Z.c.length=D):P&&(Z=Z.mod(v))}return P?q:(F&&(q=J.div(q)),v?q.mod(v):D?oe(q,se,V,L):q)},R.integerValue=function(w){var v=new M(this);return w==null?w=V:B(w,0,8),oe(v,v.e+1,w)},R.isEqualTo=R.eq=function(w,v){return O(this,new M(w,v))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(w,v){return O(this,new M(w,v))>0},R.isGreaterThanOrEqualTo=R.gte=function(w,v){return(v=O(this,new M(w,v)))===1||v===0},R.isInteger=function(){return!!this.c&&m(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(w,v){return O(this,new M(w,v))<0},R.isLessThanOrEqualTo=R.lte=function(w,v){return(v=O(this,new M(w,v)))===-1||v===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(w,v){var b,P,C,D,L=this,x=L.s;if(w=new M(w,v),v=w.s,!x||!v)return new M(NaN);if(x!=v)return w.s=-v,L.plus(w);var F=L.e/u,H=w.e/u,q=L.c,Z=w.c;if(!F||!H){if(!q||!Z)return q?(w.s=-v,w):new M(Z?L:NaN);if(!q[0]||!Z[0])return Z[0]?(w.s=-v,w):new M(q[0]?L:V==3?-0:0)}if(F=m(F),H=m(H),q=q.slice(),x=F-H){for((D=x<0)?(x=-x,C=q):(H=F,C=Z),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(D=(x=q.length)<(v=Z.length))?x:v,x=v=0;v0)for(;v--;q[b++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(b=0,we=Ot[C]%lt,Ae=Ot[C]/lt|0,L=F,D=C+L;D>C;)H=Ue[--L]%lt,q=Ue[L]/lt|0,x=Ae*H+q*we,H=we*H+x%lt*lt+Re[D]+b,b=(H/tt|0)+(x/lt|0)+Ae*q,Re[D--]=H%tt;Re[D]=b}return b?++P:Re.splice(0,1),he(w,Re,P)},R.negated=function(){var w=new M(this);return w.s=-w.s||null,w},R.plus=function(w,v){var b,P=this,C=P.s;if(w=new M(w,v),v=w.s,!C||!v)return new M(NaN);if(C!=v)return w.s=-v,P.minus(w);var D=P.e/u,L=w.e/u,x=P.c,F=w.c;if(!D||!L){if(!x||!F)return new M(C/0);if(!x[0]||!F[0])return F[0]?w:new M(x[0]?P:C*0)}if(D=m(D),L=m(L),x=x.slice(),C=D-L){for(C>0?(L=D,b=F):(C=-C,b=x),b.reverse();C--;b.push(0));b.reverse()}for(C=x.length,v=F.length,C-v<0&&(b=F,F=x,x=b,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),he(w,x,L)},R.precision=R.sd=function(w,v){var b,P,C,D=this;if(w!=null&&w!==!!w)return B(w,1,g),v==null?v=V:B(v,0,8),oe(new M(D),w,v);if(!(b=D.c))return null;if(C=b.length-1,P=C*u+1,C=b[C]){for(;C%10==0;C/=10,P--);for(C=b[0];C>=10;C/=10,P++);}return w&&D.e+1>P&&(P=D.e+1),P},R.shiftedBy=function(w){return B(w,-c,c),this.times("1e"+w)},R.squareRoot=R.sqrt=function(){var w,v,b,P,C,D=this,L=D.c,x=D.s,F=D.e,H=Q+4,q=new M("0.5");if(x!==1||!L||!L[0])return new M(!x||x<0&&(!L||L[0])?NaN:L?D:1/0);if(x=Math.sqrt(+ce(D)),x==0||x==1/0?(v=T(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=m((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),b=new M(v)):b=new M(x+""),b.c[0]){for(F=b.e,x=F+H,x<3&&(x=0);;)if(C=b,b=q.times(C.plus(N(D,C,H,1))),T(C.c).slice(0,x)===(v=T(b.c)).slice(0,x))if(b.e0&&Re>0){for(D=Re%x||x,q=Ae.substr(0,D);D0&&(q+=H+Ae.slice(D)),we&&(q="-"+q)}P=Z?q+(b.decimalSeparator||"")+((F=+b.fractionGroupSize)?Z.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):Z):q}return(b.prefix||"")+P+(b.suffix||"")},R.toFraction=function(w){var v,b,P,C,D,L,x,F,H,q,Z,we,Ae=this,Re=Ae.c;if(w!=null&&(x=new M(w),!x.isInteger()&&(x.c||x.s!==1)||x.lt(J)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Re)return new M(Ae);for(v=new M(J),H=b=new M(J),P=F=new M(J),we=T(Re),D=v.e=we.length-Ae.e-1,v.c[0]=f[(L=D%u)<0?u+L:L],w=!w||x.comparedTo(v)>0?D>0?v:H:x,L=ue,ue=1/0,x=new M(we),F.c[0]=0;q=N(x,v,0,1),C=b.plus(q.times(P)),C.comparedTo(w)!=1;)b=P,P=C,H=F.plus(q.times(C=H)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(w.minus(b),P,0,1),F=F.plus(C.times(H)),b=b.plus(C.times(P)),F.s=H.s=Ae.s,D=D*2,Z=N(H,P,D,V).minus(Ae).abs().comparedTo(N(F,b,D,V).minus(Ae).abs())<1?[H,P]:[F,b],ue=L,Z},R.toNumber=function(){return+ce(this)},R.toPrecision=function(w,v){return w!=null&&B(w,1,g),le(this,w,v,2)},R.toString=function(w){var v,b=this,P=b.s,C=b.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(w==null?v=C<=k||C>=K?U(T(b.c),C):A(T(b.c),C,"0"):w===10?(b=oe(new M(b),Q+C+1,V),v=A(T(b.c),b.e,"0")):(B(w,2,ie.length,"Base"),v=I(A(T(b.c),C,"0"),10,w,P,!0)),P<0&&b.c[0]&&(v="-"+v)),v},R.valueOf=R.toJSON=function(){return ce(this)},R._isBigNumber=!0,_!=null&&M.set(_),M}function m(_){var N=_|0;return _>0||_===N?N:N-1}function T(_){for(var N,I,S=1,R=_.length,J=_[0]+"";SK^I?1:-1;for(V=(k=R.length)<(K=J.length)?k:K,Q=0;QJ[Q]^I?1:-1;return k==K?0:k>K^I?1:-1}function B(_,N,I,S){if(_I||_!==i(_))throw Error(s+(S||"Argument")+(typeof _=="number"?_I?" out of range: ":" not an integer: ":" not a primitive number: ")+String(_))}function W(_){var N=_.c.length-1;return m(_.e/u)==N&&_.c[N]%2!=0}function U(_,N){return(_.length>1?_.charAt(0)+"."+_.slice(1):_)+(N<0?"e":"e+")+N}function A(_,N,I){var S,R;if(N<0){for(R=I+".";++N;R+=I);_=R+_}else if(S=_.length,++N>S){for(R=I,N-=S;--N;R+=I);_+=R}else N{"use strict";l();Object.defineProperty(de,"__esModule",{value:!0});de.ErrIsCompletedFieldIsMissingOnTransaction=de.ErrGasLimitShouldBe0ForInnerTransaction=de.ErrInvalidRelayedV2BuilderArguments=de.ErrInvalidRelayedV1BuilderArguments=de.ErrNotImplemented=de.ErrContractInteraction=de.ErrCodec=de.ErrCannotParseTransactionOutcome=de.ErrCannotParseContractResults=de.ErrMissingFieldOnEnum=de.ErrMissingFieldOnStruct=de.ErrTypingSystem=de.ErrMock=de.ErrContractHasNoAddress=de.ErrContract=de.ErrExpectedTransactionEventsNotFound=de.ErrExpectedTransactionStatusNotReached=de.ErrTransactionWatcherTimeout=de.ErrAsyncTimerAborted=de.ErrAsyncTimerAlreadyRunning=de.ErrInvalidFunctionName=de.ErrSignatureCannotCreate=de.ErrTransactionOptionsInvalid=de.ErrTransactionVersionInvalid=de.ErrNonceInvalid=de.ErrNotEnoughGas=de.ErrAddressEmpty=de.ErrAddressBadHrp=de.ErrAddressCannotCreate=de.ErrUnexpectedCondition=de.ErrInvariantFailed=de.ErrBadType=de.ErrUnsupportedOperation=de.ErrInvalidArgument=de.Err=void 0;var De=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};de.Err=De;var j0=class extends De{constructor(e,r){super(`Invalid argument: ${e}`,r)}};de.ErrInvalidArgument=j0;var Q0=class extends De{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};de.ErrUnsupportedOperation=Q0;var W0=class extends De{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};de.ErrBadType=W0;var z0=class extends De{constructor(e){super(`Invariant failed: [${e}]`)}};de.ErrInvariantFailed=z0;var $0=class extends De{constructor(e){super(`Unexpected condition: [${e}]`)}};de.ErrUnexpectedCondition=$0;var K0=class extends De{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};de.ErrAddressCannotCreate=K0;var Y0=class extends De{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};de.ErrAddressBadHrp=Y0;var J0=class extends De{constructor(){super("Address is empty")}};de.ErrAddressEmpty=J0;var X0=class extends De{constructor(e){super(`Not enough gas provided: ${e}`)}};de.ErrNotEnoughGas=X0;var Z0=class extends De{constructor(e){super(`Invalid nonce: ${e}`)}};de.ErrNonceInvalid=Z0;var em=class extends De{constructor(e){super(`Invalid transaction version: ${e}`)}};de.ErrTransactionVersionInvalid=em;var tm=class extends De{constructor(e){super(`Invalid transaction options: ${e}`)}};de.ErrTransactionOptionsInvalid=tm;var rm=class extends De{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};de.ErrSignatureCannotCreate=rm;var nm=class extends De{constructor(){super("Invalid function name")}};de.ErrInvalidFunctionName=nm;var im=class extends De{constructor(){super("Async timer already running")}};de.ErrAsyncTimerAlreadyRunning=im;var sm=class extends De{constructor(){super("Async timer aborted")}};de.ErrAsyncTimerAborted=sm;var om=class extends De{constructor(){super("TransactionWatcher has timed out")}};de.ErrTransactionWatcherTimeout=om;var am=class extends De{constructor(){super("Expected transaction status not reached")}};de.ErrExpectedTransactionStatusNotReached=am;var um=class extends De{constructor(){super("Expected transaction events not found")}};de.ErrExpectedTransactionEventsNotFound=um;var ff=class extends De{constructor(e){super(e)}};de.ErrContract=ff;var cm=class extends ff{constructor(){super(` The smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately. If you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). -`)}};he.ErrContractHasNoAddress=im;var sm=class extends De{constructor(e){super(e)}};he.ErrMock=sm;var om=class extends De{constructor(e){super(e)}};he.ErrTypingSystem=om;var am=class extends De{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};he.ErrMissingFieldOnStruct=am;var um=class extends De{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};he.ErrMissingFieldOnEnum=um;var cm=class extends De{constructor(e){super(`cannot parse contract results: ${e}`)}};he.ErrCannotParseContractResults=cm;var lm=class extends De{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};he.ErrCannotParseTransactionOutcome=lm;var fm=class extends De{constructor(e){super(e)}};he.ErrCodec=fm;var hm=class extends De{constructor(e){super(e)}};he.ErrContractInteraction=hm;var dm=class extends De{constructor(){super("Method not yet implemented")}};he.ErrNotImplemented=dm;var pm=class extends De{constructor(){super("invalid arguments for relayed v1 builder")}};he.ErrInvalidRelayedV1BuilderArguments=pm;var gm=class extends De{constructor(){super("invalid arguments for relayed v2 builder")}};he.ErrInvalidRelayedV2BuilderArguments=gm;var ym=class extends De{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};he.ErrGasLimitShouldBe0ForInnerTransaction=ym;var mm=class extends De{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};he.ErrIsCompletedFieldIsMissingOnTransaction=mm});var Em=m(di=>{"use strict";c();var k5=di&&di.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(di,"__esModule",{value:!0});di.TokenPayment=di.TokenTransfer=void 0;var Cu=k5(Gt()),j5=Be(),ES="EGLD",vS=18;Cu.default.set({ROUNDING_MODE:1});var nf=class t{constructor(e){let r=new Cu.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new j5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new Cu.default(e).shiftedBy(vS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:ES,nonce:0,amountAsBigInteger:e,numDecimals:vS})}static fungibleFromAmount(e,r,n){let i=new Cu.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Cu.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==ES}isFungible(){return this.nonce==0}};di.TokenTransfer=nf;var wm=class extends nf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};di.TokenPayment=wm});var bs=m(ze=>{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.ARGUMENTS_SEPARATOR=ze.ESDT_TRANSFER_VALUE=ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_GAS_LIMIT=ze.TRANSACTION_VERSION_WITH_OPTIONS=ze.TRANSACTION_VERSION_DEFAULT=ze.TRANSACTION_OPTIONS_TX_GUARDED=ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=ze.TRANSACTION_OPTIONS_DEFAULT=ze.TRANSACTION_MIN_GAS_PRICE=void 0;ze.TRANSACTION_MIN_GAS_PRICE=1e9;ze.TRANSACTION_OPTIONS_DEFAULT=0;ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ze.TRANSACTION_OPTIONS_TX_GUARDED=2;ze.TRANSACTION_VERSION_DEFAULT=1;ze.TRANSACTION_VERSION_WITH_OPTIONS=2;ze.ESDT_TRANSFER_GAS_LIMIT=5e5;ze.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ze.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ze.ESDT_TRANSFER_VALUE="0";ze.ARGUMENTS_SEPARATOR="@"});var wr=m(nt=>{"use strict";c();var Q5=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W5=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q5(e,t,r);return W5(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var bo=$5(Be());function z5(t,e){if(!t)throw new bo.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=z5;function K5(t,e){AS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=K5;function AS(t,e){if(e==null||e===void 0)throw new bo.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=AS;function Y5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new bo.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=Y5;function J5(t,e){let r=t.length||0;if(r!=e)throw new bo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=J5;function X5(t,e){if(vm(t))throw new bo.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=X5;function Z5(t,e){if(!vm(t))throw new bo.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=Z5;function vm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=vm});var bS=m(sf=>{"use strict";c();Object.defineProperty(sf,"__esModule",{value:!0});sf.getJavascriptPrototypesInHierarchy=void 0;function e4(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}sf.getJavascriptPrototypesInHierarchy=e4});var It=m(_t=>{"use strict";c();Object.defineProperty(_t,"__esModule",{value:!0});_t.NullType=_t.TypePlaceholder=_t.isTyped=_t.PrimitiveValue=_t.TypedValue=_t.CustomType=_t.PrimitiveType=_t.TypeCardinality=_t.Type=void 0;var Am=bS(),_S=wr(),pi=class t{constructor(e,r=[],n=xu.fixed(1)){_S.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return Am.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return _S.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Am.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};_t.Type=pi;pi.ClassName="Type";var xu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};_t.TypeCardinality=xu;xu.MaxCardinality=4096;var of=class t extends pi{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveType=of;of.ClassName="PrimitiveType";var af=class t extends pi{getClassName(){return t.ClassName}};_t.CustomType=af;af.ClassName="CustomType";var Nu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return Am.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};_t.TypedValue=Nu;Nu.ClassName="TypedValue";var uf=class t extends Nu{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveValue=uf;uf.ClassName="PrimitiveValue";function t4(t){return t.belongsToTypesystem!==void 0}_t.isTyped=t4;var cf=class t extends pi{constructor(){super("...")}getClassName(){return t.ClassName}};_t.TypePlaceholder=cf;cf.ClassName="TypePlaceholder";var lf=class t extends pi{constructor(){super("?")}getClassName(){return t.ClassName}};_t.NullType=lf;lf.ClassName="NullType"});var IS=m((_o,Io)=>{c();(function(t){var e=typeof _o=="object"&&_o&&!_o.nodeType&&_o,r=typeof Io=="object"&&Io&&!Io.nodeType&&Io,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,g=128,w="-",E=/^xn--/,T=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=o-a,U=Math.floor,A=String.fromCharCode,I;function N(Y){throw new RangeError(B[Y])}function _(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function S(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(D,".");var M=Y.split("."),le=_(M,se).join(".");return ie+le}function R(Y){for(var se=[],te=0,ie=Y.length,M,le;te=55296&&M<=56319&&te65535&&(se-=65536,te+=A(se>>>10&1023|55296),se=56320|se&1023),te+=A(se),te}).join("")}function Q(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function V(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function k(Y,se,te){var ie=0;for(Y=te?U(Y/f):Y>>1,Y+=U(Y/se);Y>W*u>>1;ie+=o)Y=U(Y/W);return U(ie+(W+1)*Y/(Y+l))}function K(Y){var se=[],te=Y.length,ie,M=0,le=g,ae=d,fe,oe,ce,y,v,b,P,C,O;for(fe=Y.lastIndexOf(w),fe<0&&(fe=0),oe=0;oe=128&&N("not-basic"),se.push(Y.charCodeAt(oe));for(ce=fe>0?fe+1:0;ce=te&&N("invalid-input"),P=Q(Y.charCodeAt(ce++)),(P>=o||P>U((s-M)/v))&&N("overflow"),M+=P*v,C=b<=ae?a:b>=ae+u?u:b-ae,!(PU(s/O)&&N("overflow"),v*=O;ie=se.length+1,ae=k(M-y,ie,y==0),U(M/ie)>s-le&&N("overflow"),le+=U(M/ie),M%=ie,se.splice(M++,0,le)}return J(se)}function pe(Y){var se,te,ie,M,le,ae,fe,oe,ce,y,v,b=[],P,C,O,L;for(Y=R(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&vU((s-te)/C)&&N("overflow"),te+=(fe-se)*C,se=fe,ae=0;aes&&N("overflow"),v==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var TS=IS();function r4(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function bm(t){return t>="0"&&t<="7"}function n4(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function SS(t){return t=parseInt(t,16),TS.ucs2.encode([t])}function CS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!n4(l))throw new r4(u,"Unexpected token ILLEGAL");return l}for(;e{c();var DS=xS();BS.exports={validate:i4,parse:s4};function i4(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{ff(t,0,e,!1)}catch(n){r=n.message}return r}function s4(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=ff(t,0,e,!0);return r.value}function PS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function c4(t,e,r,n){for(var i=e,s=",",o=[],a=e;_s(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=ff(t,i,r,n),l=PS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function l4(t,e){return t.substr(e,4)==="true"}function f4(t,e){return t.substr(e,5)==="false"}function h4(t,e){return t.substr(e,4)==="null"}var d4=new RegExp(/^\s$/);function _s(t){return d4.test(t)}var p4=new RegExp(/^\d$/);function NS(t){return p4.test(t)}function Gn(t,e,r){var n=10,i;t.length{"use strict";c();var g4=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4=rn&&rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g4(e,t,r);return y4(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.TypeExpressionParser=void 0;var FS=m4(Be()),w4=It(),E4=LS(),Im=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new FS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return E4.parse(r)}catch{throw new FS.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new w4.Type(e,n)}};rn.TypeExpressionParser=Im});var Tm=m(gi=>{"use strict";c();Object.defineProperty(gi,"__esModule",{value:!0});gi.EndpointParameterDefinition=gi.EndpointModifiers=gi.EndpointDefinition=void 0;var v4=hf(),MS="?",A4="N / A",Sm=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?MS:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Ou.fromJSON(s)),n=e.outputs.map(s=>Ou.fromJSON(s)),i=new df(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};gi.EndpointDefinition=Sm;var df=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};gi.EndpointModifiers=df;var Ou=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new v4.TypeExpressionParser().parse(e.type);return new t(e.name||MS,e.description||A4,r)}};gi.EndpointParameterDefinition=Ou});var So=m(ar=>{"use strict";c();var b4=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_4=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b4(e,t,r);return _4(e,t),e};Object.defineProperty(ar,"__esModule",{value:!0});ar.Fields=ar.Field=ar.FieldDefinition=void 0;var Cm=I4(Be()),S4=hf(),xm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new S4.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};ar.FieldDefinition=xm;var Nm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Cm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Cm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};ar.Field=Nm;var Om=class{static checkTyping(e,r){if(e.length!=r.length)throw new Cm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(yi,"__esModule",{value:!0});yi.EnumValue=yi.EnumVariantDefinition=yi.EnumType=void 0;var T4=Be(),Dm=wr(),pf=So(),qS=It(),US=256,gf=class t extends qS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>yf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Dm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Dm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};yi.EnumType=gf;gf.ClassName="EnumType";var yf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Dm.guardTrue(rpf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return pf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};yi.EnumVariantDefinition=yf;var mf=class t extends qS.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();pf.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=pf.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new T4.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};yi.EnumValue=mf;mf.ClassName="EnumValue"});var Co=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.Struct=To.StructType=void 0;var C4=Be(),wf=So(),VS=It(),Ef=class t extends VS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>wf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return wf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};To.StructType=Ef;Ef.ClassName="StructType";var vf=class t extends VS.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();wf.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new C4.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return wf.Fields.equals(r,n)}};To.Struct=vf;vf.ClassName="Struct"});var Rm=m((rse,kS)=>{"use strict";c();var bf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Pm={};for(Pu=0;Pu>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function HS(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=xo(e)^n>>5}for(e=xo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=HS(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=xo(n)^o,i+=bf.charAt(o)}for(s=0;s<6;++s)n=xo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=bf.charAt(a)}return i}function GS(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=HS(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function N4(){var t=GS.apply(null,arguments);if(typeof t=="object")return t}function O4(t){var e=GS.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function _f(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var L4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jS=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Address=void 0;var If=jS(Rm()),No=jS(Be()),Bm="erd",Lm=32,M4="0".repeat(16),Fm=class t{constructor(e){if(this.valueHex="",!!e){if(e instanceof t)return t.fromAddress(e);if(e instanceof h.Buffer)return t.fromBuffer(e);if(typeof e=="string")return t.fromString(e);throw new No.ErrAddressCannotCreate(e)}}static fromAddress(e){return t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Lm)throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(e.toString("hex"))}static fromString(e){return t.isValidHex(e)?t.fromValidHex(e):t.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Lm}static fromHex(e){if(!t.isValidHex(e))throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=If.decode(e)}catch(s){throw new No.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Bm)throw new No.ErrAddressBadHrp(Bm,n);let i=h.Buffer.from(If.fromWords(r.words));if(i.length!=Lm)throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=If.toWords(this.pubkey());return If.encode(Bm,e)}pubkey(){return this.isEmpty()?h.Buffer.from([]):h.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(M4)}};nn.Address=Fm});var Do=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.AddressValue=Oo.AddressType=void 0;var U4=ht(),QS=It(),Ru=class t extends QS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Oo.AddressType=Ru;Ru.ClassName="AddressType";var Sf=class t extends QS.PrimitiveValue{constructor(e){super(new Ru),this.value=new U4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Oo.AddressValue=Sf;Sf.ClassName="AddressValue"});var Cf=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.OptionalValue=Po.OptionalType=void 0;var q4=wr(),Bu=It(),Lu=class t extends Bu.Type{constructor(e){super("Optional",[e],Bu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Bu.NullType.ClassName);return r||n}};Po.OptionalType=Lu;Lu.ClassName="OptionalType";var Tf=class t extends Bu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Lu(new Bu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return q4.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Po.OptionalValue=Tf;Tf.ClassName="OptionalValue"});var Mu=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BooleanValue=Ro.BooleanType=void 0;var WS=It(),Fu=class t extends WS.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Ro.BooleanType=Fu;Fu.ClassName="BooleanType";var xf=class t extends WS.PrimitiveValue{constructor(e){super(new Fu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Ro.BooleanValue=xf;xf.ClassName="BooleanValue"});var mi=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BytesValue=Bo.BytesType=void 0;var $S=It(),Uu=class t extends $S.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Bo.BytesType=Uu;Uu.ClassName="BytesType";var Nf=class t extends $S.PrimitiveValue{constructor(e){super(new Uu),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Bo.BytesValue=Nf;Nf.ClassName="BytesValue"});var KS=m(Lo=>{"use strict";c();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.CodeMetadataValue=Lo.CodeMetadataType=void 0;var zS=It(),Of=class extends zS.PrimitiveType{constructor(){super("CodeMetadata")}};Lo.CodeMetadataType=Of;var Mm=class extends zS.PrimitiveValue{constructor(e){super(new Of),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Lo.CodeMetadataValue=Mm});var Pf=m(Fo=>{"use strict";c();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.CompositeValue=Fo.CompositeType=void 0;var V4=wr(),Um=It(),qu=class t extends Um.Type{constructor(...e){super("Composite",e,Um.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Fo.CompositeType=qu;qu.ClassName="CompositeType";var Df=class t extends Um.TypedValue{constructor(e,r){super(e),V4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new qu(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.CollectionOfTypedValues=void 0;var qm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(sn,"__esModule",{value:!0});sn.List=sn.OptionValue=sn.ListType=sn.OptionType=void 0;var H4=wr(),G4=Vm(),Ss=It(),Is=class t extends Ss.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Ss.NullType.ClassName);return r||n}};sn.OptionType=Is;Is.ClassName="OptionType";var Vu=class t extends Ss.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};sn.ListType=Vu;Vu.ClassName="ListType";var Bf=class t extends Ss.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Is(new Ss.NullType);return new t(e)}static newMissingTyped(e){return new t(new Is(e))}static newProvided(e){let r=new Is(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return H4.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};sn.OptionValue=Bf;Bf.ClassName="OptionValue";var Lf=class t extends Ss.TypedValue{constructor(e,r){super(e),this.backingCollection=new G4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Ss.TypePlaceholder,[]);let r=e[0].getType(),n=new Vu(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};sn.List=Lf;Lf.ClassName="List"});var Uf=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArrayVec=Mo.ArrayVecType=void 0;var YS=wr(),k4=Vm(),JS=It(),Ff=class t extends JS.Type{constructor(e,r){super("Array",[r]),YS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Mo.ArrayVecType=Ff;Ff.ClassName="ArrayVecType";var Mf=class t extends JS.TypedValue{constructor(e,r){super(e),YS.guardLength(r,e.length),this.backingCollection=new k4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Mo.ArrayVec=Mf;Mf.ClassName="ArrayVec"});var ku=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.H256Value=Uo.H256Type=void 0;var XS=It(),Gu=class t extends XS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Uo.H256Type=Gu;Gu.ClassName="H256Type";var qf=class t extends XS.PrimitiveValue{constructor(e){super(new Gu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Uo.H256Value=qf;qf.ClassName="H256Value"});var Hf=m(qo=>{"use strict";c();Object.defineProperty(qo,"__esModule",{value:!0});qo.NothingValue=qo.NothingType=void 0;var ZS=It(),ju=class t extends ZS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};qo.NothingType=ju;ju.ClassName="NothingType";var Vf=class t extends ZS.PrimitiveValue{constructor(){super(new ju)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};qo.NothingValue=Vf;Vf.ClassName="NothingValue"});var tc=m(Ie=>{"use strict";c();var j4=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q4=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W4=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j4(e,t,r);return Q4(e,t),e},$4=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.BigIntValue=Ie.BigUIntValue=Ie.I64Value=Ie.U64Value=Ie.I32Value=Ie.U32Value=Ie.I16Value=Ie.U16Value=Ie.I8Value=Ie.U8Value=Ie.NumericalValue=Ie.BigIntType=Ie.BigUIntType=Ie.I64Type=Ie.U64Type=Ie.I32Type=Ie.U32Type=Ie.I16Type=Ie.U16Type=Ie.I8Type=Ie.U8Type=Ie.NumericalType=void 0;var eT=W4(Be()),tT=It(),Ts=$4(Gt()),ur=class t extends tT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ie.NumericalType=ur;ur.ClassName="NumericalType";var Qu=class t extends ur{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ie.U8Type=Qu;Qu.ClassName="U8Type";var Wu=class t extends ur{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ie.I8Type=Wu;Wu.ClassName="I8Type";var $u=class t extends ur{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ie.U16Type=$u;$u.ClassName="U16Type";var zu=class t extends ur{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ie.I16Type=zu;zu.ClassName="I16Type";var Ku=class t extends ur{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ie.U32Type=Ku;Ku.ClassName="U32Type";var Yu=class t extends ur{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ie.I32Type=Yu;Yu.ClassName="I32Type";var Ju=class t extends ur{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ie.U64Type=Ju;Ju.ClassName="U64Type";var Xu=class t extends ur{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ie.I64Type=Xu;Xu.ClassName="I64Type";var Zu=class t extends ur{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ie.BigUIntType=Zu;Zu.ClassName="BigUIntType";var ec=class t extends ur{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ie.BigIntType=ec;ec.ClassName="BigIntType";var cr=class t extends tT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ts.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new eT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new eT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ie.NumericalValue=cr;cr.ClassName="NumericalValue";var Gf=class t extends cr{constructor(e){super(new Qu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U8Value=Gf;Gf.ClassName="U8Value";var kf=class t extends cr{constructor(e){super(new Wu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I8Value=kf;kf.ClassName="I8Value";var jf=class t extends cr{constructor(e){super(new $u,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U16Value=jf;jf.ClassName="U16Value";var Qf=class t extends cr{constructor(e){super(new zu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I16Value=Qf;Qf.ClassName="I16Value";var Wf=class t extends cr{constructor(e){super(new Ku,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U32Value=Wf;Wf.ClassName="U32Value";var $f=class t extends cr{constructor(e){super(new Yu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I32Value=$f;$f.ClassName="I32Value";var zf=class t extends cr{constructor(e){super(new Ju,e)}getClassName(){return t.ClassName}};Ie.U64Value=zf;zf.ClassName="U64Value";var Kf=class t extends cr{constructor(e){super(new Xu,e)}getClassName(){return t.ClassName}};Ie.I64Value=Kf;Kf.ClassName="I64Value";var Yf=class t extends cr{constructor(e){super(new Zu,e)}getClassName(){return t.ClassName}};Ie.BigUIntValue=Yf;Yf.ClassName="BigUIntValue";var Jf=class t extends cr{constructor(e){super(new ec,e)}getClassName(){return t.ClassName}};Ie.BigIntValue=Jf;Jf.ClassName="BigIntValue"});var Zf=m(Vo=>{"use strict";c();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.StringValue=Vo.StringType=void 0;var rT=It(),rc=class t extends rT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Vo.StringType=rc;rc.ClassName="StringType";var Xf=class t extends rT.PrimitiveValue{constructor(e){super(new rc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Vo.StringValue=Xf;Xf.ClassName="StringValue"});var Go=m(Ho=>{"use strict";c();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.TokenIdentifierValue=Ho.TokenIdentifierType=void 0;var nT=It(),z4="EGLD",nc=class t extends nT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Ho.TokenIdentifierType=nc;nc.ClassName="TokenIdentifierType";var eh=class t extends nT.PrimitiveValue{constructor(e){super(new nc),this.value=e}static egld(){return new t(z4)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};Ho.TokenIdentifierValue=eh;eh.ClassName="TokenIdentifierValue"});var rh=m(Tr=>{"use strict";c();var K4=Tr&&Tr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y4=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=Tr&&Tr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K4(e,t,r);return Y4(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Tuple=Tr.TupleType=void 0;var X4=J4(Be()),iT=So(),sT=Co(),ic=class t extends sT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new iT.FieldDefinition(oT(i),"anonymous tuple field",n))}};Tr.TupleType=ic;ic.ClassName="TupleType";function oT(t){return`field${t}`}var th=class t extends sT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new X4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new ic(...r),i=e.map((s,o)=>new iT.Field(s,oT(o)));return new t(n,i)}};Tr.Tuple=th;th.ClassName="Tuple"});var sh=m(wi=>{"use strict";c();Object.defineProperty(wi,"__esModule",{value:!0});wi.VariadicValue=wi.CountedVariadicType=wi.VariadicType=void 0;var ko=It(),Cs=class t extends ko.Type{constructor(e,r=!1){super("Variadic",[e],ko.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};wi.VariadicType=Cs;Cs.ClassName="VariadicType";var nh=class extends ko.Type{constructor(e){super("Variadic",[e],ko.TypeCardinality.variable())}getClassName(){return Cs.ClassName}};wi.CountedVariadicType=nh;nh.ClassName="VariadicType";var ih=class t extends ko.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Cs(new ko.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Cs(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var Z4=on&&on.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eq=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tq=on&&on.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z4(e,t,r);return eq(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.TypeMapper=void 0;var aT=tq(Be()),rq=Do(),Hm=Cf(),nq=Mu(),iq=mi(),sq=KS(),oh=Pf(),Gm=Du(),oq=So(),uT=Hu(),kn=Uf(),aq=ku(),cT=Hf(),Cr=tc(),uq=Zf(),lT=Co(),fT=Go(),Ei=rh(),ah=sh(),km=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new uT.OptionType(r[0])],["List",(...r)=>new uT.ListType(r[0])],["VarArgs",(...r)=>new ah.VariadicType(r[0])],["MultiResultVec",(...r)=>new ah.VariadicType(r[0])],["variadic",(...r)=>new ah.VariadicType(r[0])],["counted-variadic",(...r)=>new ah.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new Hm.OptionalType(r[0])],["optional",(...r)=>new Hm.OptionalType(r[0])],["OptionalResult",(...r)=>new Hm.OptionalType(r[0])],["multi",(...r)=>new oh.CompositeType(...r)],["MultiArg",(...r)=>new oh.CompositeType(...r)],["MultiResult",(...r)=>new oh.CompositeType(...r)],["multi",(...r)=>new oh.CompositeType(...r)],["tuple",(...r)=>new Ei.TupleType(...r)],["tuple2",(...r)=>new Ei.TupleType(...r)],["tuple3",(...r)=>new Ei.TupleType(...r)],["tuple4",(...r)=>new Ei.TupleType(...r)],["tuple5",(...r)=>new Ei.TupleType(...r)],["tuple6",(...r)=>new Ei.TupleType(...r)],["tuple7",(...r)=>new Ei.TupleType(...r)],["tuple8",(...r)=>new Ei.TupleType(...r)],["array2",(...r)=>new kn.ArrayVecType(2,r[0])],["array8",(...r)=>new kn.ArrayVecType(8,r[0])],["array16",(...r)=>new kn.ArrayVecType(16,r[0])],["array20",(...r)=>new kn.ArrayVecType(20,r[0])],["array32",(...r)=>new kn.ArrayVecType(32,r[0])],["array46",(...r)=>new kn.ArrayVecType(46,r[0])],["array64",(...r)=>new kn.ArrayVecType(64,r[0])],["array128",(...r)=>new kn.ArrayVecType(128,r[0])],["array256",(...r)=>new kn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Cr.U8Type],["u16",new Cr.U16Type],["u32",new Cr.U32Type],["u64",new Cr.U64Type],["U64",new Cr.U64Type],["BigUint",new Cr.BigUIntType],["i8",new Cr.I8Type],["i16",new Cr.I16Type],["i32",new Cr.I32Type],["i64",new Cr.I64Type],["Bigint",new Cr.BigIntType],["BigInt",new Cr.BigIntType],["bool",new nq.BooleanType],["bytes",new iq.BytesType],["Address",new rq.AddressType],["H256",new aq.H256Type],["utf-8 string",new uq.StringType],["TokenIdentifier",new fT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new fT.TokenIdentifierType],["CodeMetadata",new sq.CodeMetadataType],["nothing",new cT.NothingType],["AsyncCall",new cT.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new aT.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(Gm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(lT.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new lT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Gm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Gm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new oq.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new aT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};on.TypeMapper=km});var yT=m(an=>{"use strict";c();var cq=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lq=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fq=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cq(e,t,r);return lq(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.AbiRegistry=void 0;var hT=fq(Be()),Qm=wr(),sc=Tm(),dT=Du(),pT=Co(),hq=jm(),dq="?",Wm=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||dq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=sc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>sc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(pT.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push(dT.EnumType.fromJSON({name:d,variants:g.variants}));else throw new hT.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new t({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(pT.StructType.ClassName));return Qm.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(dT.EnumType.ClassName));return Qm.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Qm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new hq.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new hT.ErrTypingSystem("Did not re-map all custom types");let n=gT(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(gT(o,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};an.AbiRegistry=Wm;function gT(t,e){let r=t.input.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new sc.EndpointDefinition(t.name,r,n,t.modifiers)}});var wT=m(jo=>{"use strict";c();Object.defineProperty(jo,"__esModule",{value:!0});jo.createListOfTokenIdentifiers=jo.createListOfAddresses=void 0;var pq=Do(),mT=Hu(),gq=Go();function yq(t){let e=t.map(n=>new pq.AddressValue(n));return mT.List.fromItems(e)}jo.createListOfAddresses=yq;function mq(t){let e=t.map(n=>new gq.TokenIdentifierValue(n));return mT.List.fromItems(e)}jo.createListOfTokenIdentifiers=mq});var PT=m(zt=>{"use strict";c();var wq=zt&&zt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eq=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vq=zt&&zt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wq(e,t,r);return Eq(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var ch=vq(Be()),ET=Do(),vT=Mu(),AT=mi(),bT=Du(),uh=Hu(),_T=ku(),IT=tc(),ST=Hf(),TT=Co(),CT=Go(),xT=rh(),NT=It(),OT=Uf(),DT=Zf();function Aq(t,e){if(t.hasExactClass(uh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(uh.ListType.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(NT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(TT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(xT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=Aq;function bq(t,e){if(t.hasClassOrSuperclass(NT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(uh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(uh.List.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(TT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(xT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=bq;function _q(t,e){if(t.hasExactClass(vT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringValue.ClassName))return e.onString();if(t.hasExactClass(_T.H256Value.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(ST.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=_q;function Iq(t,e){if(t.hasExactClass(vT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringType.ClassName))return e.onString();if(t.hasExactClass(_T.H256Type.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(ST.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=Iq});var St=m(qe=>{"use strict";c();var Sq=qe&&qe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sq(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(yT(),qe);it(Do(),qe);it(Cf(),qe);it(Mu(),qe);it(mi(),qe);it(Pf(),qe);it(Tm(),qe);it(Du(),qe);it(wT(),qe);it(So(),qe);it(Hu(),qe);it(Uf(),qe);it(ku(),qe);it(PT(),qe);it(Hf(),qe);it(tc(),qe);it(Zf(),qe);it(Co(),qe);it(Go(),qe);it(rh(),qe);it(hf(),qe);it(jm(),qe);it(It(),qe);it(sh(),qe)});var BT=m(un=>{"use strict";c();var Tq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cq=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xq=un&&un.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tq(e,t,r);return Cq(e,t),e};Object.defineProperty(un,"__esModule",{value:!0});un.OptionValueBinaryCodec=void 0;var RT=xq(Be()),lh=St(),$m=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[lh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[lh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new lh.OptionValue(r);if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new lh.OptionValue(r,n)}encodeNested(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([])}};un.OptionValueBinaryCodec=$m});var LT=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.AddressBinaryCodec=void 0;var Nq=ht(),Oq=St(),zm=class{decodeNested(e){let r=e.slice(0,32),n=new Nq.Address(r);return[new Oq.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};fh.AddressBinaryCodec=zm});var MT=m(cn=>{"use strict";c();var Dq=cn&&cn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pq=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rq=cn&&cn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dq(e,t,r);return Pq(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.BooleanBinaryCodec=void 0;var Bq=Rq(Be()),FT=St(),oc=class t{decodeNested(e){let r=e.readUInt8(0);return[new FT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new Bq.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new FT.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([])}};cn.BooleanBinaryCodec=oc;oc.TRUE=1;oc.FALSE=0});var dh=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.SizeOfU32=void 0;hh.SizeOfU32=4});var ph=m(ln=>{"use strict";c();var Lq=ln&&ln.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ln,"__esModule",{value:!0});ln.zeroPadStringIfOddLength=ln.isPaddedHex=ln.numberToPaddedHex=void 0;var Fq=Lq(Gt());function Mq(t){let e=new Fq.default(t).toString(16);return UT(e)}ln.numberToPaddedHex=Mq;function Uq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}ln.isPaddedHex=Uq;function UT(t){return t=t||"",t.length%2==1?"0"+t:t}ln.zeroPadStringIfOddLength=UT});var ac=m(Tt=>{"use strict";c();var qq=Tt&&Tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.prependByteToBuffer=Tt.flipBufferBitsInPlace=Tt.getHexMagnitudeOfBigInt=Tt.bigIntToBuffer=Tt.bufferToBigInt=Tt.cloneBuffer=Tt.isMsbZero=Tt.isMsbOne=void 0;var Km=qq(Gt()),Vq=ph();function qT(t,e=0){return t[e]>>7==1}Tt.isMsbOne=qT;function Hq(t,e=0){return!qT(t,e)}Tt.isMsbZero=Hq;function Gq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Tt.cloneBuffer=Gq;function kq(t){let e=t.toString("hex");return new Km.default(`0x${e}`,16)}Tt.bufferToBigInt=kq;function jq(t){let e=VT(t);return h.Buffer.from(e,"hex")}Tt.bigIntToBuffer=jq;function VT(t){return t=new Km.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Km.default(-1))),Vq.numberToPaddedHex(t)):""}Tt.getHexMagnitudeOfBigInt=VT;function Qq(t){for(let e=0;e{"use strict";c();var $q=Qo&&Qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.NumericalBinaryCodec=void 0;var uc=$q(Gt()),Ym=St(),HT=dh(),wt=ac(),Jm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=HT.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=wt.cloneBuffer(e);if(e.length==0)return new Ym.NumericalValue(r,new uc.default(0));if(!r.withSign||wt.isMsbZero(n)){let l=wt.bufferToBigInt(n);return new Ym.NumericalValue(r,l)}wt.flipBufferBitsInPlace(n);let u=wt.bufferToBigInt(n).multipliedBy(new uc.default(-1)).minus(new uc.default(1));return new Ym.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(HT.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=wt.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=wt.bigIntToBuffer(e.value);wt.isMsbOne(o)&&(o=wt.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new uc.default(1)),i=wt.bigIntToBuffer(n);wt.flipBufferBitsInPlace(i),wt.isMsbZero(i)&&(i=wt.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):wt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=wt.bigIntToBuffer(e.value);return wt.isMsbOne(i)&&(i=wt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new uc.default(1)),n=wt.bigIntToBuffer(r);return wt.flipBufferBitsInPlace(n),wt.isMsbZero(n)&&(n=wt.prependByteToBuffer(n,255)),n}};Qo.NumericalBinaryCodec=Jm});var kT=m(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.H256BinaryCodec=void 0;var zq=ku(),Xm=class{decodeNested(e){let r=e.slice(0,32);return[new zq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};gh.H256BinaryCodec=Xm});var wh=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.BytesBinaryCodec=void 0;var jT=mi(),yh=dh(),Zm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(yh.SizeOfU32,yh.SizeOfU32+r);return[new jT.BytesValue(n),yh.SizeOfU32+r]}decodeTopLevel(e){return new jT.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(yh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};mh.BytesBinaryCodec=Zm});var WT=m(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.TokenIdentifierCodec=void 0;var Kq=mi(),QT=Go(),Yq=wh(),ew=class{constructor(){this.bytesCodec=new Yq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new QT.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new QT.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Kq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Eh.TokenIdentifierCodec=ew});var zT=m(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.NothingCodec=void 0;var $T=St(),tw=class{decodeNested(){return[new $T.NothingValue,0]}decodeTopLevel(){return new $T.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};vh.NothingCodec=tw});var YT=m(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.StringBinaryCodec=void 0;var KT=St(),Jq=mi(),Xq=wh(),rw=class{constructor(){this.bytesBinaryCodec=new Xq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new KT.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new KT.StringValue(e.toString())}encodeNested(e){let r=Jq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Ah.StringBinaryCodec=rw});var JT=m(_h=>{"use strict";c();Object.defineProperty(_h,"__esModule",{value:!0});_h.PrimitiveBinaryCodec=void 0;var bh=St(),Zq=LT(),eV=MT(),tV=GT(),rV=kT(),nV=wh(),iV=WT(),sV=zT(),oV=YT(),nw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new eV.BooleanBinaryCodec,this.numericalCodec=new tV.NumericalBinaryCodec,this.addressCodec=new Zq.AddressBinaryCodec,this.h256Codec=new rV.H256BinaryCodec,this.bytesCodec=new nV.BytesBinaryCodec,this.stringCodec=new oV.StringBinaryCodec,this.tokenIdentifierCodec=new iV.TokenIdentifierCodec,this.nothingCodec=new sV.NothingCodec}decodeNested(e,r){return bh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return bh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return bh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return bh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};_h.PrimitiveBinaryCodec=nw});var eC=m(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.ListBinaryCodec=void 0;var XT=St(),ZT=dh(),iw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=ZT.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new XT.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(ZT.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return h.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return h.Buffer.concat(r)}};Ih.ListBinaryCodec=iw});var ow=m(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.FieldsBinaryCodec=void 0;var aV=St(),sw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new aV.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return h.Buffer.concat(r)}};Sh.FieldsBinaryCodec=sw});var uw=m(Th=>{"use strict";c();Object.defineProperty(Th,"__esModule",{value:!0});Th.StructBinaryCodec=void 0;var uV=St(),cV=ow(),aw=class{constructor(e){this.fieldsCodec=new cV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new uV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Th.StructBinaryCodec=aw});var tC=m(xh=>{"use strict";c();Object.defineProperty(xh,"__esModule",{value:!0});xh.EnumBinaryCodec=void 0;var Ch=St(),lV=ow(),cw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new lV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Ch.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Ch.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Ch.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return h.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Ch.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};xh.EnumBinaryCodec=cw});var rC=m(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TupleBinaryCodec=void 0;var fV=uw(),lw=class{constructor(e){this.structCodec=new fV.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Nh.TupleBinaryCodec=lw});var nC=m(Oh=>{"use strict";c();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.ArrayVecBinaryCodec=void 0;var hV=St(),fw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var dV=xr&&xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pV=xr&&xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gV=xr&&xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dV(e,t,r);return pV(e,t),e};Object.defineProperty(xr,"__esModule",{value:!0});xr.BinaryCodecConstraints=xr.BinaryCodec=void 0;var iC=gV(Be()),Dh=St(),sC=wr(),yV=BT(),mV=JT(),wV=eC(),EV=uw(),vV=tC(),AV=rC(),bV=nC(),hw=class{constructor(e=null){this.constraints=e||new Ph,this.optionCodec=new yV.OptionValueBinaryCodec(this),this.listCodec=new wV.ListBinaryCodec(this),this.arrayCodec=new bV.ArrayVecBinaryCodec(this),this.primitiveCodec=new mV.PrimitiveBinaryCodec(this),this.structCodec=new EV.StructBinaryCodec(this),this.tupleCodec=new AV.TupleBinaryCodec(this),this.enumCodec=new vV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),Dh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=Dh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};xr.BinaryCodec=hw;var Ph=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new iC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new iC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};xr.BinaryCodecConstraints=Ph});var oC=m(Nr=>{"use strict";c();var _V=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.decodeBigNumber=Nr.decodeString=Nr.decodeBool=Nr.decodeUnsignedNumber=void 0;var IV=_V(Gt()),Rh=St(),SV=dw(),Bh=new SV.BinaryCodec;function TV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return Number(e.valueOf())}Nr.decodeUnsignedNumber=TV;function CV(t){return!!Bh.decodeTopLevel(t,new Rh.BooleanType).valueOf()}Nr.decodeBool=CV;function xV(t){let e=Bh.decodeTopLevel(t,new Rh.BytesType);return String(e.valueOf())}Nr.decodeString=xV;function NV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return new IV.default(e.valueOf())}Nr.decodeBigNumber=NV});var pw=m(vi=>{"use strict";c();var OV=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aC=vi&&vi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OV(e,t,r)};Object.defineProperty(vi,"__esModule",{value:!0});aC(dw(),vi);aC(oC(),vi)});var Wo=m(Lh=>{"use strict";c();Object.defineProperty(Lh,"__esModule",{value:!0});Lh.ArgSerializer=void 0;var uC=bs(),DV=pw(),cC=St(),gw=Cf(),yw=Pf(),mw=sh(),PV={codec:new DV.BinaryCodec},ww=class{constructor(e){e=Object.assign(Object.assign({},PV),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(uC.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(uC.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(gw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(mw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(yw.CompositeValue.ClassName)){let u=o;for(let l of u.getItems())i(l);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new cC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};Lh.ArgSerializer=ww});var Uh=m(Mh=>{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Compatibility=void 0;var RV=ht(),Fh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==RV.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};Mh.Compatibility=Fh;Fh.areWarningsEnabled=!0});var lC=m(fn=>{"use strict";c();var BV=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LV=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FV=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BV(e,t,r);return LV(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.Hash=void 0;var MV=FV(Be()),Ew=class t{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new MV.ErrBadType("hash","buffer | string",e)}static empty(){return new t(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};fn.Hash=Ew});var cc=m(Or=>{"use strict";c();var UV=Or&&Or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qV=Or&&Or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VV=Or&&Or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UV(e,t,r);return qV(e,t),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.TransactionOptions=Or.TransactionVersion=void 0;var jr=bs(),fC=VV(Be()),vw=class t{constructor(e){if(e=Number(e),e<1)throw new fC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(jr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(jr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Or.TransactionVersion=vw;var Aw=class t{constructor(e){if(e=Number(e),e<0)throw new fC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(jr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=jr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&jr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&jr.TRANSACTION_OPTIONS_TX_GUARDED)==jr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=jr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Or.TransactionOptions=Aw});var dC=m((Woe,hC)=>{"use strict";c();hC.exports=HV;function HV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var qh=yC;qh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var $o=new Array(64),gC=new Array(123);for(Qr=0;Qr<64;)gC[$o[Qr]=Qr<26?Qr+65:Qr<52?Qr+71:Qr<62?Qr-4:Qr-59|43]=Qr++;var Qr;qh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=$o[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=$o[u|l>>6],s[o++]=$o[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=$o[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var pC="invalid encoding";qh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=gC[u])===void 0)throw Error(pC);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(pC);return n-i};qh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var EC=m((Yoe,wC)=>{"use strict";c();wC.exports=Vh;function Vh(){this._listeners={}}Vh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Vh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();SC.exports=vC(vC);function vC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,AC),t.writeFloatBE=e.bind(null,bC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,_C),t.readFloatBE=r.bind(null,IC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,AC,0,4),t.writeDoubleBE=e.bind(null,bC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,g=4294967296*(l&1048575)+u;return d===2047?g?NaN:f*(1/0):d===0?f*5e-324*g:f*Math.pow(2,d-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,_C,0,4),t.readDoubleBE=r.bind(null,IC,4,0)}(),t}function AC(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function bC(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function _C(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function IC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var CC=m((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var NC=m(xC=>{"use strict";c();var bw=xC;bw.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};bw.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var DC=m((nae,OC)=>{"use strict";c();OC.exports=GV;function GV(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var RC=m((sae,PC)=>{"use strict";c();PC.exports=Bt;var lc=bi();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var xs=Bt.zero=new Bt(0,0);xs.toNumber=function(){return 0};xs.zzEncode=xs.zzDecode=function(){return this};xs.length=function(){return 1};var kV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return xs;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Bt(n,i)};Bt.from=function(e){if(typeof e=="number")return Bt.fromNumber(e);if(lc.isString(e))if(lc.Long)e=lc.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):xs};Bt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Bt.prototype.toLong=function(e){return lc.Long?new lc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ai=String.prototype.charCodeAt;Bt.fromHash=function(e){return e===kV?xs:new Bt((Ai.call(e,0)|Ai.call(e,1)<<8|Ai.call(e,2)<<16|Ai.call(e,3)<<24)>>>0,(Ai.call(e,4)|Ai.call(e,5)<<8|Ai.call(e,6)<<16|Ai.call(e,7)<<24)>>>0)};Bt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Bt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Bt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Bt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var bi=m(_w=>{"use strict";c();var Ee=_w;Ee.asPromise=dC();Ee.base64=mC();Ee.EventEmitter=EC();Ee.float=TC();Ee.inquire=CC();Ee.utf8=NC();Ee.pool=DC();Ee.LongBits=RC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||_w;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function BC(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();qC.exports=Fe;var Dr=bi(),Iw,Hh=Dr.LongBits,FC=Dr.base64,MC=Dr.utf8;function fc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Tw(){}function jV(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Fe(){this.len=0,this.head=new fc(Tw,0,0),this.tail=this.head,this.states=null}var UC=function(){return Dr.Buffer?function(){return(Fe.create=function(){return new Iw})()}:function(){return new Fe}};Fe.create=UC();Fe.alloc=function(e){return new Dr.Array(e)};Dr.Array!==Array&&(Fe.alloc=Dr.pool(Fe.alloc,Dr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new fc(e,r,n),this.len+=r,this};function Cw(t,e,r){e[r]=t&255}function QV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function xw(t,e){this.len=t,this.next=void 0,this.val=e}xw.prototype=Object.create(fc.prototype);xw.prototype.fn=QV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new xw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Fe.prototype.int32=function(e){return e<0?this._push(Nw,10,Hh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Nw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Fe.prototype.uint64=function(e){var r=Hh.from(e);return this._push(Nw,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Hh.from(e).zzEncode();return this._push(Nw,r.length(),r)};Fe.prototype.bool=function(e){return this._push(Cw,1,e?1:0)};function Sw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Fe.prototype.fixed32=function(e){return this._push(Sw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Hh.from(e);return this._push(Sw,4,r.lo)._push(Sw,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(Dr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(Dr.float.writeDoubleLE,8,e)};var WV=Dr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Cw,1,0);if(Dr.isString(e)){var n=Fe.alloc(r=FC.length(e));FC.decode(e,n,0),e=n}return this.uint32(r)._push(WV,r,e)};Fe.prototype.string=function(e){var r=MC.length(e);return r?this.uint32(r)._push(MC.write,r,e):this._push(Cw,1,0)};Fe.prototype.fork=function(){return this.states=new jV(this),this.head=this.tail=new fc(Tw,0,0),this.len=0,this};Fe.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new fc(Tw,0,0),this.len=0),this};Fe.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Fe.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Fe._configure=function(t){Iw=t,Fe.create=UC(),Iw._configure()}});var GC=m((fae,HC)=>{"use strict";c();HC.exports=hn;var VC=Ow();(hn.prototype=Object.create(VC.prototype)).constructor=hn;var _i=bi();function hn(){VC.call(this)}hn._configure=function(){hn.alloc=_i._Buffer_allocUnsafe,hn.writeBytesBuffer=_i.Buffer&&_i.Buffer.prototype instanceof Uint8Array&&_i.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(hn.writeBytesBuffer,r,e),this};function $V(t,e,r){t.length<40?_i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}hn.prototype.string=function(e){var r=_i.Buffer.byteLength(e);return this.uint32(r),r&&this._push($V,r,e),this};hn._configure()});var Rw=m((dae,$C)=>{"use strict";c();$C.exports=Et;var dn=bi(),Pw,QC=dn.LongBits,zV=dn.utf8;function Wr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Et(t){this.buf=t,this.pos=0,this.len=t.length}var kC=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Et(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Et(e);throw Error("illegal buffer")},WC=function(){return dn.Buffer?function(r){return(Et.create=function(i){return dn.Buffer.isBuffer(i)?new Pw(i):kC(i)})(r)}:kC};Et.create=WC();Et.prototype._slice=dn.Array.prototype.subarray||dn.Array.prototype.slice;Et.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Wr(this,10);return e}}();Et.prototype.int32=function(){return this.uint32()|0};Et.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Dw(){var t=new QC(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Wr(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Wr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Et.prototype.bool=function(){return this.uint32()!==0};function Gh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Et.prototype.fixed32=function(){if(this.pos+4>this.len)throw Wr(this,4);return Gh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Wr(this,4);return Gh(this.buf,this.pos+=4)|0};function jC(){if(this.pos+8>this.len)throw Wr(this,8);return new QC(Gh(this.buf,this.pos+=4),Gh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw Wr(this,4);var e=dn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw Wr(this,4);var e=dn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Et.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Wr(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};Et.prototype.string=function(){var e=this.bytes();return zV.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Wr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Wr(this);while(this.buf[this.pos++]&128);return this};Et.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Et._configure=function(t){Pw=t,Et.create=WC(),Pw._configure();var e=dn.Long?"toLong":"toNumber";dn.merge(Et.prototype,{int64:function(){return Dw.call(this)[e](!1)},uint64:function(){return Dw.call(this)[e](!0)},sint64:function(){return Dw.call(this).zzDecode()[e](!1)},fixed64:function(){return jC.call(this)[e](!0)},sfixed64:function(){return jC.call(this)[e](!1)}})}});var JC=m((gae,YC)=>{"use strict";c();YC.exports=Ns;var KC=Rw();(Ns.prototype=Object.create(KC.prototype)).constructor=Ns;var zC=bi();function Ns(t){KC.call(this,t)}Ns._configure=function(){zC.Buffer&&(Ns.prototype._slice=zC.Buffer.prototype.slice)};Ns.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Ns._configure()});var ZC=m((mae,XC)=>{"use strict";c();XC.exports=hc;var Bw=bi();(hc.prototype=Object.create(Bw.EventEmitter.prototype)).constructor=hc;function hc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Bw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}hc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Bw.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};hc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tx=m(ex=>{"use strict";c();var KV=ex;KV.Service=ZC()});var nx=m((Aae,rx)=>{"use strict";c();rx.exports={}});var ox=m(sx=>{"use strict";c();var lr=sx;lr.build="minimal";lr.Writer=Ow();lr.BufferWriter=GC();lr.Reader=Rw();lr.BufferReader=JC();lr.util=bi();lr.rpc=tx();lr.roots=nx();lr.configure=ix;function ix(){lr.util._configure(),lr.Writer._configure(lr.BufferWriter),lr.Reader._configure(lr.BufferReader)}ix()});var ux=m((Sae,ax)=>{"use strict";c();ax.exports=ox()});var lx=m((Cae,cx)=>{"use strict";c();var zo=ux(),kh=zo.Reader,YV=zo.Writer,X=zo.util,dc=zo.roots.default||(zo.roots.default={});dc.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof kh||(n=new kh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!X.isInteger(n.Nonce)&&!(n.Nonce&&X.isInteger(n.Nonce.low)&&X.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||X.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||X.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||X.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||X.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||X.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!X.isInteger(n.GasPrice)&&!(n.GasPrice&&X.isInteger(n.GasPrice.low)&&X.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!X.isInteger(n.GasLimit)&&!(n.GasLimit&&X.isInteger(n.GasLimit.low)&&X.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||X.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||X.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!X.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||X.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!X.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||X.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||X.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof dc.proto.Transaction)return n;var i=new dc.proto.Transaction;return n.Nonce!=null&&(X.Long?(i.Nonce=X.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?X.base64.decode(n.Value,i.Value=X.newBuffer(X.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?X.base64.decode(n.RcvAddr,i.RcvAddr=X.newBuffer(X.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?X.base64.decode(n.RcvUserName,i.RcvUserName=X.newBuffer(X.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?X.base64.decode(n.SndAddr,i.SndAddr=X.newBuffer(X.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?X.base64.decode(n.SndUserName,i.SndUserName=X.newBuffer(X.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(X.Long?(i.GasPrice=X.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(X.Long?(i.GasLimit=X.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?X.base64.decode(n.Data,i.Data=X.newBuffer(X.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?X.base64.decode(n.ChainID,i.ChainID=X.newBuffer(X.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?X.base64.decode(n.Signature,i.Signature=X.newBuffer(X.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?X.base64.decode(n.GuardAddr,i.GuardAddr=X.newBuffer(X.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?X.base64.decode(n.GuardSignature,i.GuardSignature=X.newBuffer(X.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(X.Long){var o=new X.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=X.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=X.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=X.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=X.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=X.newBuffer(s.SndUserName))),X.Long){var o=new X.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(X.Long){var o=new X.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=X.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=X.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=X.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=X.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=X.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?X.Long.prototype.toString.call(n.Nonce):i.longs===Number?new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?X.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?X.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?X.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?X.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?X.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?X.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?X.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?X.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?X.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?X.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?X.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?X.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,zo.util.toJSONOptions)},e}(),t}();cx.exports=dc});var fx=m(Pr=>{"use strict";c();var JV=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XV=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JV(e,t,r);return XV(e,t),e},eH=Pr&&Pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ProtoSerializer=void 0;var tH=eH(Gt()),Lw=ht(),rH=bs(),nH=ZV(Be()),iH=ac(),Fw=class{serializeTransaction(e){let r=lx().proto,n=new Lw.Address(e.getReceiver().bech32()).pubkey(),i=new Lw.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:e.getReceiverUsername()?h.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?h.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==rH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Lw.Address(u.bech32()).pubkey(),s.GuardSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return h.Buffer.from(o)}serializeTransactionValue(e){let r=new tH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=iH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new nH.ErrUnsupportedOperation("deserializeTransaction")}};Pr.ProtoSerializer=Fw});var hx=m(Os=>{"use strict";c();var sH=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oH=Os&&Os.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sH(e,t,r)};Object.defineProperty(Os,"__esModule",{value:!0});oH(fx(),Os)});var jh=m(pn=>{"use strict";c();var aH=pn&&pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uH=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cH=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aH(e,t,r);return uH(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.Signature=void 0;var dx=cH(Be()),px=64,Mw=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof h.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==px}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=px)throw new dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};pn.Signature=Mw});var jn=m(Qh=>{"use strict";c();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.TransactionPayload=void 0;var Uw=class t{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=h.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>h.Buffer.from(e,"hex"))}length(){return h.Buffer.from(this.data).length}};Qh.TransactionPayload=Uw});var qw=m((Mae,gx)=>{c();Qn.notEqual=fH;Qn.notOk=hH;Qn.equal=lH;Qn.ok=Qn;gx.exports=Qn;function lH(t,e,r){Qn(t==e,r)}function fH(t,e,r){Qn(t!=e,r)}function hH(t,e){Qn(!t,e)}function Qn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ps=m(Xo=>{"use strict";c();var Vw=C0(),Yo=N0(),yx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xo.Buffer=$;Xo.SlowBuffer=wH;Xo.INSPECT_MAX_BYTES=50;var Wh=2147483647;Xo.kMaxLength=Wh;$.TYPED_ARRAY_SUPPORT=dH();!$.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function dH(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function Wn(t){if(t>Wh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return jw(t)}return vx(t,e,r)}$.poolSize=8192;function vx(t,e,r){if(typeof t=="string")return gH(t,e);if(ArrayBuffer.isView(t))return yH(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(gn(t,ArrayBuffer)||t&&gn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(gn(t,SharedArrayBuffer)||t&&gn(t.buffer,SharedArrayBuffer)))return Gw(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return $.from(n,e,r);let i=mH(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}$.from=function(t,e,r){return vx(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function Ax(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function pH(t,e,r){return Ax(t),t<=0?Wn(t):e!==void 0?typeof r=="string"?Wn(t).fill(e,r):Wn(t).fill(e):Wn(t)}$.alloc=function(t,e,r){return pH(t,e,r)};function jw(t){return Ax(t),Wn(t<0?0:Qw(t)|0)}$.allocUnsafe=function(t){return jw(t)};$.allocUnsafeSlow=function(t){return jw(t)};function gH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=bx(t,e)|0,n=Wn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Hw(t){let e=t.length<0?0:Qw(t.length)|0,r=Wn(e);for(let n=0;n=Wh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wh.toString(16)+" bytes");return t|0}function wH(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(gn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),gn(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?($.isBuffer(o)||(o=$.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function bx(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||gn(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return kw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Dx(t).length;default:if(i)return n?-1:kw(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=bx;function EH(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return NH(this,e,r);case"utf8":case"utf-8":return Ix(this,e,r);case"ascii":return CH(this,e,r);case"latin1":case"binary":return xH(this,e,r);case"base64":return SH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Ds(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};yx&&($.prototype[yx]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(gn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,$w(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:mx(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):mx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function mx(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return vH(this,e,r,n);case"utf8":case"utf-8":return AH(this,e,r,n);case"ascii":case"latin1":case"binary":return bH(this,e,r,n);case"base64":return _H(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IH(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function SH(t,e,r){return e===0&&r===t.length?Vw.fromByteArray(t):Vw.fromByteArray(t.slice(e,r))}function Ix(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return TH(n)}var wx=4096;function TH(t){let e=t.length;if(e<=wx)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readBigUInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readBigInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Lt(e,4,this.length),Yo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),Yo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!1,52,8)};function fr(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;fr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;fr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Sx(t,e,r,n,i){Ox(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function Tx(t,e,r,n,i){Ox(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}$.prototype.writeBigUInt64LE=Ii(function(e,r=0){return Sx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Ii(function(e,r=0){return Tx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};$.prototype.writeBigInt64LE=Ii(function(e,r=0){return Sx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Ii(function(e,r=0){return Tx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cx(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function xx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,4,34028234663852886e22,-34028234663852886e22),Yo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return xx(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return xx(this,e,r,!1,n)};function Nx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,8,17976931348623157e292,-17976931348623157e292),Yo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return Nx(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return Nx(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=Ex(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ex(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ex(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function DH(t,e,r){Jo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&pc(e,t.length-(r+1))}function Ox(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Ko.ERR_OUT_OF_RANGE("value",a,t)}DH(n,i,s)}function Jo(t,e){if(typeof t!="number")throw new Ko.ERR_INVALID_ARG_TYPE(e,"number",t)}function pc(t,e,r){throw Math.floor(t)!==t?(Jo(t,r),new Ko.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ko.ERR_BUFFER_OUT_OF_BOUNDS:new Ko.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var PH=/[^+/0-9A-Za-z-_]/g;function RH(t){if(t=t.split("=")[0],t=t.trim().replace(PH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function kw(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function BH(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Dx(t){return Vw.toByteArray(RH(t))}function $h(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function gn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function $w(t){return t!==t}var FH=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ii(t){return typeof BigInt>"u"?MH:t}function MH(){throw new Error("BigInt not supported")}});var Rx=m((Gae,Px)=>{c();Px.exports=zw;zw.supported=typeof WebAssembly<"u";function zw(t){if(!zw.supported)return null;var e=t&&t.imports,r=UH("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function UH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(qH)):new(Ps()).Buffer(t,"base64")}function qH(t){return t.charCodeAt(0)}});var Vx=m((Wae,mn)=>{c();var yn=qw(),Ke=Rx()(),$n=64,zh=[];mn.exports=Rr;var Bx=mn.exports.BYTES_MIN=16,Lx=mn.exports.BYTES_MAX=64,jae=mn.exports.BYTES=32,Fx=mn.exports.KEYBYTES_MIN=16,Mx=mn.exports.KEYBYTES_MAX=64,Qae=mn.exports.KEYBYTES=32,Ux=mn.exports.SALTBYTES=16,qx=mn.exports.PERSONALBYTES=16;function Rr(t,e,r,n,i){if(!(this instanceof Rr))return new Rr(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(yn(t>=Bx,"digestLength must be at least "+Bx+", was given "+t),yn(t<=Lx,"digestLength must be at most "+Lx+", was given "+t),e!=null&&yn(e.length>=Fx,"key must be at least "+Fx+", was given "+e.length),e!=null&&yn(e.length<=Mx,"key must be at least "+Mx+", was given "+e.length),r!=null&&yn(r.length===Ux,"salt must be exactly "+Ux+", was given "+r.length),n!=null&&yn(n.length===qx,"personal must be exactly "+qx+", was given "+n.length)),zh.length||(zh.push($n),$n+=216),this.digestLength=t,this.finalized=!1,this.pointer=zh.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,$n,$n+e.length),Ke.memory[this.pointer+200]=128)}Rr.prototype.update=function(t){return yn(this.finalized===!1,"Hash instance finalized"),yn(t,"input must be TypedArray or Buffer"),$n+t.length>Ke.memory.length&&Ke.realloc($n+t.length),Ke.memory.set(t,$n),Ke.exports.blake2b_update(this.pointer,$n,$n+t.length),this};Rr.prototype.digest=function(t){if(yn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,zh.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return HH(Ke.memory,this.pointer+128,this.digestLength);yn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ci=qw(),yc=Vx();function Kh(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function Hx(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function zx(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Si(t,e,r,n,i,s){var o=gc[i],a=gc[i+1],u=gc[s],l=gc[s+1];Kh(Ce,t,e),Hx(Ce,t,o,a);var f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1];Ce[n]=d,Ce[n+1]=f,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^d<<8,Ce[e+1]=d>>>24^f<<8,Kh(Ce,t,e),Hx(Ce,t,u,l),f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^d<<16,Ce[n+1]=d>>>16^f<<16,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=d>>>31^f<<1,Ce[e+1]=f>>>31^d<<1}var Kx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),kH=[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],Kt=new Uint8Array(kH.map(function(t){return t*2})),Ce=new Uint32Array(32),gc=new Uint32Array(32);function Yx(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=Kx[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)gc[r]=zx(t.b,4*r);for(r=0;r<12;r++)Si(0,8,16,24,Kt[r*16+0],Kt[r*16+1]),Si(2,10,18,26,Kt[r*16+2],Kt[r*16+3]),Si(4,12,20,28,Kt[r*16+4],Kt[r*16+5]),Si(6,14,22,30,Kt[r*16+6],Kt[r*16+7]),Si(0,10,20,30,Kt[r*16+8],Kt[r*16+9]),Si(2,12,22,24,Kt[r*16+10],Kt[r*16+11]),Si(4,14,16,26,Kt[r*16+12],Kt[r*16+13]),Si(6,8,18,28,Kt[r*16+14],Kt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ce[r]^Ce[r+16]}var Ti=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Zo(t,e,r,n){Ti.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ti[0]=t,e&&(Ti[1]=e.length),Ti[2]=1,Ti[3]=1,r&&Ti.set(r,32),n&&Ti.set(n,48);for(var i=0;i<16;i++)this.h[i]=Kx[i]^zx(Ti,i*4);e&&(Jx(this,e),this.c=128)}Zo.prototype.update=function(t){return Ci(t!=null,"input must be Uint8Array or Buffer"),Jx(this,t),this};Zo.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ci(e.length>=this.outlen,"out must have at least outlen bytes of space"),jH(this,e),t==="hex"?QH(e):e};Zo.prototype.final=Zo.prototype.digest;Zo.ready=function(t){yc.ready(function(){t()})};function Jx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function QH(t){for(var e="",r=0;r=Gx,"outlen must be at least "+Gx+", was given "+e),Ci(e<=kx,"outlen must be at most "+kx+", was given "+e),r!=null&&Ci(r.length>=jx,"key must be at least "+jx+", was given "+r.length),r!=null&&Ci(r.length<=Qx,"key must be at most "+Qx+", was given "+r.length),n!=null&&Ci(n.length===Wx,"salt must be exactly "+Wx+", was given "+n.length),i!=null&&Ci(i.length===$x,"personal must be exactly "+$x+", was given "+i.length)),new Xx(e,r,n,i)};hr.exports.ready=function(t){yc.ready(function(){t()})};hr.exports.WASM_SUPPORTED=yc.SUPPORTED;hr.exports.WASM_LOADED=!1;var Gx=hr.exports.BYTES_MIN=16,kx=hr.exports.BYTES_MAX=64,zae=hr.exports.BYTES=32,jx=hr.exports.KEYBYTES_MIN=16,Qx=hr.exports.KEYBYTES_MAX=64,Kae=hr.exports.KEYBYTES=32,Wx=hr.exports.SALTBYTES=16,$x=hr.exports.PERSONALBYTES=16;yc.ready(function(t){t||(hr.exports.WASM_LOADED=!0,Xx=yc)})});var wn=m(Br=>{"use strict";c();var $H=Br&&Br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KH=Br&&Br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$H(e,t,r);return zH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionHash=Br.Transaction=void 0;var ea=Gt(),mc=ht(),YH=Uh(),JH=bs(),XH=KH(Be()),ZH=lC(),zn=cc(),eG=hx(),eN=jh(),tN=jn(),tG=wr(),rG=Zx(),nG=32,Kw=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:l,chainID:f,version:d,options:g,guardian:w}){this.nonce=e||0,this.value=r?new ea.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||JH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new tN.TransactionPayload,this.chainID=f,this.version=d?new zn.TransactionVersion(d.valueOf()):zn.TransactionVersion.withDefaultVersion(),this.options=g?new zn.TransactionOptions(g.valueOf()):zn.TransactionOptions.withDefaultOptions(),this.guardian=w||mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=ta.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new zn.TransactionVersion(e.valueOf())}getOptions(){return new zn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new zn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return tG.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),senderUsername:this.senderUsername?h.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?h.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return YH.Compatibility.guardAddressIsSetAndNonZero(new mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new ea.BigNumber(e.value).toFixed(0),receiver:mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new tN.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new zn.TransactionVersion(e.version),options:e.options!=null?new zn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new eN.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new eN.Signature(e.guardianSignature)),r}applySignature(e){this.signature=this.interpretSignatureAsBuffer(e),this.hash=ta.compute(this)}interpretSignatureAsBuffer(e){if(ArrayBuffer.isView(e))return h.Buffer.from(e);if(e.hex!=null)return h.Buffer.from(e.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${e}`)}applyGuardianSignature(e){this.guardianSignature=this.interpretSignatureAsBuffer(e),this.hash=ta.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new XH.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new ea.BigNumber(this.gasPrice.valueOf()),i=new ea.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new ea.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new ea.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Br.Transaction=Kw;var ta=class t extends ZH.Hash{constructor(e){super(e)}static compute(e){let n=new eG.ProtoSerializer().serializeTransaction(e),i=rG(nG).update(n).digest("hex");return new t(i)}};Br.TransactionHash=ta});var Zw=m(Jh=>{"use strict";c();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.TransferTransactionsFactory=void 0;var Yw=Wo(),$r=St(),Yh=wn(),Jw=jn(),Xw=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new Yh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Yh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.U64Value(e.tokenTransfer.nonce),new $r.BigUIntValue(e.tokenTransfer.valueOf()),new $r.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Yh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new $r.AddressValue(e.destination),new $r.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push($r.BytesValue.fromUTF8(u.tokenIdentifier),new $r.U64Value(u.nonce),new $r.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Yw.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Jw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Yh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Jh.TransferTransactionsFactory=Xw});var tE=m(Rs=>{"use strict";c();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.GasEstimator=Rs.DefaultGasConfiguration=void 0;Rs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var iG=1e5,rN=8e5,eE=class{constructor(e){this.gasConfiguration=e||Rs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+iG}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+rN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+rN)*r+this.gasConfiguration.gasPerDataByte*e}};Rs.GasEstimator=eE});var ra=m(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Account=void 0;var sG=ht(),rE=class{constructor(e){this.address=new sG.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};Xh.Account=rE});var na=m(Ls=>{"use strict";c();Object.defineProperty(Ls,"__esModule",{value:!0});Ls.Logger=Ls.LogLevel=void 0;var Bs;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(Bs=Ls.LogLevel||(Ls.LogLevel={}));var Zh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Bs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Bs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Bs.Error||console.error(e,r)}};Ls.Logger=Zh;Zh.logLevel=Bs.Debug});var sE=m(En=>{"use strict";c();var oG=En&&En.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aG=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uG=En&&En.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oG(e,t,r);return aG(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.AsyncTimer=void 0;var cG=uG(Be()),lG=Be(),nE=na(),iE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new cG.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new lG.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};En.AsyncTimer=iE});var ed=m(ia=>{"use strict";c();var Lr=ia&&ia.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ia,"__esModule",{value:!0});ia.TransactionWatcher=void 0;var oE=sE(),xi=Be(),nN=na(),Ni=class t{constructor(e,r={}){this.fetcher=new aE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Lr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Lr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new xi.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Lr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Lr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Lr(this,void 0,void 0,function*(){let n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Lr(this,void 0,void 0,function*(){let i=new oE.AsyncTimer("watcher:periodic"),s=new oE.AsyncTimer("watcher:patience"),o=new oE.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(nN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof xi.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof xi.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};ia.TransactionWatcher=Ni;Ni.DefaultPollingInterval=6e3;Ni.DefaultTimeout=Ni.DefaultPollingInterval*15;Ni.DefaultPatience=0;Ni.NoopOnStatusReceived=t=>{};var aE=class{constructor(e){this.fetcher=e}getTransaction(e){return Lr(this,void 0,void 0,function*(){return nN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var cE=m(nd=>{"use strict";c();Object.defineProperty(nd,"__esModule",{value:!0});nd.CodeMetadata=void 0;var uE=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=td.Upgradeable),this.readable&&(e|=td.Readable),this.payable&&(r|=rd.Payable),this.payableBySc&&(r|=rd.PayableBySc),h.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};nd.CodeMetadata=uE;var td;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(td||(td={}));var rd;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(rd||(rd={}))});var wc=m(vn=>{"use strict";c();var fG=vn&&vn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hG=vn&&vn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dG=vn&&vn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fG(e,t,r);return hG(e,t),e};Object.defineProperty(vn,"__esModule",{value:!0});vn.ContractFunction=void 0;var pG=dG(Be()),lE=class t{constructor(e){if(this.name=e,e==null)throw new pG.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};vn.ContractFunction=lE});var dE=m(Fr=>{"use strict";c();var gG=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yG=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mG=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gG(e,t,r);return yG(e,t),e},wG=Fr&&Fr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.InteractionChecker=void 0;var fE=mG(Be()),EG=wG(Gt()),hE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new EG.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new fE.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new fE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(id,"__esModule",{value:!0});id.Query=void 0;var vG=ht(),AG=Wo(),pE=class{constructor(e){this.caller=e.caller||new vG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new AG.ArgSerializer().valuesToStrings(this.args)}};id.Query=pE});var wE=m(sd=>{"use strict";c();Object.defineProperty(sd,"__esModule",{value:!0});sd.Interaction=void 0;var iN=ht(),bG=Uh(),gE=bs(),yE=wc(),_G=dE(),IG=Ec(),sa=St(),mE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new iN.Address,this.sender=new iN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new oa([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){bG.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new yE.ContractFunction(gE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new yE.ContractFunction(gE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new yE.ContractFunction(gE.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new IG.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new oa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new oa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new oa(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new _G.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};sd.Interaction=mE;var oa=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new sa.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return sa.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new sa.U64Value(e.nonce)}getTypedTokenQuantity(e){return new sa.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new sa.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return sa.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var sN=m(od=>{"use strict";c();Object.defineProperty(od,"__esModule",{value:!0});od.ArgumentErrorContext=void 0;var SG=Be(),EE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new SG.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) -Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};od.ArgumentErrorContext=EE});var AE=m(Fs=>{"use strict";c();var TG=Fs&&Fs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.NativeSerializer=void 0;var CG=TG(Gt()),xG=ht(),vE=Be(),NG=ph(),OG=sN(),ve=St(),DG;(function(t){function e(A,I){A=A||[],r(A,I),n(I)&&(A=i(A,I));let N=I.input,_=[];for(let S=0;S0&&I[0].type.getCardinality().isComposite()&&(_=1/0,S=!0);for(let R of I){if(R.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:S}}function o(A,I,N){if(A&&A.belongsToTypesystem)return A;if(I instanceof ve.OptionType)return a(A,I,N);if(I instanceof ve.OptionalType)return u(A,I,N);if(I instanceof ve.VariadicType)return l(A,I,N);if(I instanceof ve.CompositeType)return d(A,I,N);if(I instanceof ve.TupleType)return g(A,I,N);if(I instanceof ve.StructType)return w(A,I,N);if(I instanceof ve.ListType)return f(A,I,N);if(I instanceof ve.PrimitiveType)return E(A,I,N);if(I instanceof ve.EnumType)return T(A,I,N);N.throwError(`convertToTypedValue: unhandled type ${I}`)}function a(A,I,N){if(A==null)return ve.OptionValue.newMissing();let _=o(A,I.getFirstTypeParameter(),N);return ve.OptionValue.newProvided(_)}function u(A,I,N){if(A==null)return new ve.OptionalValue(I);let _=o(A,I.getFirstTypeParameter(),N);return new ve.OptionalValue(I,_)}function l(A,I,N){if(I.isCounted)throw new vE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');A==null&&(A=[]),A.map===void 0&&N.convertError(A,"Variadic");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.VariadicValue(I,_)}function f(A,I,N){A.map===void 0&&N.convertError(A,"List");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.List(I,_)}function d(A,I,N){let _=[],S=I.getTypeParameters();N.guardSameLength(A,S);for(let R=0;R{"use strict";c();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var SE=jn(),TE=wr(),PG=Wo();zr.ArwenVirtualMachine="0500";var bE=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${zr.ArwenVirtualMachine}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractDeployPayloadBuilder=bE;var _E=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractUpgradePayloadBuilder=_E;var IE=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){TE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=CE(e,this.arguments),new SE.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=IE;function CE(t,e){let{argumentsString:r,count:n}=new PG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Kn=m((xue,NE)=>{"use strict";c();var aa=typeof Reflect=="object"?Reflect:null,oN=aa&&typeof aa.apply=="function"?aa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ad;aa&&typeof aa.ownKeys=="function"?ad=aa.ownKeys:Object.getOwnPropertySymbols?ad=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ad=function(e){return Object.getOwnPropertyNames(e)};function RG(t){console&&console.warn&&console.warn(t)}var uN=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}NE.exports=ke;NE.exports.once=MG;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var aN=10;function ud(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return aN},set:function(t){if(typeof t!="number"||t<0||uN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");aN=t}});ke.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||uN(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};function cN(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return cN(this)};ke.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")oN(u,this,r);else for(var l=u.length,f=pN(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,RG(a)}return t}ke.prototype.addListener=function(e,r){return lN(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return lN(this,e,r,!0)};function BG(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=BG.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return ud(r),this.on(e,fN(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,fN(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():LG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ke.prototype.off=ke.prototype.removeListener;ke.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function hN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?FG(i):pN(i,i.length)}ke.prototype.listeners=function(e){return hN(this,e,!0)};ke.prototype.rawListeners=function(e){return hN(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dN.call(t,e)};ke.prototype.listenerCount=dN;function dN(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ke.prototype.eventNames=function(){return this._eventsCount>0?ad(this._events):[]};function pN(t,e){for(var r=new Array(e),n=0;n{c();yN.exports=Kn().EventEmitter});var DE=m(()=>{c()});var bN=m((Lue,AN)=>{"use strict";c();function mN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return cd.alloc(0);for(var n=cd.allocUnsafe(r>>>0),i=this.head,s=0;i;)WG(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=cd.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:QG,value:function(r,n){return PE(this,wN(wN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var BE=m((Mue,IN)=>{"use strict";c();function $G(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(RE,this,t)):p.default.nextTick(RE,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(ld,r):(r._writableState.errorEmitted=!0,p.default.nextTick(_N,r,s)):p.default.nextTick(_N,r,s):e?(p.default.nextTick(ld,r),e(s)):p.default.nextTick(ld,r)}),this)}function _N(t,e){RE(t,e),ld(t)}function ld(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function zG(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function RE(t,e){t.emit("error",e)}function KG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}IN.exports={destroy:$G,undestroy:zG,errorOrDestroy:KG}});var Ms=m((que,CN)=>{"use strict";c();function YG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var TN={};function Mr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){YG(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,TN[t]=i}function SN(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function JG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function XG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function ZG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Mr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Mr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&JG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(XG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(SN(e,"type"));else{var s=ZG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(SN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Mr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Mr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Mr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Mr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Mr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Mr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Mr("ERR_STREAM_WRITE_AFTER_END","write after end");Mr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Mr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Mr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CN.exports.codes=TN});var LE=m((Hue,xN)=>{"use strict";c();var ek=Ms().codes.ERR_INVALID_OPT_VALUE;function tk(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function rk(t,e,r,n){var i=tk(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new ek(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}xN.exports={getHighWaterMark:rk}});var ua=m((kue,FE)=>{c();typeof Object.create=="function"?FE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:FE.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var ON=m((Que,NN)=>{c();NN.exports=nk;function nk(t,e){if(ME("noDeprecation"))return t;var r=!1;function n(){if(!r){if(ME("throwDeprecation"))throw new Error(e);ME("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function ME(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var VE=m(($ue,FN)=>{"use strict";c();FN.exports=dt;function PN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Ok(e,t)}}var ca;dt.WritableState=Ac;var ik={deprecate:ON()},RN=OE(),hd=Ps().Buffer,sk=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ok(t){return hd.from(t)}function ak(t){return hd.isBuffer(t)||t instanceof sk}var qE=BE(),uk=LE(),ck=uk.getHighWaterMark,Oi=Ms().codes,lk=Oi.ERR_INVALID_ARG_TYPE,fk=Oi.ERR_METHOD_NOT_IMPLEMENTED,hk=Oi.ERR_MULTIPLE_CALLBACK,dk=Oi.ERR_STREAM_CANNOT_PIPE,pk=Oi.ERR_STREAM_DESTROYED,gk=Oi.ERR_STREAM_NULL_VALUES,yk=Oi.ERR_STREAM_WRITE_AFTER_END,mk=Oi.ERR_UNKNOWN_ENCODING,la=qE.errorOrDestroy;ua()(dt,RN);function wk(){}function Ac(t,e,r){ca=ca||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof ca),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=ck(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){Sk(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new PN(this)}Ac.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Ac.prototype,"buffer",{get:ik.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var fd;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(fd=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return fd.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof Ac}})):fd=function(e){return e instanceof this};function dt(t){ca=ca||Us();var e=this instanceof ca;if(!e&&!fd.call(dt,this))return new dt(t);this._writableState=new Ac(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),RN.call(this)}dt.prototype.pipe=function(){la(this,new dk)};function Ek(t,e){var r=new yk;la(t,r),p.default.nextTick(e,r)}function vk(t,e,r,n){var i;return r===null?i=new gk:typeof r!="string"&&!e.objectMode&&(i=new lk("chunk",["string","Buffer"],r)),i?(la(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&ak(t);return s&&!hd.isBuffer(t)&&(t=ok(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=wk),n.ending?Ek(this,r):(s||vk(this,n,t,r))&&(n.pendingcb++,i=bk(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&BN(this,t))};dt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new mk(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ak(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=hd.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function bk(t,e,r,n,i,s){if(!r){var o=Ak(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var Dk=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};UN.exports=An;var MN=kE(),GE=VE();ua()(An,MN);for(HE=Dk(GE.prototype),dd=0;dd{c();var gd=Ps(),bn=gd.Buffer;function qN(t,e){for(var r in t)e[r]=t[r]}bn.from&&bn.alloc&&bn.allocUnsafe&&bn.allocUnsafeSlow?VN.exports=gd:(qN(gd,jE),jE.Buffer=qs);function qs(t,e,r){return bn(t,e,r)}qs.prototype=Object.create(bn.prototype);qN(bn,qs);qs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bn(t,e,r)};qs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=bn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};qs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bn(t)};qs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gd.SlowBuffer(t)}});var $E=m(kN=>{"use strict";c();var WE=HN().Buffer,GN=WE.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Bk(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Lk(t){var e=Bk(t);if(typeof e!="string"&&(WE.isEncoding===GN||!GN(t)))throw new Error("Unknown encoding: "+t);return e||t}kN.StringDecoder=bc;function bc(t){this.encoding=Lk(t);var e;switch(this.encoding){case"utf16le":this.text=Hk,this.end=Gk,e=4;break;case"utf8":this.fillLast=Uk,e=4;break;case"base64":this.text=kk,this.end=jk,e=3;break;default:this.write=Qk,this.end=Wk;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=WE.allocUnsafe(e)}bc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Fk(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Mk(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Uk(t){var e=this.lastTotal-this.lastNeed,r=Mk(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function qk(t,e){var r=Fk(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Vk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Hk(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Gk(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function kk(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function jk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Qk(t){return t.toString(this.encoding)}function Wk(t){return t&&t.length?this.write(t):""}});var yd=m((ece,WN)=>{"use strict";c();var jN=Ms().codes.ERR_STREAM_PREMATURE_CLOSE;function $k(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var md;function Di(t,e,r){return e=Yk(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yk(t){var e=Jk(t,"string");return typeof e=="symbol"?e:String(e)}function Jk(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xk=yd(),Pi=Symbol("lastResolve"),Vs=Symbol("lastReject"),_c=Symbol("error"),wd=Symbol("ended"),Hs=Symbol("lastPromise"),zE=Symbol("handlePromise"),Gs=Symbol("stream");function Ri(t,e){return{value:t,done:e}}function Zk(t){var e=t[Pi];if(e!==null){var r=t[Gs].read();r!==null&&(t[Hs]=null,t[Pi]=null,t[Vs]=null,e(Ri(r,!1)))}}function ej(t){p.default.nextTick(Zk,t)}function tj(t,e){return function(r,n){t.then(function(){if(e[wd]){r(Ri(void 0,!0));return}e[zE](r,n)},n)}}var rj=Object.getPrototypeOf(function(){}),nj=Object.setPrototypeOf((md={get stream(){return this[Gs]},next:function(){var e=this,r=this[_c];if(r!==null)return Promise.reject(r);if(this[wd])return Promise.resolve(Ri(void 0,!0));if(this[Gs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[_c]?a(e[_c]):o(Ri(void 0,!0))})});var n=this[Hs],i;if(n)i=new Promise(tj(n,this));else{var s=this[Gs].read();if(s!==null)return Promise.resolve(Ri(s,!1));i=new Promise(this[zE])}return this[Hs]=i,i}},Di(md,Symbol.asyncIterator,function(){return this}),Di(md,"return",function(){var e=this;return new Promise(function(r,n){e[Gs].destroy(null,function(i){if(i){n(i);return}r(Ri(void 0,!0))})})}),md),rj),ij=function(e){var r,n=Object.create(nj,(r={},Di(r,Gs,{value:e,writable:!0}),Di(r,Pi,{value:null,writable:!0}),Di(r,Vs,{value:null,writable:!0}),Di(r,_c,{value:null,writable:!0}),Di(r,wd,{value:e._readableState.endEmitted,writable:!0}),Di(r,zE,{value:function(s,o){var a=n[Gs].read();a?(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(Ri(a,!1))):(n[Pi]=s,n[Vs]=o)},writable:!0}),r));return n[Hs]=null,Xk(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Vs];s!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(i)),n[_c]=i;return}var o=n[Pi];o!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,o(Ri(void 0,!0))),n[wd]=!0}),e.on("readable",ej.bind(null,n)),n};$N.exports=ij});var YN=m((ice,KN)=>{c();KN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var kE=m((ace,oO)=>{"use strict";c();oO.exports=Me;var fa;Me.ReadableState=eO;var oce=Kn().EventEmitter,ZN=function(e,r){return e.listeners(r).length},Sc=OE(),Ed=Ps().Buffer,sj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oj(t){return Ed.from(t)}function aj(t){return Ed.isBuffer(t)||t instanceof sj}var KE=DE(),xe;KE&&KE.debuglog?xe=KE.debuglog("stream"):xe=function(){};var uj=bN(),rv=BE(),cj=LE(),lj=cj.getHighWaterMark,vd=Ms().codes,fj=vd.ERR_INVALID_ARG_TYPE,hj=vd.ERR_STREAM_PUSH_AFTER_EOF,dj=vd.ERR_METHOD_NOT_IMPLEMENTED,pj=vd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ha,YE,JE;ua()(Me,Sc);var Ic=rv.errorOrDestroy,XE=["error","close","destroy","pause","resume"];function gj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function eO(t,e,r){fa=fa||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof fa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=lj(this,t,"readableHighWaterMark",r),this.buffer=new uj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(ha||(ha=$E().StringDecoder),this.decoder=new ha(t.encoding),this.encoding=t.encoding)}function Me(t){if(fa=fa||Us(),!(this instanceof Me))return new Me(t);var e=this instanceof fa;this._readableState=new eO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Sc.call(this)}Object.defineProperty(Me.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Me.prototype.destroy=rv.destroy;Me.prototype._undestroy=rv.undestroy;Me.prototype._destroy=function(t,e){e(t)};Me.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Ed.from(t,e),e=""),n=!0),tO(this,t,e,!1,n)};Me.prototype.unshift=function(t){return tO(this,t,null,!0,!1)};function tO(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,wj(t,s);else{var o;if(i||(o=yj(s,e)),o)Ic(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Ed.prototype&&(e=oj(e)),n)s.endEmitted?Ic(t,new pj):ZE(t,s,e,!0);else if(s.ended)Ic(t,new hj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?ZE(t,s,e,!1):tv(t,s)):ZE(t,s,e,!1)}else n||(s.reading=!1,tv(t,s))}return!s.ended&&(s.length=JN?t=JN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function XN(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=mj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Me.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ev(this):Ad(this),null;if(t=XN(t,e),t===0&&e.ended)return e.length===0&&ev(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=iO(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&ev(this)),i!==null&&this.emit("data",i),i};function wj(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Ad(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,rO(t)))}}function Ad(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(rO,t))}function rO(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,nv(t)}function tv(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Ej,t,e))}function Ej(t,e){for(;!e.reading&&!e.ended&&(e.length1&&sO(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(D){xe("onerror",D),T(),t.removeListener("error",g),ZN(t,"error")===0&&Ic(t,D)}gj(t,"error",g);function w(){t.removeListener("finish",E),T()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),T()}t.once("finish",E);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function vj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&ZN(t,"data")&&(r.flowing=!0,nv(t))}}Me.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?Ad(this):n.reading||p.default.nextTick(Aj,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Sc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(nO,this),r};Me.prototype.removeAllListeners=function(t){var e=Sc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(nO,this),e};function nO(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function Aj(t){xe("readable nexttick read 0"),t.read(0)}Me.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,bj(this,t)),t.paused=!1,this};function bj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(_j,t,e))}function _j(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),nv(t),e.flowing&&!e.reading&&t.read(0)}Me.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function nv(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Me.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function ev(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Ij,e,t))}function Ij(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Me.from=function(t,e){return JE===void 0&&(JE=YN()),JE(Me,t,e)});function sO(t,e){for(var r=0,n=t.length;r{"use strict";c();uO.exports=Yn;var bd=Ms().codes,Sj=bd.ERR_METHOD_NOT_IMPLEMENTED,Tj=bd.ERR_MULTIPLE_CALLBACK,Cj=bd.ERR_TRANSFORM_ALREADY_TRANSFORMING,xj=bd.ERR_TRANSFORM_WITH_LENGTH_0,_d=Us();ua()(Yn,_d);function Nj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Tj);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();lO.exports=Tc;var cO=iv();ua()(Tc,cO);function Tc(t){if(!(this instanceof Tc))return new Tc(t);cO.call(this,t)}Tc.prototype._transform=function(t,e,r){r(null,t)}});var yO=m((dce,gO)=>{"use strict";c();var sv;function Dj(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var pO=Ms().codes,Pj=pO.ERR_MISSING_ARGS,Rj=pO.ERR_STREAM_DESTROYED;function hO(t){if(t)throw t}function Bj(t){return t.setHeader&&typeof t.abort=="function"}function Lj(t,e,r,n){n=Dj(n);var i=!1;t.on("close",function(){i=!0}),sv===void 0&&(sv=yd()),sv(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,Bj(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new Rj("pipe"))}}}function dO(t){t()}function Fj(t,e){return t.pipe(e)}function Mj(t){return!t.length||typeof t[t.length-1]!="function"?hO:t.pop()}function Uj(){for(var t=arguments.length,e=new Array(t),r=0;r0;return Lj(o,u,l,function(f){i||(i=f),f&&s.forEach(dO),!u&&(s.forEach(dO),n(i))})});return e.reduce(Fj)}gO.exports=Uj});var ov=m((Ur,mO)=>{c();Ur=mO.exports=kE();Ur.Stream=Ur;Ur.Readable=Ur;Ur.Writable=VE();Ur.Duplex=Us();Ur.Transform=iv();Ur.PassThrough=fO();Ur.finished=yd();Ur.pipeline=yO()});var vO=m((yce,EO)=>{c();var{Transform:qj}=ov();EO.exports=t=>class wO extends qj{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new wO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _O=m((wce,bO)=>{c();var{Transform:Vj}=ov();bO.exports=t=>class AO extends Vj{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new AO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var SO=m((vce,IO)=>{c();var Hj=vO(),Gj=_O();IO.exports=function(t){let e=Hj(t),r=Gj(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var xO=m(CO=>{c();var TO=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];CO.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],g=f^(i<<1|s>>>31),w=d^(s<<1|i>>>31),E=t[0]^g,T=t[1]^w,D=t[10]^g,B=t[11]^w,W=t[20]^g,U=t[21]^w,A=t[30]^g,I=t[31]^w,N=t[40]^g,_=t[41]^w;g=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let S=t[2]^g,R=t[3]^w,J=t[12]^g,Q=t[13]^w,V=t[22]^g,k=t[23]^w,K=t[32]^g,pe=t[33]^w,ue=t[42]^g,re=t[43]^w;g=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^w,te=t[14]^g,ie=t[15]^w,M=t[24]^g,le=t[25]^w,ae=t[34]^g,fe=t[35]^w,oe=t[44]^g,ce=t[45]^w;g=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let y=t[6]^g,v=t[7]^w,b=t[16]^g,P=t[17]^w,C=t[26]^g,O=t[27]^w,L=t[36]^g,x=t[37]^w,F=t[46]^g,H=t[47]^w;g=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let q=t[8]^g,Z=t[9]^w,we=t[18]^g,Ae=t[19]^w,Re=t[28]^g,tt=t[29]^w,lt=t[38]^g,Oe=t[39]^w,Ue=t[48]^g,Ot=t[49]^w,hi=E,ms=T,ws=B<<4|D>>>28,sr=D<<4|B>>>28,Un=W<<3|U>>>29,$t=U<<3|W>>>29,Dt=I<<9|A>>>23,$e=A<<9|I>>>23,Uy=N<<18|_>>>14,qy=_<<18|N>>>14,Vy=S<<1|R>>>31,Hy=R<<1|S>>>31,Gy=Q<<12|J>>>20,ky=J<<12|Q>>>20,jy=V<<10|k>>>22,Qy=k<<10|V>>>22,Wy=pe<<13|K>>>19,$y=K<<13|pe>>>19,zy=ue<<2|re>>>30,Ky=re<<2|ue>>>30,Yy=se<<30|Y>>>2,Jy=Y<<30|se>>>2,Xy=te<<6|ie>>>26,Zy=ie<<6|te>>>26,e0=le<<11|M>>>21,t0=M<<11|le>>>21,r0=ae<<15|fe>>>17,n0=fe<<15|ae>>>17,i0=ce<<29|oe>>>3,s0=oe<<29|ce>>>3,o0=y<<28|v>>>4,a0=v<<28|y>>>4,u0=P<<23|b>>>9,c0=b<<23|P>>>9,l0=C<<25|O>>>7,f0=O<<25|C>>>7,h0=L<<21|x>>>11,d0=x<<21|L>>>11,p0=H<<24|F>>>8,g0=F<<24|H>>>8,y0=q<<27|Z>>>5,m0=Z<<27|q>>>5,w0=we<<20|Ae>>>12,E0=Ae<<20|we>>>12,v0=tt<<7|Re>>>25,A0=Re<<7|tt>>>25,b0=lt<<8|Oe>>>24,_0=Oe<<8|lt>>>24,I0=Ue<<14|Ot>>>18,S0=Ot<<14|Ue>>>18;t[0]=hi^~Gy&e0,t[1]=ms^~ky&t0,t[10]=o0^~w0&Un,t[11]=a0^~E0&$t,t[20]=Vy^~Xy&l0,t[21]=Hy^~Zy&f0,t[30]=y0^~ws&jy,t[31]=m0^~sr&Qy,t[40]=Yy^~u0&v0,t[41]=Jy^~c0&A0,t[2]=Gy^~e0&h0,t[3]=ky^~t0&d0,t[12]=w0^~Un&Wy,t[13]=E0^~$t&$y,t[22]=Xy^~l0&b0,t[23]=Zy^~f0&_0,t[32]=ws^~jy&r0,t[33]=sr^~Qy&n0,t[42]=u0^~v0&Dt,t[43]=c0^~A0&$e,t[4]=e0^~h0&I0,t[5]=t0^~d0&S0,t[14]=Un^~Wy&i0,t[15]=$t^~$y&s0,t[24]=l0^~b0&Uy,t[25]=f0^~_0&qy,t[34]=jy^~r0&p0,t[35]=Qy^~n0&g0,t[44]=v0^~Dt&zy,t[45]=A0^~$e&Ky,t[6]=h0^~I0&hi,t[7]=d0^~S0&ms,t[16]=Wy^~i0&o0,t[17]=$y^~s0&a0,t[26]=b0^~Uy&Vy,t[27]=_0^~qy&Hy,t[36]=r0^~p0&y0,t[37]=n0^~g0&m0,t[46]=Dt^~zy&Yy,t[47]=$e^~Ky&Jy,t[8]=I0^~hi&Gy,t[9]=S0^~ms&ky,t[18]=i0^~o0&w0,t[19]=s0^~a0&E0,t[28]=Uy^~Vy&Xy,t[29]=qy^~Hy&Zy,t[38]=p0^~y0&ws,t[39]=g0^~m0&sr,t[48]=zy^~Yy&u0,t[49]=Ky^~Jy&c0,t[0]^=TO[e*2],t[1]^=TO[e*2+1]}}});var OO=m((Ice,NO)=>{c();var Id=xO();function da(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}da.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};da.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Id.p1600(this.state),this.count=0);return e};da.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};NO.exports=da});var av=m((Tce,DO)=>{c();DO.exports=SO()(OO())});var fv=m(pa=>{"use strict";c();var kj=pa&&pa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pa,"__esModule",{value:!0});pa.SmartContract=void 0;var jj=kj(Gt()),Cc=ht(),uv=Uh(),Qj=Be(),cv=wn(),Wj=wr(),$j=ac(),PO=cE(),RO=wc(),BO=wE(),zj=AE(),Kj=Ec(),Sd=xE(),Yj=av(),lv=class{constructor(e={}){this.address=new Cc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Cc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new RO.ContractFunction(i);return new BO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new RO.ContractFunction(i),a=zj.NativeSerializer.nativeToTypedValues(s||[],n);return new BO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return Wj.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.Transaction({receiver:Cc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){uv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new Sd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new cv.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new Kj.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new Qj.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Cc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new jj.default(r.valueOf().toString(10)),u=$j.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=Yj("keccak256").update(l).digest(),d=h.Buffer.from(Sd.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Cc.Address(g)}};pa.SmartContract=lv});var LO=m(Bi=>{"use strict";c();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.ErrAccountNotConnected=Bi.ErrCannotSignSingleTransaction=Bi.Err=void 0;var xc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Bi.Err=xc;var hv=class extends xc{constructor(){super("Cannot sign single transaction.")}};Bi.ErrCannotSignSingleTransaction=hv;var dv=class extends xc{constructor(){super("Account is not connected.")}};Bi.ErrAccountNotConnected=dv});var FO=m(Nc=>{"use strict";c();Object.defineProperty(Nc,"__esModule",{value:!0});Nc.Operation=void 0;var Jj;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(Jj=Nc.Operation||(Nc.Operation={}))});var pv=m(ga=>{"use strict";c();var Li=ga&&ga.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ga,"__esModule",{value:!0});ga.ExtensionProvider=void 0;var Xj=wn(),MO=LO(),Oc=FO(),Dc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Li(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Oc.Operation.Connect,n),this.account.address})}logout(){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Oc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Li(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new MO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new MO.ErrAccountNotConnected}signTransactions(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Oc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>Xj.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Oc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Oc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};ga.ExtensionProvider=Dc;Dc._instance=new Dc});var Er={};ft(Er,{__assign:()=>yv,__asyncDelegator:()=>fQ,__asyncGenerator:()=>lQ,__asyncValues:()=>hQ,__await:()=>Pc,__awaiter:()=>iQ,__classPrivateFieldGet:()=>yQ,__classPrivateFieldSet:()=>mQ,__createBinding:()=>oQ,__decorate:()=>tQ,__exportStar:()=>aQ,__extends:()=>Zj,__generator:()=>sQ,__importDefault:()=>gQ,__importStar:()=>pQ,__makeTemplateObject:()=>dQ,__metadata:()=>nQ,__param:()=>rQ,__read:()=>GO,__rest:()=>eQ,__spread:()=>uQ,__spreadArrays:()=>cQ,__values:()=>mv});function Zj(t,e){gv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function eQ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function rQ(t,e){return function(r,n){e(r,n,t)}}function nQ(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function iQ(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function sQ(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function GO(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function uQ(){for(var t=[],e=0;e1||a(g,w)})})}function a(g,w){try{u(n[g](w))}catch(E){d(s[0][3],E)}}function u(g){g.value instanceof Pc?Promise.resolve(g.value.v).then(l,f):d(s[0][2],g)}function l(g){a("next",g)}function f(g){a("throw",g)}function d(g,w){g(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function fQ(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Pc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function hQ(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof mv=="function"?mv(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function dQ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function pQ(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function gQ(t){return t&&t.__esModule?t:{default:t}}function yQ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function mQ(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var gv,yv,vr=ge(()=>{c();gv=function(t,e){return gv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},gv(t,e)};yv=function(){return yv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});function wQ(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}Nd.safeJsonParse=wQ;function EQ(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Nd.safeJsonStringify=EQ});var kO=m(($ce,Od)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?Od.exports=global.localStorage:typeof window<"u"&&window.localStorage?Od.exports=window.localStorage:Od.exports=new e})()});var jO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IKeyValueStorage=void 0;var Ev=class{};Dd.IKeyValueStorage=Ev});var QO=m(Pd=>{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.parseEntry=void 0;var vQ=wv();function AQ(t){var e;return[t[0],vQ.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Pd.parseEntry=AQ});var $O=m(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});var WO=(vr(),ct(Er));WO.__exportStar(jO(),Rd);WO.__exportStar(QO(),Rd)});var KO=m(Rc=>{"use strict";c();Object.defineProperty(Rc,"__esModule",{value:!0});Rc.KeyValueStorage=void 0;var ya=(vr(),ct(Er)),zO=wv(),bQ=ya.__importDefault(kO()),_Q=$O(),Bd=class{constructor(){this.localStorage=bQ.default}getKeys(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_Q.parseEntry)})}getItem(e){return ya.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return zO.safeJsonParse(r)})}setItem(e,r){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,zO.safeJsonStringify(r))})}removeItem(e){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Rc.KeyValueStorage=Bd;Rc.default=Bd});var YO=m(Ld=>{"use strict";c();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.delay=void 0;function IQ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ld.delay=IQ});var JO=m(ma=>{"use strict";c();Object.defineProperty(ma,"__esModule",{value:!0});ma.ONE_THOUSAND=ma.ONE_HUNDRED=void 0;ma.ONE_HUNDRED=100;ma.ONE_THOUSAND=1e3});var XO=m(de=>{"use strict";c();Object.defineProperty(de,"__esModule",{value:!0});de.ONE_YEAR=de.FOUR_WEEKS=de.THREE_WEEKS=de.TWO_WEEKS=de.ONE_WEEK=de.THIRTY_DAYS=de.SEVEN_DAYS=de.FIVE_DAYS=de.THREE_DAYS=de.ONE_DAY=de.TWENTY_FOUR_HOURS=de.TWELVE_HOURS=de.SIX_HOURS=de.THREE_HOURS=de.ONE_HOUR=de.SIXTY_MINUTES=de.THIRTY_MINUTES=de.TEN_MINUTES=de.FIVE_MINUTES=de.ONE_MINUTE=de.SIXTY_SECONDS=de.THIRTY_SECONDS=de.TEN_SECONDS=de.FIVE_SECONDS=de.ONE_SECOND=void 0;de.ONE_SECOND=1;de.FIVE_SECONDS=5;de.TEN_SECONDS=10;de.THIRTY_SECONDS=30;de.SIXTY_SECONDS=60;de.ONE_MINUTE=de.SIXTY_SECONDS;de.FIVE_MINUTES=de.ONE_MINUTE*5;de.TEN_MINUTES=de.ONE_MINUTE*10;de.THIRTY_MINUTES=de.ONE_MINUTE*30;de.SIXTY_MINUTES=de.ONE_MINUTE*60;de.ONE_HOUR=de.SIXTY_MINUTES;de.THREE_HOURS=de.ONE_HOUR*3;de.SIX_HOURS=de.ONE_HOUR*6;de.TWELVE_HOURS=de.ONE_HOUR*12;de.TWENTY_FOUR_HOURS=de.ONE_HOUR*24;de.ONE_DAY=de.TWENTY_FOUR_HOURS;de.THREE_DAYS=de.ONE_DAY*3;de.FIVE_DAYS=de.ONE_DAY*5;de.SEVEN_DAYS=de.ONE_DAY*7;de.THIRTY_DAYS=de.ONE_DAY*30;de.ONE_WEEK=de.SEVEN_DAYS;de.TWO_WEEKS=de.ONE_WEEK*2;de.THREE_WEEKS=de.ONE_WEEK*3;de.FOUR_WEEKS=de.ONE_WEEK*4;de.ONE_YEAR=de.ONE_DAY*365});var vv=m(Fd=>{"use strict";c();Object.defineProperty(Fd,"__esModule",{value:!0});var ZO=(vr(),ct(Er));ZO.__exportStar(JO(),Fd);ZO.__exportStar(XO(),Fd)});var t2=m(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.fromMiliseconds=wa.toMiliseconds=void 0;var e2=vv();function SQ(t){return t*e2.ONE_THOUSAND}wa.toMiliseconds=SQ;function TQ(t){return Math.floor(t/e2.ONE_THOUSAND)}wa.fromMiliseconds=TQ});var n2=m(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});var r2=(vr(),ct(Er));r2.__exportStar(YO(),Md);r2.__exportStar(t2(),Md)});var i2=m(Bc=>{"use strict";c();Object.defineProperty(Bc,"__esModule",{value:!0});Bc.Watch=void 0;var Ud=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};Bc.Watch=Ud;Bc.default=Ud});var s2=m(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});qd.IWatch=void 0;var Av=class{};qd.IWatch=Av});var o2=m(bv=>{"use strict";c();Object.defineProperty(bv,"__esModule",{value:!0});var CQ=(vr(),ct(Er));CQ.__exportStar(s2(),bv)});var ks=m(Ea=>{"use strict";c();Object.defineProperty(Ea,"__esModule",{value:!0});var Vd=(vr(),ct(Er));Vd.__exportStar(n2(),Ea);Vd.__exportStar(i2(),Ea);Vd.__exportStar(o2(),Ea);Vd.__exportStar(vv(),Ea)});var _v,a2=ge(()=>{c();_v=class{}});var Iv={};ft(Iv,{IEvents:()=>_v});var Sv=ge(()=>{c();a2()});var u2=m(Hd=>{"use strict";c();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.IHeartBeat=void 0;var xQ=(Sv(),ct(Iv)),Tv=class extends xQ.IEvents{constructor(e){super()}};Hd.IHeartBeat=Tv});var xv=m(Cv=>{"use strict";c();Object.defineProperty(Cv,"__esModule",{value:!0});var NQ=(vr(),ct(Er));NQ.__exportStar(u2(),Cv)});var c2=m(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.HEARTBEAT_EVENTS=va.HEARTBEAT_INTERVAL=void 0;var OQ=ks();va.HEARTBEAT_INTERVAL=OQ.FIVE_SECONDS;va.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Ov=m(Nv=>{"use strict";c();Object.defineProperty(Nv,"__esModule",{value:!0});var DQ=(vr(),ct(Er));DQ.__exportStar(c2(),Nv)});var l2=m(Gd=>{"use strict";c();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.HeartBeat=void 0;var Dv=(vr(),ct(Er)),PQ=Kn(),RQ=ks(),BQ=xv(),Pv=Ov(),Rv=class t extends BQ.IHeartBeat{constructor(e){super(e),this.events=new PQ.EventEmitter,this.interval=Pv.HEARTBEAT_INTERVAL,this.interval=e?.interval||Pv.HEARTBEAT_INTERVAL}static init(e){return Dv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return Dv.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return Dv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),RQ.toMiliseconds(this.interval))})}pulse(){this.events.emit(Pv.HEARTBEAT_EVENTS.pulse)}};Gd.HeartBeat=Rv});var f2=m(Lc=>{"use strict";c();Object.defineProperty(Lc,"__esModule",{value:!0});var Bv=(vr(),ct(Er));Bv.__exportStar(l2(),Lc);Bv.__exportStar(xv(),Lc);Bv.__exportStar(Ov(),Lc)});var d2=m((qle,h2)=>{"use strict";c();function LQ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}h2.exports=FQ;function FQ(t,e,r){var n=r&&r.stringify||LQ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var p2=d2();m2.exports=_n;var Fc=WQ().console||{},MQ={mapHttpRequest:kd,mapHttpResponse:kd,wrapRequestSerializer:Lv,wrapResponseSerializer:Lv,wrapErrorSerializer:Lv,req:kd,res:kd,err:GQ};function UQ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function _n(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||Fc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=UQ(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=Mc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:kQ(t)};u.levels=_n.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Mc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=Fv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,Aa(l,u,"error","log"),Aa(l,u,"fatal","error"),Aa(l,u,"warn","error"),Aa(l,u,"info","log"),Aa(l,u,"debug","log"),Aa(l,u,"trace","log")}function w(E,T){if(!E)throw new Error("missing bindings for child Pino");T=T||{},i&&E.serializers&&(T.serializers=E.serializers);let D=T.serializers;if(i&&D){var B=Object.assign({},n,D),W=t.browser.serialize===!0?Object.keys(B):i;delete E.serializers,jd([E],W,B,this._stdErrSerialize)}function U(A){this._childLevel=(A._childLevel|0)+1,this.error=ba(A,E,"error"),this.fatal=ba(A,E,"fatal"),this.warn=ba(A,E,"warn"),this.info=ba(A,E,"info"),this.debug=ba(A,E,"debug"),this.trace=ba(A,E,"trace"),B&&(this.serializers=B,this._serialize=W),e&&(this._logEvent=Fv([].concat(A._logEvent.bindings,E)))}return U.prototype=this,new U(this)}return u}_n.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};_n.stdSerializers=MQ;_n.stdTimeFunctions=Object.assign({},{nullTime:g2,epochTime:y2,unixTime:jQ,isoTime:QQ});function Aa(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Mc:i[r]?i[r]:Fc[r]||Fc[n]||Mc,qQ(t,e,r)}function qQ(t,e,r){!t.transmit&&e[r]===Mc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Fc?Fc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ba(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.PINO_CUSTOM_CONTEXT_KEY=_a.PINO_LOGGER_DEFAULTS=void 0;_a.PINO_LOGGER_DEFAULTS={level:"info"};_a.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var _2=m(dr=>{"use strict";c();Object.defineProperty(dr,"__esModule",{value:!0});dr.generateChildLogger=dr.formatChildLoggerContext=dr.getLoggerContext=dr.setBrowserLoggerContext=dr.getBrowserLoggerContext=dr.getDefaultLoggerOptions=void 0;var Ia=Mv();function $Q(t){return Object.assign(Object.assign({},t),{level:t?.level||Ia.PINO_LOGGER_DEFAULTS.level})}dr.getDefaultLoggerOptions=$Q;function E2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}dr.getBrowserLoggerContext=E2;function v2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}dr.setBrowserLoggerContext=v2;function A2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=E2(t,e):r=t.bindings().context||"",r}dr.getLoggerContext=A2;function b2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=A2(t,r);return n.trim()?`${n}/${e}`:e}dr.formatChildLoggerContext=b2;function zQ(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=b2(t,e,r),i=t.child({context:n});return v2(i,n,r)}dr.generateChildLogger=zQ});var qv=m(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.pino=void 0;var Uv=(vr(),ct(Er)),KQ=Uv.__importDefault(w2());Object.defineProperty(Sa,"pino",{enumerable:!0,get:function(){return KQ.default}});Uv.__exportStar(Mv(),Sa);Uv.__exportStar(_2(),Sa)});var n1=m(Pt=>{"use strict";c();Object.defineProperty(Pt,"__esModule",{value:!0});var Ta=(Sv(),ct(Iv)),I2=Kn();function YQ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var JQ=YQ(I2),Vv=class extends Ta.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Hv=class{constructor(e,r,n){this.core=e,this.logger=r}},Gv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},kv=class{constructor(e,r){this.logger=e,this.core=r}},jv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Qv=class extends Ta.IEvents{constructor(e){super()}},Wv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},$v=class{constructor(){this.map=new Map}},zv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Kv=class{constructor(e,r){this.core=e,this.logger=r}},Yv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Jv=class{constructor(e,r){this.logger=e,this.core=r}},Xv=class{constructor(e,r){this.projectId=e,this.logger=r}},Zv=class extends JQ.default{constructor(){super()}},e1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},t1=class extends I2.EventEmitter{constructor(){super()}},r1=class{constructor(e){this.client=e}};Pt.ICore=Vv,Pt.ICrypto=Hv,Pt.IEngine=r1,Pt.IEngineEvents=t1,Pt.IExpirer=Yv,Pt.IJsonRpcHistory=Gv,Pt.IKeyChain=Kv,Pt.IMessageTracker=kv,Pt.IPairing=Jv,Pt.IPublisher=jv,Pt.IRelayer=Qv,Pt.ISignClient=e1,Pt.ISignClientEvents=Zv,Pt.IStore=Wv,Pt.ISubscriber=zv,Pt.ISubscriberTopicMap=$v,Pt.IVerify=Xv});var S2={};ft(S2,{safeJsonParse:()=>Uc,safeJsonStringify:()=>qc});function Uc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ZQ(t)}catch{return t}}function qc(t){return typeof t=="string"?t:XQ(t)||""}var XQ,ZQ,Qd=ge(()=>{c();XQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ZQ=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var C2=m(Wd=>{"use strict";c();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.BrowserRandomSource=void 0;var T2=65536,i1=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(s1,"__esModule",{value:!0});function e7(t){for(var e=0;e{c()});var N2=m($d=>{"use strict";c();Object.defineProperty($d,"__esModule",{value:!0});$d.NodeRandomSource=void 0;var t7=qr(),o1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof JI<"u"){let e=x2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(zd,"__esModule",{value:!0});zd.SystemRandomSource=void 0;var r7=C2(),n7=N2(),a1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new r7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new n7.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};zd.SystemRandomSource=a1});var D2=m(Ar=>{"use strict";c();Object.defineProperty(Ar,"__esModule",{value:!0});function i7(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}Ar.mul=Math.imul||i7;function s7(t,e){return t+e|0}Ar.add=s7;function o7(t,e){return t-e|0}Ar.sub=o7;function a7(t,e){return t<>>32-e}Ar.rotl=a7;function u7(t,e){return t<<32-e|t>>>e}Ar.rotr=u7;function c7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ar.isInteger=Number.isInteger||c7;Ar.MAX_SAFE_INTEGER=9007199254740991;Ar.isSafeInteger=function(t){return Ar.isInteger(t)&&t>=-Ar.MAX_SAFE_INTEGER&&t<=Ar.MAX_SAFE_INTEGER}});var Ca=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var P2=D2();function l7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=l7;function f7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=f7;function h7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=h7;function d7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=d7;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=R2;Ne.writeInt16BE=R2;function B2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=B2;Ne.writeInt16LE=B2;function u1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=u1;function c1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=c1;function l1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=l1;function f1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=f1;function Kd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Kd;Ne.writeInt32BE=Kd;function Yd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Yd;Ne.writeInt32LE=Yd;function p7(t,e){e===void 0&&(e=0);var r=u1(t,e),n=u1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=p7;function g7(t,e){e===void 0&&(e=0);var r=c1(t,e),n=c1(t,e+4);return r*4294967296+n}Ne.readUint64BE=g7;function y7(t,e){e===void 0&&(e=0);var r=l1(t,e),n=l1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=y7;function m7(t,e){e===void 0&&(e=0);var r=f1(t,e),n=f1(t,e+4);return n*4294967296+r}Ne.readUint64LE=m7;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Kd(t/4294967296>>>0,e,r),Kd(t>>>0,e,r+4),e}Ne.writeUint64BE=L2;Ne.writeInt64BE=L2;function F2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Yd(t>>>0,e,r),Yd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=F2;Ne.writeInt64LE=F2;function w7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=w7;function E7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=v7;function A7(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!P2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.randomStringForEntropy=Jt.randomString=Jt.randomUint32=Jt.randomBytes=Jt.defaultRandomSource=void 0;var O7=O2(),D7=Ca(),M2=qr();Jt.defaultRandomSource=new O7.SystemRandomSource;function h1(t,e=Jt.defaultRandomSource){return e.randomBytes(t)}Jt.randomBytes=h1;function P7(t=Jt.defaultRandomSource){let e=h1(4,t),r=(0,D7.readUint32LE)(e);return(0,M2.wipe)(e),r}Jt.randomUint32=P7;var U2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function q2(t,e=U2,r=Jt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=h1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Jn,"__esModule",{value:!0});var Na=Ca(),xa=qr();Jn.DIGEST_LENGTH=64;Jn.BLOCK_SIZE=128;var H2=function(){function t(){this.digestLength=Jn.DIGEST_LENGTH,this.blockSize=Jn.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){xa.wipe(this._buffer),xa.wipe(this._tempHi),xa.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(d1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=d1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){xa.wipe(e.stateHi),xa.wipe(e.stateLo),e.buffer&&xa.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Jn.SHA512=H2;var V2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function d1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],g=r[5],w=r[6],E=r[7],T=n[0],D=n[1],B=n[2],W=n[3],U=n[4],A=n[5],I=n[6],N=n[7],_,S,R,J,Q,V,k,K;o>=128;){for(var pe=0;pe<16;pe++){var ue=8*pe+s;t[pe]=Na.readUint32BE(i,ue),e[pe]=Na.readUint32BE(i,ue+4)}for(var pe=0;pe<80;pe++){var re=a,Y=u,se=l,te=f,ie=d,M=g,le=w,ae=E,fe=T,oe=D,ce=B,y=W,v=U,b=A,P=I,C=N;if(_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(d>>>14|U<<32-14)^(d>>>18|U<<32-18)^(U>>>41-32|d<<32-(41-32)),S=(U>>>14|d<<32-14)^(U>>>18|d<<32-18)^(d>>>41-32|U<<32-(41-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=d&g^~d&w,S=U&A^~U&I,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=V2[pe*2],S=V2[pe*2+1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=t[pe%16],S=e[pe%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,R=k&65535|K<<16,J=Q&65535|V<<16,_=R,S=J,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),S=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=a&u^a&l^u&l,S=T&D^T&B^D&B,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,ae=k&65535|K<<16,C=Q&65535|V<<16,_=te,S=y,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=R,S=J,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,te=k&65535|K<<16,y=Q&65535|V<<16,u=re,l=Y,f=se,d=te,g=ie,w=M,E=le,a=ae,D=fe,B=oe,W=ce,U=y,A=v,I=b,N=P,T=C,pe%16===15)for(var ue=0;ue<16;ue++)_=t[ue],S=e[ue],Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=t[(ue+9)%16],S=e[(ue+9)%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+1)%16],J=e[(ue+1)%16],_=(R>>>1|J<<32-1)^(R>>>8|J<<32-8)^R>>>7,S=(J>>>1|R<<32-1)^(J>>>8|R<<32-8)^(J>>>7|R<<32-7),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+14)%16],J=e[(ue+14)%16],_=(R>>>19|J<<32-19)^(J>>>61-32|R<<32-(61-32))^R>>>6,S=(J>>>19|R<<32-19)^(R>>>61-32|J<<32-(61-32))^(J>>>6|R<<32-6),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,t[ue]=k&65535|K<<16,e[ue]=Q&65535|V<<16}_=a,S=T,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[0],S=n[0],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[0]=a=k&65535|K<<16,n[0]=T=Q&65535|V<<16,_=u,S=D,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[1],S=n[1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[1]=u=k&65535|K<<16,n[1]=D=Q&65535|V<<16,_=l,S=B,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[2],S=n[2],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[2]=l=k&65535|K<<16,n[2]=B=Q&65535|V<<16,_=f,S=W,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[3],S=n[3],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[3]=f=k&65535|K<<16,n[3]=W=Q&65535|V<<16,_=d,S=U,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[4],S=n[4],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[4]=d=k&65535|K<<16,n[4]=U=Q&65535|V<<16,_=g,S=A,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[5],S=n[5],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[5]=g=k&65535|K<<16,n[5]=A=Q&65535|V<<16,_=w,S=I,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[6],S=n[6],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[6]=w=k&65535|K<<16,n[6]=I=Q&65535|V<<16,_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[7],S=n[7],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[7]=E=k&65535|K<<16,n[7]=N=Q&65535|V<<16,s+=128,o-=128}return s}function B7(t){var e=new H2;e.update(t);var r=e.digest();return e.clean(),r}Jn.hash=B7});var rD=m(Ve=>{"use strict";c();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.convertSecretKeyToX25519=Ve.convertPublicKeyToX25519=Ve.verify=Ve.sign=Ve.extractPublicKeyFromSecretKey=Ve.generateKeyPair=Ve.generateKeyPairFromSeed=Ve.SEED_LENGTH=Ve.SECRET_KEY_LENGTH=Ve.PUBLIC_KEY_LENGTH=Ve.SIGNATURE_LENGTH=void 0;var L7=Vc(),Hc=G2(),$2=qr();Ve.SIGNATURE_LENGTH=64;Ve.PUBLIC_KEY_LENGTH=32;Ve.SECRET_KEY_LENGTH=64;Ve.SEED_LENGTH=32;function be(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,z2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function K2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function Q2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Gc(r,t),Gc(n,e),K2(r,n)}function Y2(t){let e=new Uint8Array(32);return Gc(e,t),e[0]&1}function V7(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function js(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ws(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function je(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function Qs(t,e){je(t,e,e)}function J2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Qs(r,r),n!==2&&n!==4&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function H7(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Qs(r,r),n!==1&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function m1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Ws(r,t[1],t[0]),Ws(f,e[1],e[0]),je(r,r,f),js(n,t[0],t[1]),js(f,e[0],e[1]),je(n,n,f),je(i,t[3],e[3]),je(i,i,U7),je(s,t[2],e[2]),js(s,s,s),Ws(o,n,r),Ws(a,s,i),js(u,s,i),js(l,n,r),je(t[0],o,a),je(t[1],l,u),je(t[2],u,a),je(t[3],o,l)}function W2(t,e,r){for(let n=0;n<4;n++)z2(t[n],e[n],r)}function E1(t,e){let r=be(),n=be(),i=be();J2(i,e[2]),je(r,e[0],i),je(n,e[1],i),Gc(t,n),t[31]^=Y2(r)<<7}function X2(t,e,r){Mi(t[0],y1),Mi(t[1],Oa),Mi(t[2],Oa),Mi(t[3],y1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;W2(t,e,i),m1(e,t),m1(t,t),W2(t,e,i)}}function v1(t,e){let r=[be(),be(),be(),be()];Mi(r[0],k2),Mi(r[1],j2),Mi(r[2],Oa),je(r[3],k2,j2),X2(t,r,e)}function Z2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Hc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];v1(n,e),E1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=Z2;function G7(t){let e=(0,L7.randomBytes)(32,t),r=Z2(e);return(0,$2.wipe)(e),r}Ve.generateKeyPair=G7;function k7(t){if(t.length!==Ve.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ve.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ve.extractPublicKeyFromSecretKey=k7;var g1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function eD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*g1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*g1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function w1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;eD(t,e)}function j7(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Hc.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new Hc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),w1(a),v1(n,a),E1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();w1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return eD(s.subarray(32),r),s}Ve.sign=j7;function tD(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Mi(t[2],Oa),V7(t[1],e),Qs(i,t[1]),je(s,i,M7),Ws(i,i,t[2]),js(s,t[2],s),Qs(o,s),Qs(a,o),je(u,a,o),je(r,u,i),je(r,r,s),H7(r,r),je(r,r,i),je(r,r,s),je(r,r,s),je(t[0],r,s),Qs(n,t[0]),je(n,n,s),Q2(n,i)&&je(t[0],t[0],q7),Qs(n,t[0]),je(n,n,s),Q2(n,i)?-1:(Y2(t[0])===e[31]>>7&&Ws(t[0],y1,t[0]),je(t[3],t[0],t[1]),0)}function Q7(t,e,r){let n=new Uint8Array(32),i=[be(),be(),be(),be()],s=[be(),be(),be(),be()];if(r.length!==Ve.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ve.SIGNATURE_LENGTH} bytes`);if(tD(s,t))return!1;let o=new Hc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return w1(a),X2(i,s,a),v1(s,r.subarray(32)),m1(i,s),E1(n,i),!K2(r,n)}Ve.verify=Q7;function W7(t){let e=[be(),be(),be(),be()];if(tD(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];js(r,Oa,i),Ws(n,Oa,i),J2(n,n),je(r,r,n);let s=new Uint8Array(32);return Gc(s,r),s}Ve.convertPublicKeyToX25519=W7;function $7(t){let e=(0,Hc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,$2.wipe)(e),r}Ve.convertSecretKeyToX25519=$7});var Jd,Xd,$s,Da,Zd,kc,ep,tp,rp,Pa,np,ip,nD,iD,sp=ge(()=>{c();Jd="EdDSA",Xd="JWT",$s=".",Da="base64url",Zd="utf8",kc="utf8",ep=":",tp="did",rp="key",Pa="base58btc",np="z",ip="K36",nD=32,iD=32});function Ui(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var jc=ge(()=>{c()});function Ra(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ui(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var op=ge(()=>{c();jc()});function ap(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ra(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ui(r)}var A1=ge(()=>{c();op();jc()});function z7(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var K7,Y7,sD,oD=ge(()=>{c();K7=z7,Y7=K7,sD=Y7});var Rfe,aD,Xn,uD,cD,qi=ge(()=>{c();Rfe=new Uint8Array(0),aD=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},uD=t=>new TextEncoder().encode(t),cD=t=>new TextDecoder().decode(t)});var b1,_1,I1,fD,S1,Ba,Vi,J7,X7,pt,Kr=ge(()=>{c();oD();qi();b1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},_1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return fD(this,e)}},I1=class{constructor(e){this.decoders=e}or(e){return fD(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},fD=(t,e)=>new I1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),S1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new b1(e,r,n),this.decoder=new _1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ba=({name:t,prefix:e,encode:r,decode:n})=>new S1(t,e,r,n),Vi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=sD(r,e);return Ba({prefix:t,name:e,encode:n,decode:s=>Xn(i(s))})},J7=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},X7=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Ba({prefix:e,name:t,encode(i){return X7(i,n,r)},decode(i){return J7(i,n,r,t)}})});var T1={};ft(T1,{identity:()=>Z7});var Z7,hD=ge(()=>{c();Kr();qi();Z7=Ba({prefix:"\0",name:"identity",encode:t=>cD(t),decode:t=>uD(t)})});var C1={};ft(C1,{base2:()=>e9});var e9,dD=ge(()=>{c();Kr();e9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var x1={};ft(x1,{base8:()=>t9});var t9,pD=ge(()=>{c();Kr();t9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var N1={};ft(N1,{base10:()=>r9});var r9,gD=ge(()=>{c();Kr();r9=Vi({prefix:"9",name:"base10",alphabet:"0123456789"})});var O1={};ft(O1,{base16:()=>n9,base16upper:()=>i9});var n9,i9,yD=ge(()=>{c();Kr();n9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),i9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var D1={};ft(D1,{base32:()=>La,base32hex:()=>u9,base32hexpad:()=>l9,base32hexpadupper:()=>f9,base32hexupper:()=>c9,base32pad:()=>o9,base32padupper:()=>a9,base32upper:()=>s9,base32z:()=>h9});var La,s9,o9,a9,u9,c9,l9,f9,h9,P1=ge(()=>{c();Kr();La=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),u9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),f9=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h9=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var R1={};ft(R1,{base36:()=>d9,base36upper:()=>p9});var d9,p9,mD=ge(()=>{c();Kr();d9=Vi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),p9=Vi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var B1={};ft(B1,{base58btc:()=>In,base58flickr:()=>g9});var In,g9,L1=ge(()=>{c();Kr();In=Vi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),g9=Vi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var F1={};ft(F1,{base64:()=>y9,base64pad:()=>m9,base64url:()=>w9,base64urlpad:()=>E9});var y9,m9,w9,E9,wD=ge(()=>{c();Kr();y9=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),m9=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w9=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),E9=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var M1={};ft(M1,{base256emoji:()=>I9});function b9(t){return t.reduce((e,r)=>(e+=v9[r],e),"")}function _9(t){let e=[];for(let r of t){let n=A9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var ED,v9,A9,I9,vD=ge(()=>{c();Kr();ED=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),v9=ED.reduce((t,e,r)=>(t[r]=e,t),[]),A9=ED.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);I9=Ba({prefix:"\u{1F680}",name:"base256emoji",encode:b9,decode:_9})});function _D(t,e,r){e=e||[],r=r||0;for(var n=r;t>=x9;)e[r++]=t&255|AD,t/=128;for(;t&C9;)e[r++]=t&255|AD,t>>>=7;return e[r]=t|0,_D.bytes=r-n+1,e}function U1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw U1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&bD)<=O9);return U1.bytes=s-n,r}var S9,AD,T9,C9,x9,N9,O9,bD,D9,P9,R9,B9,L9,F9,M9,U9,q9,V9,H9,G9,Qc,ID=ge(()=>{c();S9=_D,AD=128,T9=127,C9=~T9,x9=Math.pow(2,31);N9=U1,O9=128,bD=127;D9=Math.pow(2,7),P9=Math.pow(2,14),R9=Math.pow(2,21),B9=Math.pow(2,28),L9=Math.pow(2,35),F9=Math.pow(2,42),M9=Math.pow(2,49),U9=Math.pow(2,56),q9=Math.pow(2,63),V9=function(t){return t{c();ID();Wc=(t,e=0)=>[Qc.decode(t,e),Qc.decode.bytes],Fa=(t,e,r=0)=>(Qc.encode(t,e,r),e),Ma=t=>Qc.encodingLength(t)});var zs,SD,TD,Ua,zc=ge(()=>{c();qi();cp();zs=(t,e)=>{let r=e.byteLength,n=Ma(t),i=n+Ma(r),s=new Uint8Array(i+r);return Fa(t,s,0),Fa(r,s,n),s.set(e,i),new Ua(t,r,e,s)},SD=t=>{let e=Xn(t),[r,n]=Wc(e),[i,s]=Wc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ua(r,i,o,e)},TD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&aD(t.bytes,e.bytes),Ua=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var V1,q1,H1=ge(()=>{c();zc();V1=({name:t,code:e,encode:r})=>new q1(t,e,r),q1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?zs(this.code,r):r.then(n=>zs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var G1={};ft(G1,{sha256:()=>k9,sha512:()=>j9});var xD,k9,j9,ND=ge(()=>{c();H1();xD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),k9=V1({name:"sha2-256",code:18,encode:xD("SHA-256")}),j9=V1({name:"sha2-512",code:19,encode:xD("SHA-512")})});var k1={};ft(k1,{identity:()=>$9});var OD,Q9,DD,W9,$9,PD=ge(()=>{c();qi();zc();OD=0,Q9="identity",DD=Xn,W9=t=>zs(OD,DD(t)),$9={code:OD,name:Q9,encode:DD,digest:W9}});var RD=ge(()=>{c();qi()});var Ehe,vhe,BD=ge(()=>{c();Ehe=new TextEncoder,vhe=new TextDecoder});var hp,Y9,J9,X9,Kc,Z9,LD,FD,lp,fp,eW,tW,rW,MD=ge(()=>{c();cp();zc();L1();P1();qi();hp=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:fp,byteLength:fp,code:lp,version:lp,multihash:lp,bytes:lp,_baseCache:fp,asCID:fp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Kc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Z9)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=zs(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&TD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return J9(r,i,e||In.encoder);default:return X9(r,i,e||La.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return tW(/^0\.0/,rW),!!(e&&(e[FD]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||LD(r,n,i.bytes))}else if(e!=null&&e[FD]===!0){let{version:r,multihash:n,code:i}=e,s=SD(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==Kc)throw new Error(`Version 0 CID must use dag-pb (code: ${Kc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=LD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Kc,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Xn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Ua(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,g]=Wc(e.subarray(r));return r+=g,d},i=n(),s=Kc;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=Y9(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Y9=(t,e)=>{switch(t[0]){case"Q":{let r=e||In;return[In.prefix,r.decode(`${In.prefix}${t}`)]}case In.prefix:{let r=e||In;return[In.prefix,r.decode(t)]}case La.prefix:{let r=e||La;return[La.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},J9=(t,e,r)=>{let{prefix:n}=r;if(n!==In.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},X9=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},Kc=112,Z9=18,LD=(t,e,r)=>{let n=Ma(t),i=n+Ma(e),s=new Uint8Array(i+r.byteLength);return Fa(t,s,0),Fa(e,s,n),s.set(r,i),s},FD=Symbol.for("@ipld/js-cid/CID"),lp={writable:!1,configurable:!1,enumerable:!0},fp={writable:!1,enumerable:!1,configurable:!1},eW="0.0.0-dev",tW=(t,e)=>{if(t.test(eW))console.warn(e);else throw new Error(e)},rW=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};de.ErrContractHasNoAddress=cm;var lm=class extends De{constructor(e){super(e)}};de.ErrMock=lm;var fm=class extends De{constructor(e){super(e)}};de.ErrTypingSystem=fm;var hm=class extends De{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};de.ErrMissingFieldOnStruct=hm;var dm=class extends De{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};de.ErrMissingFieldOnEnum=dm;var pm=class extends De{constructor(e){super(`cannot parse contract results: ${e}`)}};de.ErrCannotParseContractResults=pm;var gm=class extends De{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};de.ErrCannotParseTransactionOutcome=gm;var ym=class extends De{constructor(e){super(e)}};de.ErrCodec=ym;var mm=class extends De{constructor(e){super(e)}};de.ErrContractInteraction=mm;var wm=class extends De{constructor(){super("Method not yet implemented")}};de.ErrNotImplemented=wm;var Em=class extends De{constructor(){super("invalid arguments for relayed v1 builder")}};de.ErrInvalidRelayedV1BuilderArguments=Em;var vm=class extends De{constructor(){super("invalid arguments for relayed v2 builder")}};de.ErrInvalidRelayedV2BuilderArguments=vm;var Am=class extends De{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};de.ErrGasLimitShouldBe0ForInnerTransaction=Am;var bm=class extends De{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};de.ErrIsCompletedFieldIsMissingOnTransaction=bm});var _m=E(yi=>{"use strict";l();var d4=yi&&yi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yi,"__esModule",{value:!0});yi.TokenPayment=yi.TokenTransfer=void 0;var Du=d4(kt()),p4=Be(),BS="EGLD",LS=18;Du.default.set({ROUNDING_MODE:1});var hf=class t{constructor(e){let r=new Du.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new p4.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new Du.default(e).shiftedBy(LS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:BS,nonce:0,amountAsBigInteger:e,numDecimals:LS})}static fungibleFromAmount(e,r,n){let i=new Du.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Du.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==BS}isFungible(){return this.nonce==0}};yi.TokenTransfer=hf;var Im=class extends hf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};yi.TokenPayment=Im});var Ss=E($e=>{"use strict";l();Object.defineProperty($e,"__esModule",{value:!0});$e.ARGUMENTS_SEPARATOR=$e.ESDT_TRANSFER_VALUE=$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_GAS_LIMIT=$e.TRANSACTION_VERSION_WITH_OPTIONS=$e.TRANSACTION_VERSION_DEFAULT=$e.TRANSACTION_OPTIONS_TX_GUARDED=$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=$e.TRANSACTION_OPTIONS_DEFAULT=$e.TRANSACTION_MIN_GAS_PRICE=void 0;$e.TRANSACTION_MIN_GAS_PRICE=1e9;$e.TRANSACTION_OPTIONS_DEFAULT=0;$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;$e.TRANSACTION_OPTIONS_TX_GUARDED=2;$e.TRANSACTION_VERSION_DEFAULT=1;$e.TRANSACTION_VERSION_WITH_OPTIONS=2;$e.ESDT_TRANSFER_GAS_LIMIT=5e5;$e.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";$e.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";$e.ESDT_TRANSFER_VALUE="0";$e.ARGUMENTS_SEPARATOR="@"});var vr=E(nt=>{"use strict";l();var g4=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g4(e,t,r);return y4(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var So=m4(Be());function w4(t,e){if(!t)throw new So.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=w4;function E4(t,e){FS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=E4;function FS(t,e){if(e==null||e===void 0)throw new So.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=FS;function v4(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new So.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=v4;function A4(t,e){let r=t.length||0;if(r!=e)throw new So.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=A4;function b4(t,e){if(Sm(t))throw new So.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=b4;function I4(t,e){if(!Sm(t))throw new So.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=I4;function Sm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=Sm});var MS=E(df=>{"use strict";l();Object.defineProperty(df,"__esModule",{value:!0});df.getJavascriptPrototypesInHierarchy=void 0;function _4(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}df.getJavascriptPrototypesInHierarchy=_4});var _t=E(It=>{"use strict";l();Object.defineProperty(It,"__esModule",{value:!0});It.NullType=It.TypePlaceholder=It.isTyped=It.PrimitiveValue=It.TypedValue=It.CustomType=It.PrimitiveType=It.TypeCardinality=It.Type=void 0;var Tm=MS(),US=vr(),mi=class t{constructor(e,r=[],n=Pu.fixed(1)){US.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return Tm.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return US.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Tm.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};It.Type=mi;mi.ClassName="Type";var Pu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};It.TypeCardinality=Pu;Pu.MaxCardinality=4096;var pf=class t extends mi{constructor(e){super(e)}getClassName(){return t.ClassName}};It.PrimitiveType=pf;pf.ClassName="PrimitiveType";var gf=class t extends mi{getClassName(){return t.ClassName}};It.CustomType=gf;gf.ClassName="CustomType";var Ru=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return Tm.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};It.TypedValue=Ru;Ru.ClassName="TypedValue";var yf=class t extends Ru{constructor(e){super(e)}getClassName(){return t.ClassName}};It.PrimitiveValue=yf;yf.ClassName="PrimitiveValue";function S4(t){return t.belongsToTypesystem!==void 0}It.isTyped=S4;var mf=class t extends mi{constructor(){super("...")}getClassName(){return t.ClassName}};It.TypePlaceholder=mf;mf.ClassName="TypePlaceholder";var wf=class t extends mi{constructor(){super("?")}getClassName(){return t.ClassName}};It.NullType=wf;wf.ClassName="NullType"});var qS=E((To,Co)=>{l();(function(t){var e=typeof To=="object"&&To&&!To.nodeType&&To,r=typeof Co=="object"&&Co&&!Co.nodeType&&Co,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,c=38,f=700,h=72,g=128,y="-",m=/^xn--/,T=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=o-a,U=Math.floor,A=String.fromCharCode,_;function N(Y){throw new RangeError(B[Y])}function I(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function S(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(O,".");var M=Y.split("."),le=I(M,se).join(".");return ie+le}function R(Y){for(var se=[],te=0,ie=Y.length,M,le;te=55296&&M<=56319&&te65535&&(se-=65536,te+=A(se>>>10&1023|55296),se=56320|se&1023),te+=A(se),te}).join("")}function Q(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function V(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function k(Y,se,te){var ie=0;for(Y=te?U(Y/f):Y>>1,Y+=U(Y/se);Y>W*u>>1;ie+=o)Y=U(Y/W);return U(ie+(W+1)*Y/(Y+c))}function K(Y){var se=[],te=Y.length,ie,M=0,le=g,ae=h,he,oe,ce,w,v,b,P,C,D;for(he=Y.lastIndexOf(y),he<0&&(he=0),oe=0;oe=128&&N("not-basic"),se.push(Y.charCodeAt(oe));for(ce=he>0?he+1:0;ce=te&&N("invalid-input"),P=Q(Y.charCodeAt(ce++)),(P>=o||P>U((s-M)/v))&&N("overflow"),M+=P*v,C=b<=ae?a:b>=ae+u?u:b-ae,!(PU(s/D)&&N("overflow"),v*=D;ie=se.length+1,ae=k(M-w,ie,w==0),U(M/ie)>s-le&&N("overflow"),le+=U(M/ie),M%=ie,se.splice(M++,0,le)}return J(se)}function ge(Y){var se,te,ie,M,le,ae,he,oe,ce,w,v,b=[],P,C,D,L;for(Y=R(Y),P=Y.length,se=g,te=0,le=h,ae=0;ae=se&&vU((s-te)/C)&&N("overflow"),te+=(he-se)*C,se=he,ae=0;aes&&N("overflow"),v==se){for(oe=te,ce=o;w=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";l();var HS=qS();function T4(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Cm(t){return t>="0"&&t<="7"}function C4(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function VS(t){return t=parseInt(t,16),HS.ucs2.encode([t])}function GS(t,e,r){var n=!1,i=[];function s(u){var c=t[u];if(!C4(c))throw new T4(u,"Unexpected token ILLEGAL");return c}for(;e{l();var WS=kS();KS.exports={validate:x4,parse:N4};function x4(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Ef(t,0,e,!1)}catch(n){r=n.message}return r}function N4(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Ef(t,0,e,!0);return r.value}function zS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function R4(t,e,r,n){for(var i=e,s=",",o=[],a=e;Ts(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Ef(t,i,r,n),c=zS(t,u.end);n&&o.push(u.value),i=c.end,s=c.value}return{start:e,end:i,value:o}}function B4(t,e){return t.substr(e,4)==="true"}function L4(t,e){return t.substr(e,5)==="false"}function F4(t,e){return t.substr(e,4)==="null"}var M4=new RegExp(/^\s$/);function Ts(t){return M4.test(t)}var U4=new RegExp(/^\d$/);function jS(t){return U4.test(t)}function Wn(t,e,r){var n=10,i;t.length{"use strict";l();var q4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q4(e,t,r);return V4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.TypeExpressionParser=void 0;var JS=H4(Be()),G4=_t(),k4=YS(),Nm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new JS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return k4.parse(r)}catch{throw new JS.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new G4.Type(e,n)}};an.TypeExpressionParser=Nm});var Dm=E(wi=>{"use strict";l();Object.defineProperty(wi,"__esModule",{value:!0});wi.EndpointParameterDefinition=wi.EndpointModifiers=wi.EndpointDefinition=void 0;var j4=Bu(),XS="?",Q4="N / A",Om=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?XS:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Lu.fromJSON(s)),n=e.outputs.map(s=>Lu.fromJSON(s)),i=new vf(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};wi.EndpointDefinition=Om;var vf=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};wi.EndpointModifiers=vf;var Lu=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new j4.TypeExpressionParser().parse(e.type);return new t(e.name||XS,e.description||Q4,r)}};wi.EndpointParameterDefinition=Lu});var xo=E(cr=>{"use strict";l();var W4=cr&&cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=cr&&cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=cr&&cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W4(e,t,r);return z4(e,t),e};Object.defineProperty(cr,"__esModule",{value:!0});cr.Fields=cr.Field=cr.FieldDefinition=void 0;var Pm=$4(Be()),K4=Bu(),Rm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new K4.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};cr.FieldDefinition=Rm;var Bm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Pm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Pm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};cr.Field=Bm;var Lm=class{static checkTyping(e,r){if(e.length!=r.length)throw new Pm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";l();Object.defineProperty(Ei,"__esModule",{value:!0});Ei.EnumValue=Ei.EnumVariantDefinition=Ei.EnumType=void 0;var Y4=Be(),Fm=vr(),Af=xo(),eT=_t(),ZS=256,bf=class t extends eT.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>If.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Fm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Fm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};Ei.EnumType=bf;bf.ClassName="EnumType";var If=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Fm.guardTrue(rAf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ei.EnumVariantDefinition=If;var _f=class t extends eT.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Af.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Af.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Y4.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};Ei.EnumValue=_f;_f.ClassName="EnumValue"});var rT=E(No=>{"use strict";l();Object.defineProperty(No,"__esModule",{value:!0});No.EventTopicDefinition=No.EventDefinition=void 0;var J4=Bu(),tT="?",Mm=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?tT:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>Sf.fromJSON(n));return new t(e.identifier,r)}};No.EventDefinition=Mm;var Sf=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new J4.TypeExpressionParser().parse(e.type);return new t({name:e.name||tT,type:r,indexed:e.indexed})}};No.EventTopicDefinition=Sf});var Do=E(Oo=>{"use strict";l();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.Struct=Oo.StructType=void 0;var X4=Be(),Tf=xo(),nT=_t(),Cf=class t extends nT.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Tf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Tf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Oo.StructType=Cf;Cf.ClassName="StructType";var xf=class t extends nT.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Tf.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new X4.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return Tf.Fields.equals(r,n)}};Oo.Struct=xf;xf.ClassName="Struct"});var qm=E((jse,oT)=>{"use strict";l();var Of="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Um={};for(Mu=0;Mu>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function iT(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Po(e)^n>>5}for(e=Po(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=iT(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Po(n)^o,i+=Of.charAt(o)}for(s=0;s<6;++s)n=Po(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=Of.charAt(a)}return i}function sT(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=iT(s);if(typeof a=="string")return a;for(var u=[],c=0;c=o.length)&&u.push(h)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function eq(){var t=sT.apply(null,arguments);if(typeof t=="object")return t}function tq(t){var e=sT.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Df(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";l();var oq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aq=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aT=un&&un.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oq(e,t,r);return aq(e,t),e};Object.defineProperty(un,"__esModule",{value:!0});un.Address=void 0;var Pf=aT(qm()),Ro=aT(Be()),Vm="erd",Hm=32,uq="0".repeat(16),Gm=class t{constructor(e){if(this.valueHex="",!!e){if(e instanceof t)return t.fromAddress(e);if(e instanceof d.Buffer)return t.fromBuffer(e);if(typeof e=="string")return t.fromString(e);throw new Ro.ErrAddressCannotCreate(e)}}static fromAddress(e){return t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Hm)throw new Ro.ErrAddressCannotCreate(e);return t.fromValidHex(e.toString("hex"))}static fromString(e){return t.isValidHex(e)?t.fromValidHex(e):t.fromBech32(e)}static isValidHex(e){return d.Buffer.from(e,"hex").length==Hm}static fromHex(e){if(!t.isValidHex(e))throw new Ro.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=Pf.decode(e)}catch(s){throw new Ro.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Vm)throw new Ro.ErrAddressBadHrp(Vm,n);let i=d.Buffer.from(Pf.fromWords(r.words));if(i.length!=Hm)throw new Ro.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Pf.toWords(this.pubkey());return Pf.encode(Vm,e)}pubkey(){return this.isEmpty()?d.Buffer.from([]):d.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(uq)}};un.Address=Gm});var Lo=E(Bo=>{"use strict";l();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.AddressValue=Bo.AddressType=void 0;var cq=ht(),uT=_t(),Uu=class t extends uT.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Bo.AddressType=Uu;Uu.ClassName="AddressType";var Rf=class t extends uT.PrimitiveValue{constructor(e){super(new Uu),this.value=new cq.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Bo.AddressValue=Rf;Rf.ClassName="AddressValue"});var Lf=E(Fo=>{"use strict";l();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.OptionalValue=Fo.OptionalType=void 0;var lq=vr(),qu=_t(),Vu=class t extends qu.Type{constructor(e){super("Optional",[e],qu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(qu.NullType.ClassName);return r||n}};Fo.OptionalType=Vu;Vu.ClassName="OptionalType";var Bf=class t extends qu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Vu(new qu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return lq.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Fo.OptionalValue=Bf;Bf.ClassName="OptionalValue"});var Gu=E(Mo=>{"use strict";l();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.BooleanValue=Mo.BooleanType=void 0;var cT=_t(),Hu=class t extends cT.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Mo.BooleanType=Hu;Hu.ClassName="BooleanType";var Ff=class t extends cT.PrimitiveValue{constructor(e){super(new Hu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Mo.BooleanValue=Ff;Ff.ClassName="BooleanValue"});var vi=E(Uo=>{"use strict";l();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.BytesValue=Uo.BytesType=void 0;var lT=_t(),ku=class t extends lT.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Uo.BytesType=ku;ku.ClassName="BytesType";var Mf=class t extends lT.PrimitiveValue{constructor(e){super(new ku),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=d.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=d.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Uo.BytesValue=Mf;Mf.ClassName="BytesValue"});var hT=E(qo=>{"use strict";l();Object.defineProperty(qo,"__esModule",{value:!0});qo.CodeMetadataValue=qo.CodeMetadataType=void 0;var fT=_t(),Uf=class extends fT.PrimitiveType{constructor(){super("CodeMetadata")}};qo.CodeMetadataType=Uf;var km=class extends fT.PrimitiveValue{constructor(e){super(new Uf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};qo.CodeMetadataValue=km});var Vf=E(Vo=>{"use strict";l();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.CompositeValue=Vo.CompositeType=void 0;var fq=vr(),jm=_t(),ju=class t extends jm.Type{constructor(...e){super("Composite",e,jm.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Vo.CompositeType=ju;ju.ClassName="CompositeType";var qf=class t extends jm.TypedValue{constructor(e,r){super(e),fq.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new ju(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";l();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.CollectionOfTypedValues=void 0;var Qm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";l();Object.defineProperty(cn,"__esModule",{value:!0});cn.List=cn.OptionValue=cn.ListType=cn.OptionType=void 0;var hq=vr(),dq=Wm(),xs=_t(),Cs=class t extends xs.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(xs.NullType.ClassName);return r||n}};cn.OptionType=Cs;Cs.ClassName="OptionType";var Qu=class t extends xs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};cn.ListType=Qu;Qu.ClassName="ListType";var Gf=class t extends xs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Cs(new xs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Cs(e))}static newProvided(e){let r=new Cs(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return hq.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};cn.OptionValue=Gf;Gf.ClassName="OptionValue";var kf=class t extends xs.TypedValue{constructor(e,r){super(e),this.backingCollection=new dq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new xs.TypePlaceholder,[]);let r=e[0].getType(),n=new Qu(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};cn.List=kf;kf.ClassName="List"});var Wf=E(Ho=>{"use strict";l();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.ArrayVec=Ho.ArrayVecType=void 0;var dT=vr(),pq=Wm(),pT=_t(),jf=class t extends pT.Type{constructor(e,r){super("Array",[r]),dT.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Ho.ArrayVecType=jf;jf.ClassName="ArrayVecType";var Qf=class t extends pT.TypedValue{constructor(e,r){super(e),dT.guardLength(r,e.length),this.backingCollection=new pq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Ho.ArrayVec=Qf;Qf.ClassName="ArrayVec"});var $u=E(Go=>{"use strict";l();Object.defineProperty(Go,"__esModule",{value:!0});Go.H256Value=Go.H256Type=void 0;var gT=_t(),zu=class t extends gT.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Go.H256Type=zu;zu.ClassName="H256Type";var zf=class t extends gT.PrimitiveValue{constructor(e){super(new zu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Go.H256Value=zf;zf.ClassName="H256Value"});var Kf=E(ko=>{"use strict";l();Object.defineProperty(ko,"__esModule",{value:!0});ko.NothingValue=ko.NothingType=void 0;var yT=_t(),Ku=class t extends yT.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};ko.NothingType=Ku;Ku.ClassName="NothingType";var $f=class t extends yT.PrimitiveValue{constructor(){super(new Ku)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};ko.NothingValue=$f;$f.ClassName="NothingValue"});var oc=E(_e=>{"use strict";l();var gq=_e&&_e.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yq=_e&&_e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mq=_e&&_e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gq(e,t,r);return yq(e,t),e},wq=_e&&_e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_e,"__esModule",{value:!0});_e.BigIntValue=_e.BigUIntValue=_e.I64Value=_e.U64Value=_e.I32Value=_e.U32Value=_e.I16Value=_e.U16Value=_e.I8Value=_e.U8Value=_e.NumericalValue=_e.BigIntType=_e.BigUIntType=_e.I64Type=_e.U64Type=_e.I32Type=_e.U32Type=_e.I16Type=_e.U16Type=_e.I8Type=_e.U8Type=_e.NumericalType=void 0;var mT=mq(Be()),wT=_t(),Ns=wq(kt()),lr=class t extends wT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};_e.NumericalType=lr;lr.ClassName="NumericalType";var Yu=class t extends lr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};_e.U8Type=Yu;Yu.ClassName="U8Type";var Ju=class t extends lr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};_e.I8Type=Ju;Ju.ClassName="I8Type";var Xu=class t extends lr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};_e.U16Type=Xu;Xu.ClassName="U16Type";var Zu=class t extends lr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};_e.I16Type=Zu;Zu.ClassName="I16Type";var ec=class t extends lr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};_e.U32Type=ec;ec.ClassName="U32Type";var tc=class t extends lr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};_e.I32Type=tc;tc.ClassName="I32Type";var rc=class t extends lr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};_e.U64Type=rc;rc.ClassName="U64Type";var nc=class t extends lr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};_e.I64Type=nc;nc.ClassName="I64Type";var ic=class t extends lr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};_e.BigUIntType=ic;ic.ClassName="BigUIntType";var sc=class t extends lr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};_e.BigIntType=sc;sc.ClassName="BigIntType";var fr=class t extends wT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ns.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new mT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new mT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};_e.NumericalValue=fr;fr.ClassName="NumericalValue";var Yf=class t extends fr{constructor(e){super(new Yu,new Ns.default(e))}getClassName(){return t.ClassName}};_e.U8Value=Yf;Yf.ClassName="U8Value";var Jf=class t extends fr{constructor(e){super(new Ju,new Ns.default(e))}getClassName(){return t.ClassName}};_e.I8Value=Jf;Jf.ClassName="I8Value";var Xf=class t extends fr{constructor(e){super(new Xu,new Ns.default(e))}getClassName(){return t.ClassName}};_e.U16Value=Xf;Xf.ClassName="U16Value";var Zf=class t extends fr{constructor(e){super(new Zu,new Ns.default(e))}getClassName(){return t.ClassName}};_e.I16Value=Zf;Zf.ClassName="I16Value";var eh=class t extends fr{constructor(e){super(new ec,new Ns.default(e))}getClassName(){return t.ClassName}};_e.U32Value=eh;eh.ClassName="U32Value";var th=class t extends fr{constructor(e){super(new tc,new Ns.default(e))}getClassName(){return t.ClassName}};_e.I32Value=th;th.ClassName="I32Value";var rh=class t extends fr{constructor(e){super(new rc,e)}getClassName(){return t.ClassName}};_e.U64Value=rh;rh.ClassName="U64Value";var nh=class t extends fr{constructor(e){super(new nc,e)}getClassName(){return t.ClassName}};_e.I64Value=nh;nh.ClassName="I64Value";var ih=class t extends fr{constructor(e){super(new ic,e)}getClassName(){return t.ClassName}};_e.BigUIntValue=ih;ih.ClassName="BigUIntValue";var sh=class t extends fr{constructor(e){super(new sc,e)}getClassName(){return t.ClassName}};_e.BigIntValue=sh;sh.ClassName="BigIntValue"});var ah=E(jo=>{"use strict";l();Object.defineProperty(jo,"__esModule",{value:!0});jo.StringValue=jo.StringType=void 0;var ET=_t(),ac=class t extends ET.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};jo.StringType=ac;ac.ClassName="StringType";var oh=class t extends ET.PrimitiveValue{constructor(e){super(new ac),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=d.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};jo.StringValue=oh;oh.ClassName="StringValue"});var Wo=E(Qo=>{"use strict";l();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.TokenIdentifierValue=Qo.TokenIdentifierType=void 0;var vT=_t(),Eq="EGLD",uc=class t extends vT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Qo.TokenIdentifierType=uc;uc.ClassName="TokenIdentifierType";var uh=class t extends vT.PrimitiveValue{constructor(e){super(new uc),this.value=e}static egld(){return new t(Eq)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};Qo.TokenIdentifierValue=uh;uh.ClassName="TokenIdentifierValue"});var lh=E(Cr=>{"use strict";l();var vq=Cr&&Cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Aq=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bq=Cr&&Cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vq(e,t,r);return Aq(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Tuple=Cr.TupleType=void 0;var Iq=bq(Be()),AT=xo(),bT=Do(),cc=class t extends bT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new AT.FieldDefinition(IT(i),"anonymous tuple field",n))}};Cr.TupleType=cc;cc.ClassName="TupleType";function IT(t){return`field${t}`}var ch=class t extends bT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new Iq.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new cc(...r),i=e.map((s,o)=>new AT.Field(s,IT(o)));return new t(n,i)}};Cr.Tuple=ch;ch.ClassName="Tuple"});var dh=E(Ai=>{"use strict";l();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.VariadicValue=Ai.CountedVariadicType=Ai.VariadicType=void 0;var zo=_t(),Os=class t extends zo.Type{constructor(e,r=!1){super("Variadic",[e],zo.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};Ai.VariadicType=Os;Os.ClassName="VariadicType";var fh=class extends zo.Type{constructor(e){super("Variadic",[e],zo.TypeCardinality.variable())}getClassName(){return Os.ClassName}};Ai.CountedVariadicType=fh;fh.ClassName="VariadicType";var hh=class t extends zo.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Os(new zo.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Os(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";l();var _q=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sq=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tq=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_q(e,t,r);return Sq(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.TypeMapper=void 0;var _T=Tq(Be()),Cq=Lo(),zm=Lf(),xq=Gu(),Nq=vi(),Oq=hT(),ph=Vf(),$m=Fu(),Dq=xo(),ST=Wu(),ln=Wf(),Pq=$u(),TT=Kf(),xr=oc(),Rq=ah(),CT=Do(),xT=Wo(),bi=lh(),gh=dh(),Km=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new ST.OptionType(r[0])],["List",(...r)=>new ST.ListType(r[0])],["VarArgs",(...r)=>new gh.VariadicType(r[0])],["MultiResultVec",(...r)=>new gh.VariadicType(r[0])],["variadic",(...r)=>new gh.VariadicType(r[0])],["counted-variadic",(...r)=>new gh.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new zm.OptionalType(r[0])],["optional",(...r)=>new zm.OptionalType(r[0])],["OptionalResult",(...r)=>new zm.OptionalType(r[0])],["multi",(...r)=>new ph.CompositeType(...r)],["MultiArg",(...r)=>new ph.CompositeType(...r)],["MultiResult",(...r)=>new ph.CompositeType(...r)],["multi",(...r)=>new ph.CompositeType(...r)],["tuple",(...r)=>new bi.TupleType(...r)],["tuple2",(...r)=>new bi.TupleType(...r)],["tuple3",(...r)=>new bi.TupleType(...r)],["tuple4",(...r)=>new bi.TupleType(...r)],["tuple5",(...r)=>new bi.TupleType(...r)],["tuple6",(...r)=>new bi.TupleType(...r)],["tuple7",(...r)=>new bi.TupleType(...r)],["tuple8",(...r)=>new bi.TupleType(...r)],["array2",(...r)=>new ln.ArrayVecType(2,r[0])],["array8",(...r)=>new ln.ArrayVecType(8,r[0])],["array16",(...r)=>new ln.ArrayVecType(16,r[0])],["array20",(...r)=>new ln.ArrayVecType(20,r[0])],["array32",(...r)=>new ln.ArrayVecType(32,r[0])],["array46",(...r)=>new ln.ArrayVecType(46,r[0])],["array48",(...r)=>new ln.ArrayVecType(48,r[0])],["array64",(...r)=>new ln.ArrayVecType(64,r[0])],["array128",(...r)=>new ln.ArrayVecType(128,r[0])],["array256",(...r)=>new ln.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new xr.U8Type],["u16",new xr.U16Type],["u32",new xr.U32Type],["u64",new xr.U64Type],["U64",new xr.U64Type],["BigUint",new xr.BigUIntType],["i8",new xr.I8Type],["i16",new xr.I16Type],["i32",new xr.I32Type],["i64",new xr.I64Type],["Bigint",new xr.BigIntType],["BigInt",new xr.BigIntType],["bool",new xq.BooleanType],["bytes",new Nq.BytesType],["Address",new Cq.AddressType],["H256",new Pq.H256Type],["utf-8 string",new Rq.StringType],["TokenIdentifier",new xT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new xT.TokenIdentifierType],["CodeMetadata",new Oq.CodeMetadataType],["nothing",new TT.NothingType],["AsyncCall",new TT.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new _T.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass($m.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(CT.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new CT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new $m.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new $m.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new Dq.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new _T.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};fn.TypeMapper=Km});var RT=E(hn=>{"use strict";l();var Bq=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fq=hn&&hn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bq(e,t,r);return Lq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.AbiRegistry=void 0;var NT=Fq(Be()),lc=vr(),fc=Dm(),OT=Fu(),Jm=rT(),DT=Do(),Mq=Ym(),Uq="?",Xm=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||Uq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=e.events||[],a=fc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),u=i.map(y=>fc.EndpointDefinition.fromJSON(y)),c=[];for(let y in s){let m=s[y];if(m.type=="struct")c.push(DT.StructType.fromJSON({name:y,fields:m.fields}));else if(m.type=="enum")c.push(OT.EnumType.fromJSON({name:y,variants:m.variants}));else throw new NT.ErrTypingSystem(`Cannot handle custom type: ${y}`)}let f=o.map(y=>Jm.EventDefinition.fromJSON(y));return new t({name:r,constructorDefinition:a,endpoints:u,customTypes:c,events:f}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return lc.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(DT.StructType.ClassName));return lc.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(OT.EnumType.ClassName));return lc.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return lc.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return lc.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new Mq.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new NT.ErrTypingSystem("Did not re-map all custom types");let n=PT(this.constructorDefinition,e),i=[];for(let a of this.endpoints)i.push(PT(a,e));let s=this.events.map(a=>qq(a,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r,events:s})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(c=>c.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};hn.AbiRegistry=Xm;function PT(t,e){let r=t.input.map(i=>new fc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new fc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new fc.EndpointDefinition(t.name,r,n,t.modifiers)}function qq(t,e){let r=t.inputs.map(n=>new Jm.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new Jm.EventDefinition(t.identifier,r)}});var LT=E($o=>{"use strict";l();Object.defineProperty($o,"__esModule",{value:!0});$o.createListOfTokenIdentifiers=$o.createListOfAddresses=void 0;var Vq=Lo(),BT=Wu(),Hq=Wo();function Gq(t){let e=t.map(n=>new Vq.AddressValue(n));return BT.List.fromItems(e)}$o.createListOfAddresses=Gq;function kq(t){let e=t.map(n=>new Hq.TokenIdentifierValue(n));return BT.List.fromItems(e)}$o.createListOfTokenIdentifiers=kq});var KT=E(Kt=>{"use strict";l();var jq=Kt&&Kt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qq=Kt&&Kt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wq=Kt&&Kt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jq(e,t,r);return Qq(e,t),e};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.onPrimitiveTypeSelect=Kt.onPrimitiveValueSelect=Kt.onTypedValueSelect=Kt.onTypeSelect=void 0;var mh=Wq(Be()),FT=Lo(),MT=Gu(),UT=vi(),qT=Fu(),yh=Wu(),VT=$u(),HT=oc(),GT=Kf(),kT=Do(),jT=Wo(),QT=lh(),WT=_t(),zT=Wf(),$T=ah();function zq(t,e){if(t.hasExactClass(yh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(yh.ListType.ClassName))return e.onList();if(t.hasExactClass(zT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(WT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(kT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(QT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(qT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`type isn't known: ${t}`)}Kt.onTypeSelect=zq;function $q(t,e){if(t.hasClassOrSuperclass(WT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(yh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(yh.List.ClassName))return e.onList();if(t.hasExactClass(zT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(kT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(QT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(qT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`value isn't typed: ${t}`)}Kt.onTypedValueSelect=$q;function Kq(t,e){if(t.hasExactClass(MT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(HT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(FT.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(UT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass($T.StringValue.ClassName))return e.onString();if(t.hasExactClass(VT.H256Value.ClassName))return e.onH256();if(t.hasExactClass(jT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(GT.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Kt.onPrimitiveValueSelect=Kq;function Yq(t,e){if(t.hasExactClass(MT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(HT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(FT.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(UT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass($T.StringType.ClassName))return e.onString();if(t.hasExactClass(VT.H256Type.ClassName))return e.onH256();if(t.hasExactClass(jT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(GT.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Kt.onPrimitiveTypeSelect=Yq});var St=E(qe=>{"use strict";l();var Jq=qe&&qe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jq(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(RT(),qe);it(Lo(),qe);it(Lf(),qe);it(Gu(),qe);it(vi(),qe);it(Vf(),qe);it(Dm(),qe);it(Fu(),qe);it(LT(),qe);it(xo(),qe);it(Wu(),qe);it(Wf(),qe);it($u(),qe);it(KT(),qe);it(Kf(),qe);it(oc(),qe);it(ah(),qe);it(Do(),qe);it(Wo(),qe);it(lh(),qe);it(Bu(),qe);it(Ym(),qe);it(_t(),qe);it(dh(),qe)});var JT=E(dn=>{"use strict";l();var Xq=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zq=dn&&dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eV=dn&&dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xq(e,t,r);return Zq(e,t),e};Object.defineProperty(dn,"__esModule",{value:!0});dn.OptionValueBinaryCodec=void 0;var YT=eV(Be()),wh=St(),Zm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[wh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new YT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[wh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new wh.OptionValue(r);if(e[0]!=1)throw new YT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new wh.OptionValue(r,n)}encodeNested(e){return e.isSet()?d.Buffer.concat([d.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):d.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?d.Buffer.concat([d.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):d.Buffer.from([])}};dn.OptionValueBinaryCodec=Zm});var XT=E(Eh=>{"use strict";l();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.AddressBinaryCodec=void 0;var tV=ht(),rV=St(),ew=class{decodeNested(e){let r=e.slice(0,32),n=new tV.Address(r);return[new rV.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Eh.AddressBinaryCodec=ew});var eC=E(pn=>{"use strict";l();var nV=pn&&pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iV=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sV=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nV(e,t,r);return iV(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.BooleanBinaryCodec=void 0;var oV=sV(Be()),ZT=St(),hc=class t{decodeNested(e){let r=e.readUInt8(0);return[new ZT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new oV.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new ZT.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?d.Buffer.from([t.TRUE]):d.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?d.Buffer.from([t.TRUE]):d.Buffer.from([])}};pn.BooleanBinaryCodec=hc;hc.TRUE=1;hc.FALSE=0});var Ah=E(vh=>{"use strict";l();Object.defineProperty(vh,"__esModule",{value:!0});vh.SizeOfU32=void 0;vh.SizeOfU32=4});var bh=E(gn=>{"use strict";l();var aV=gn&&gn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gn,"__esModule",{value:!0});gn.zeroPadStringIfOddLength=gn.isPaddedHex=gn.numberToPaddedHex=void 0;var uV=aV(kt());function cV(t){let e=new uV.default(t).toString(16);return tC(e)}gn.numberToPaddedHex=cV;function lV(t){t=t||"";let e=d.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}gn.isPaddedHex=lV;function tC(t){return t=t||"",t.length%2==1?"0"+t:t}gn.zeroPadStringIfOddLength=tC});var dc=E(Tt=>{"use strict";l();var fV=Tt&&Tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.prependByteToBuffer=Tt.flipBufferBitsInPlace=Tt.getHexMagnitudeOfBigInt=Tt.bigIntToBuffer=Tt.bufferToBigInt=Tt.cloneBuffer=Tt.isMsbZero=Tt.isMsbOne=void 0;var tw=fV(kt()),hV=bh();function rC(t,e=0){return t[e]>>7==1}Tt.isMsbOne=rC;function dV(t,e=0){return!rC(t,e)}Tt.isMsbZero=dV;function pV(t){let e=d.Buffer.alloc(t.length);return t.copy(e),e}Tt.cloneBuffer=pV;function gV(t){let e=t.toString("hex");return new tw.default(`0x${e}`,16)}Tt.bufferToBigInt=gV;function yV(t){let e=nC(t);return d.Buffer.from(e,"hex")}Tt.bigIntToBuffer=yV;function nC(t){return t=new tw.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new tw.default(-1))),hV.numberToPaddedHex(t)):""}Tt.getHexMagnitudeOfBigInt=nC;function mV(t){for(let e=0;e{"use strict";l();var EV=Ko&&Ko.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.NumericalBinaryCodec=void 0;var pc=EV(kt()),rw=St(),iC=Ah(),wt=dc(),nw=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=iC.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=wt.cloneBuffer(e);if(e.length==0)return new rw.NumericalValue(r,new pc.default(0));if(!r.withSign||wt.isMsbZero(n)){let c=wt.bufferToBigInt(n);return new rw.NumericalValue(r,c)}wt.flipBufferBitsInPlace(n);let u=wt.bufferToBigInt(n).multipliedBy(new pc.default(-1)).minus(new pc.default(1));return new rw.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=d.Buffer.alloc(iC.SizeOfU32);return n.writeUInt32BE(r.length),d.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return d.Buffer.alloc(r,0);if(!e.withSign){let o=wt.bigIntToBuffer(e.value),a=d.Buffer.alloc(r-o.length,0);return d.Buffer.concat([a,o])}if(e.value.isPositive()){let o=wt.bigIntToBuffer(e.value);wt.isMsbOne(o)&&(o=wt.prependByteToBuffer(o,0));let a=d.Buffer.alloc(r-o.length,0);return d.Buffer.concat([a,o])}let n=e.value.plus(new pc.default(1)),i=wt.bigIntToBuffer(n);wt.flipBufferBitsInPlace(i),wt.isMsbZero(i)&&(i=wt.prependByteToBuffer(i,255));let s=d.Buffer.alloc(r-i.length,255);return d.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?d.Buffer.alloc(0):r?this.encodePrimitive(e):wt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=wt.bigIntToBuffer(e.value);return wt.isMsbOne(i)&&(i=wt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new pc.default(1)),n=wt.bigIntToBuffer(r);return wt.flipBufferBitsInPlace(n),wt.isMsbZero(n)&&(n=wt.prependByteToBuffer(n,255)),n}};Ko.NumericalBinaryCodec=nw});var oC=E(Ih=>{"use strict";l();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.H256BinaryCodec=void 0;var vV=$u(),iw=class{decodeNested(e){let r=e.slice(0,32);return[new vV.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Ih.H256BinaryCodec=iw});var Th=E(Sh=>{"use strict";l();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.BytesBinaryCodec=void 0;var aC=vi(),_h=Ah(),sw=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(_h.SizeOfU32,_h.SizeOfU32+r);return[new aC.BytesValue(n),_h.SizeOfU32+r]}decodeTopLevel(e){return new aC.BytesValue(e)}encodeNested(e){let r=d.Buffer.alloc(_h.SizeOfU32);return r.writeUInt32BE(e.getLength()),d.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Sh.BytesBinaryCodec=sw});var cC=E(Ch=>{"use strict";l();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.TokenIdentifierCodec=void 0;var AV=vi(),uC=Wo(),bV=Th(),ow=class{constructor(){this.bytesCodec=new bV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new uC.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new uC.TokenIdentifierValue(r.toString())}encodeNested(e){let r=AV.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return d.Buffer.from(e.valueOf())}};Ch.TokenIdentifierCodec=ow});var fC=E(xh=>{"use strict";l();Object.defineProperty(xh,"__esModule",{value:!0});xh.NothingCodec=void 0;var lC=St(),aw=class{decodeNested(){return[new lC.NothingValue,0]}decodeTopLevel(){return new lC.NothingValue}encodeNested(){return d.Buffer.from([])}encodeTopLevel(){return d.Buffer.from([])}};xh.NothingCodec=aw});var dC=E(Nh=>{"use strict";l();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.StringBinaryCodec=void 0;var hC=St(),IV=vi(),_V=Th(),uw=class{constructor(){this.bytesBinaryCodec=new _V.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new hC.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new hC.StringValue(e.toString())}encodeNested(e){let r=IV.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return d.Buffer.from(e.valueOf())}};Nh.StringBinaryCodec=uw});var pC=E(Dh=>{"use strict";l();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.PrimitiveBinaryCodec=void 0;var Oh=St(),SV=XT(),TV=eC(),CV=sC(),xV=oC(),NV=Th(),OV=cC(),DV=fC(),PV=dC(),cw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new TV.BooleanBinaryCodec,this.numericalCodec=new CV.NumericalBinaryCodec,this.addressCodec=new SV.AddressBinaryCodec,this.h256Codec=new xV.H256BinaryCodec,this.bytesCodec=new NV.BytesBinaryCodec,this.stringCodec=new PV.StringBinaryCodec,this.tokenIdentifierCodec=new OV.TokenIdentifierCodec,this.nothingCodec=new DV.NothingCodec}decodeNested(e,r){return Oh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return Oh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return Oh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return Oh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};Dh.PrimitiveBinaryCodec=cw});var mC=E(Ph=>{"use strict";l();Object.defineProperty(Ph,"__esModule",{value:!0});Ph.ListBinaryCodec=void 0;var gC=St(),yC=Ah(),lw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=yC.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new gC.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=d.Buffer.alloc(yC.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return d.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return d.Buffer.concat(r)}};Ph.ListBinaryCodec=lw});var hw=E(Rh=>{"use strict";l();Object.defineProperty(Rh,"__esModule",{value:!0});Rh.FieldsBinaryCodec=void 0;var RV=St(),fw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new RV.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return d.Buffer.concat(r)}};Rh.FieldsBinaryCodec=fw});var pw=E(Bh=>{"use strict";l();Object.defineProperty(Bh,"__esModule",{value:!0});Bh.StructBinaryCodec=void 0;var BV=St(),LV=hw(),dw=class{constructor(e){this.fieldsCodec=new LV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new BV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Bh.StructBinaryCodec=dw});var wC=E(Fh=>{"use strict";l();Object.defineProperty(Fh,"__esModule",{value:!0});Fh.EnumBinaryCodec=void 0;var Lh=St(),FV=hw(),gw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new FV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Lh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Lh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Lh.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return d.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Lh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return d.Buffer.concat([o,i])}};Fh.EnumBinaryCodec=gw});var EC=E(Mh=>{"use strict";l();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.TupleBinaryCodec=void 0;var MV=pw(),yw=class{constructor(e){this.structCodec=new MV.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Mh.TupleBinaryCodec=yw});var vC=E(Uh=>{"use strict";l();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.ArrayVecBinaryCodec=void 0;var UV=St(),mw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";l();var qV=Nr&&Nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HV=Nr&&Nr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qV(e,t,r);return VV(e,t),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.BinaryCodecConstraints=Nr.BinaryCodec=void 0;var AC=HV(Be()),qh=St(),bC=vr(),GV=JT(),kV=pC(),jV=mC(),QV=pw(),WV=wC(),zV=EC(),$V=vC(),ww=class{constructor(e=null){this.constraints=e||new Vh,this.optionCodec=new GV.OptionValueBinaryCodec(this),this.listCodec=new jV.ListBinaryCodec(this),this.arrayCodec=new $V.ArrayVecBinaryCodec(this),this.primitiveCodec=new kV.PrimitiveBinaryCodec(this),this.structCodec=new QV.StructBinaryCodec(this),this.tupleCodec=new zV.TupleBinaryCodec(this),this.enumCodec=new WV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),qh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=qh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return bC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return bC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};Nr.BinaryCodec=ww;var Vh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new AC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new AC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Nr.BinaryCodecConstraints=Vh});var IC=E(Or=>{"use strict";l();var KV=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var YV=KV(kt()),Hh=St(),JV=Ew(),Gh=new JV.BinaryCodec;function XV(t){let e=Gh.decodeTopLevel(t,new Hh.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=XV;function ZV(t){return!!Gh.decodeTopLevel(t,new Hh.BooleanType).valueOf()}Or.decodeBool=ZV;function eH(t){let e=Gh.decodeTopLevel(t,new Hh.BytesType);return String(e.valueOf())}Or.decodeString=eH;function tH(t){let e=Gh.decodeTopLevel(t,new Hh.BigUIntType);return new YV.default(e.valueOf())}Or.decodeBigNumber=tH});var vw=E(Ii=>{"use strict";l();var rH=Ii&&Ii.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_C=Ii&&Ii.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rH(e,t,r)};Object.defineProperty(Ii,"__esModule",{value:!0});_C(Ew(),Ii);_C(IC(),Ii)});var Yo=E(kh=>{"use strict";l();Object.defineProperty(kh,"__esModule",{value:!0});kh.ArgSerializer=void 0;var SC=Ss(),nH=vw(),TC=St(),Aw=Lf(),bw=Vf(),Iw=dh(),iH={codec:new nH.BinaryCodec},_w=class{constructor(e){e=Object.assign(Object.assign({},iH),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(SC.ARGUMENTS_SEPARATOR).map(r=>d.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let h=0;h=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(SC.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(Aw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(Iw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(bw.CompositeValue.ClassName)){let u=o;for(let c of u.getItems())i(c);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new TC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};kh.ArgSerializer=_w});var Wh=E(Qh=>{"use strict";l();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.Compatibility=void 0;var sH=ht(),jh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==sH.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};Qh.Compatibility=jh;jh.areWarningsEnabled=!0});var CC=E(yn=>{"use strict";l();var oH=yn&&yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aH=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uH=yn&&yn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oH(e,t,r);return aH(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.Hash=void 0;var cH=uH(Be()),Sw=class t{constructor(e){if(!e)this.hash=d.Buffer.from([]);else if(e instanceof d.Buffer)this.hash=e;else if(typeof e=="string")this.hash=d.Buffer.from(e,"hex");else throw new cH.ErrBadType("hash","buffer | string",e)}static empty(){return new t(d.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};yn.Hash=Sw});var gc=E(Dr=>{"use strict";l();var lH=Dr&&Dr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hH=Dr&&Dr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lH(e,t,r);return fH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionOptions=Dr.TransactionVersion=void 0;var Wr=Ss(),xC=hH(Be()),Tw=class t{constructor(e){if(e=Number(e),e<1)throw new xC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Wr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Wr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Dr.TransactionVersion=Tw;var Cw=class t{constructor(e){if(e=Number(e),e<0)throw new xC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Wr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Wr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_GUARDED)==Wr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Wr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dr.TransactionOptions=Cw});var OC=E((Bae,NC)=>{"use strict";l();NC.exports=dH;function dH(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";l();var zh=RC;zh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Jo=new Array(64),PC=new Array(123);for(zr=0;zr<64;)PC[Jo[zr]=zr<26?zr+65:zr<52?zr+71:zr<62?zr-4:zr-59|43]=zr++;var zr;zh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=Jo[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=Jo[u|c>>6],s[o++]=Jo[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Jo[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var DC="invalid encoding";zh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=PC[u])===void 0)throw Error(DC);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(DC);return n-i};zh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var FC=E((Uae,LC)=>{"use strict";l();LC.exports=$h;function $h(){this._listeners={}}$h.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};$h.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";l();GC.exports=MC(MC);function MC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(u,c,f){e[0]=u,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],e[0]}function a(u,c){return r[3]=u[c],r[2]=u[c+1],r[1]=u[c+2],r[0]=u[c+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,UC),t.writeFloatBE=e.bind(null,qC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}t.readFloatLE=r.bind(null,VC),t.readFloatBE=r.bind(null,HC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(u,c,f){e[0]=u,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],r[4]=u[c+4],r[5]=u[c+5],r[6]=u[c+6],r[7]=u[c+7],e[0]}function a(u,c){return r[7]=u[c],r[6]=u[c+1],r[5]=u[c+2],r[4]=u[c+3],r[3]=u[c+4],r[2]=u[c+5],r[1]=u[c+6],r[0]=u[c+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((c<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((c<<31|f/4294967296)>>>0,a,u+s);else{var h=Math.floor(Math.log(o)/Math.LN2);h===1024&&(h=1023),f=o*Math.pow(2,-h),n(f*4503599627370496>>>0,a,u+i),n((c<<31|h+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,UC,0,4),t.writeDoubleBE=e.bind(null,qC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),f=(c>>31)*2+1,h=c>>>20&2047,g=4294967296*(c&1048575)+u;return h===2047?g?NaN:f*(1/0):h===0?f*5e-324*g:f*Math.pow(2,h-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,VC,0,4),t.readDoubleBE=r.bind(null,HC,4,0)}(),t}function UC(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function qC(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function VC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function HC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var jC=E((exports,module)=>{"use strict";l();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var WC=E(QC=>{"use strict";l();var xw=QC;xw.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};xw.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var $C=E((Qae,zC)=>{"use strict";l();zC.exports=pH;function pH(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var YC=E((zae,KC)=>{"use strict";l();KC.exports=Ft;var yc=Si();function Ft(t,e){this.lo=t>>>0,this.hi=e>>>0}var Ds=Ft.zero=new Ft(0,0);Ds.toNumber=function(){return 0};Ds.zzEncode=Ds.zzDecode=function(){return this};Ds.length=function(){return 1};var gH=Ft.zeroHash="\0\0\0\0\0\0\0\0";Ft.fromNumber=function(e){if(e===0)return Ds;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Ft(n,i)};Ft.from=function(e){if(typeof e=="number")return Ft.fromNumber(e);if(yc.isString(e))if(yc.Long)e=yc.Long.fromString(e);else return Ft.fromNumber(parseInt(e,10));return e.low||e.high?new Ft(e.low>>>0,e.high>>>0):Ds};Ft.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Ft.prototype.toLong=function(e){return yc.Long?new yc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var _i=String.prototype.charCodeAt;Ft.fromHash=function(e){return e===gH?Ds:new Ft((_i.call(e,0)|_i.call(e,1)<<8|_i.call(e,2)<<16|_i.call(e,3)<<24)>>>0,(_i.call(e,4)|_i.call(e,5)<<8|_i.call(e,6)<<16|_i.call(e,7)<<24)>>>0)};Ft.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Ft.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Ft.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Ft.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Si=E(Nw=>{"use strict";l();var Ee=Nw;Ee.asPromise=OC();Ee.base64=BC();Ee.EventEmitter=FC();Ee.float=kC();Ee.inquire=jC();Ee.utf8=WC();Ee.pool=$C();Ee.LongBits=YC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Nw;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function JC(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";l();rx.exports=Fe;var Pr=Si(),Ow,Kh=Pr.LongBits,ZC=Pr.base64,ex=Pr.utf8;function mc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Pw(){}function yH(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Fe(){this.len=0,this.head=new mc(Pw,0,0),this.tail=this.head,this.states=null}var tx=function(){return Pr.Buffer?function(){return(Fe.create=function(){return new Ow})()}:function(){return new Fe}};Fe.create=tx();Fe.alloc=function(e){return new Pr.Array(e)};Pr.Array!==Array&&(Fe.alloc=Pr.pool(Fe.alloc,Pr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new mc(e,r,n),this.len+=r,this};function Rw(t,e,r){e[r]=t&255}function mH(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Bw(t,e){this.len=t,this.next=void 0,this.val=e}Bw.prototype=Object.create(mc.prototype);Bw.prototype.fn=mH;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Bw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Fe.prototype.int32=function(e){return e<0?this._push(Lw,10,Kh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Lw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Fe.prototype.uint64=function(e){var r=Kh.from(e);return this._push(Lw,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Kh.from(e).zzEncode();return this._push(Lw,r.length(),r)};Fe.prototype.bool=function(e){return this._push(Rw,1,e?1:0)};function Dw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Fe.prototype.fixed32=function(e){return this._push(Dw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Kh.from(e);return this._push(Dw,4,r.lo)._push(Dw,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(Pr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(Pr.float.writeDoubleLE,8,e)};var wH=Pr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Rw,1,0);if(Pr.isString(e)){var n=Fe.alloc(r=ZC.length(e));ZC.decode(e,n,0),e=n}return this.uint32(r)._push(wH,r,e)};Fe.prototype.string=function(e){var r=ex.length(e);return r?this.uint32(r)._push(ex.write,r,e):this._push(Rw,1,0)};Fe.prototype.fork=function(){return this.states=new yH(this),this.head=this.tail=new mc(Pw,0,0),this.len=0,this};Fe.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new mc(Pw,0,0),this.len=0),this};Fe.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Fe.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Fe._configure=function(t){Ow=t,Fe.create=tx(),Ow._configure()}});var sx=E((Zae,ix)=>{"use strict";l();ix.exports=mn;var nx=Fw();(mn.prototype=Object.create(nx.prototype)).constructor=mn;var Ti=Si();function mn(){nx.call(this)}mn._configure=function(){mn.alloc=Ti._Buffer_allocUnsafe,mn.writeBytesBuffer=Ti.Buffer&&Ti.Buffer.prototype instanceof Uint8Array&&Ti.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(mn.writeBytesBuffer,r,e),this};function EH(t,e,r){t.length<40?Ti.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}mn.prototype.string=function(e){var r=Ti.Buffer.byteLength(e);return this.uint32(r),r&&this._push(EH,r,e),this};mn._configure()});var qw=E((tue,lx)=>{"use strict";l();lx.exports=Et;var wn=Si(),Uw,ux=wn.LongBits,vH=wn.utf8;function $r(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Et(t){this.buf=t,this.pos=0,this.len=t.length}var ox=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Et(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Et(e);throw Error("illegal buffer")},cx=function(){return wn.Buffer?function(r){return(Et.create=function(i){return wn.Buffer.isBuffer(i)?new Uw(i):ox(i)})(r)}:ox};Et.create=cx();Et.prototype._slice=wn.Array.prototype.subarray||wn.Array.prototype.slice;Et.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,$r(this,10);return e}}();Et.prototype.int32=function(){return this.uint32()|0};Et.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Mw(){var t=new ux(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Et.prototype.bool=function(){return this.uint32()!==0};function Yh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Et.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Yh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Yh(this.buf,this.pos+=4)|0};function ax(){if(this.pos+8>this.len)throw $r(this,8);return new ux(Yh(this.buf,this.pos+=4),Yh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=wn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=wn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Et.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};Et.prototype.string=function(){var e=this.bytes();return vH.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw $r(this,e);this.pos+=e}else do if(this.pos>=this.len)throw $r(this);while(this.buf[this.pos++]&128);return this};Et.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Et._configure=function(t){Uw=t,Et.create=cx(),Uw._configure();var e=wn.Long?"toLong":"toNumber";wn.merge(Et.prototype,{int64:function(){return Mw.call(this)[e](!1)},uint64:function(){return Mw.call(this)[e](!0)},sint64:function(){return Mw.call(this).zzDecode()[e](!1)},fixed64:function(){return ax.call(this)[e](!0)},sfixed64:function(){return ax.call(this)[e](!1)}})}});var px=E((nue,dx)=>{"use strict";l();dx.exports=Ps;var hx=qw();(Ps.prototype=Object.create(hx.prototype)).constructor=Ps;var fx=Si();function Ps(t){hx.call(this,t)}Ps._configure=function(){fx.Buffer&&(Ps.prototype._slice=fx.Buffer.prototype.slice)};Ps.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Ps._configure()});var yx=E((sue,gx)=>{"use strict";l();gx.exports=wc;var Vw=Si();(wc.prototype=Object.create(Vw.EventEmitter.prototype)).constructor=wc;function wc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Vw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}wc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Vw.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};wc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var wx=E(mx=>{"use strict";l();var AH=mx;AH.Service=yx()});var vx=E((cue,Ex)=>{"use strict";l();Ex.exports={}});var Ix=E(bx=>{"use strict";l();var hr=bx;hr.build="minimal";hr.Writer=Fw();hr.BufferWriter=sx();hr.Reader=qw();hr.BufferReader=px();hr.util=Si();hr.rpc=wx();hr.roots=vx();hr.configure=Ax;function Ax(){hr.util._configure(),hr.Writer._configure(hr.BufferWriter),hr.Reader._configure(hr.BufferReader)}Ax()});var Sx=E((due,_x)=>{"use strict";l();_x.exports=Ix()});var Cx=E((gue,Tx)=>{"use strict";l();var Xo=Sx(),Jh=Xo.Reader,bH=Xo.Writer,X=Xo.util,Ec=Xo.roots.default||(Xo.roots.default={});Ec.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof Jh||(n=new Jh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!X.isInteger(n.Nonce)&&!(n.Nonce&&X.isInteger(n.Nonce.low)&&X.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||X.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||X.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||X.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||X.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||X.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!X.isInteger(n.GasPrice)&&!(n.GasPrice&&X.isInteger(n.GasPrice.low)&&X.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!X.isInteger(n.GasLimit)&&!(n.GasLimit&&X.isInteger(n.GasLimit.low)&&X.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||X.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||X.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!X.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||X.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!X.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||X.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||X.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Ec.proto.Transaction)return n;var i=new Ec.proto.Transaction;return n.Nonce!=null&&(X.Long?(i.Nonce=X.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?X.base64.decode(n.Value,i.Value=X.newBuffer(X.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?X.base64.decode(n.RcvAddr,i.RcvAddr=X.newBuffer(X.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?X.base64.decode(n.RcvUserName,i.RcvUserName=X.newBuffer(X.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?X.base64.decode(n.SndAddr,i.SndAddr=X.newBuffer(X.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?X.base64.decode(n.SndUserName,i.SndUserName=X.newBuffer(X.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(X.Long?(i.GasPrice=X.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(X.Long?(i.GasLimit=X.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?X.base64.decode(n.Data,i.Data=X.newBuffer(X.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?X.base64.decode(n.ChainID,i.ChainID=X.newBuffer(X.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?X.base64.decode(n.Signature,i.Signature=X.newBuffer(X.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?X.base64.decode(n.GuardAddr,i.GuardAddr=X.newBuffer(X.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?X.base64.decode(n.GuardSignature,i.GuardSignature=X.newBuffer(X.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(X.Long){var o=new X.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=X.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=X.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=X.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=X.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=X.newBuffer(s.SndUserName))),X.Long){var o=new X.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(X.Long){var o=new X.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=X.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=X.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=X.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=X.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=X.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?X.Long.prototype.toString.call(n.Nonce):i.longs===Number?new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?X.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?X.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?X.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?X.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?X.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?X.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?X.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?X.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?X.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?X.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?X.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?X.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Xo.util.toJSONOptions)},e}(),t}();Tx.exports=Ec});var xx=E(Rr=>{"use strict";l();var IH=Rr&&Rr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_H=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SH=Rr&&Rr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IH(e,t,r);return _H(e,t),e},TH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var CH=TH(kt()),Hw=ht(),xH=Ss(),NH=SH(Be()),OH=dc(),Gw=class{serializeTransaction(e){let r=Cx().proto,n=new Hw.Address(e.getReceiver().bech32()).pubkey(),i=new Hw.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:e.getReceiverUsername()?d.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?d.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:d.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==xH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Hw.Address(u.bech32()).pubkey(),s.GuardSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return d.Buffer.from(o)}serializeTransactionValue(e){let r=new CH.default(e.toString());if(r.isZero())return d.Buffer.from([0,0]);let n=OH.bigIntToBuffer(r);return n=d.Buffer.concat([d.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new NH.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=Gw});var Nx=E(Rs=>{"use strict";l();var DH=Rs&&Rs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PH=Rs&&Rs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DH(e,t,r)};Object.defineProperty(Rs,"__esModule",{value:!0});PH(xx(),Rs)});var vc=E(Br=>{"use strict";l();var RH=Br&&Br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LH=Br&&Br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RH(e,t,r);return BH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.interpretSignatureAsBuffer=Br.Signature=void 0;var Ox=LH(Be()),Dx=64,kw=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof d.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new Ox.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return d.Buffer.from(e,"hex").length==Dx}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Dx)throw new Ox.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Br.Signature=kw;function FH(t){if(ArrayBuffer.isView(t))return d.Buffer.from(t);if(t.hex!=null)return d.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Br.interpretSignatureAsBuffer=FH});var zn=E(Xh=>{"use strict";l();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.TransactionPayload=void 0;var jw=class t{constructor(e){this.data=d.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=d.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>d.Buffer.from(e,"hex"))}length(){return d.Buffer.from(this.data).length}};Xh.TransactionPayload=jw});var Qw=E((Sue,Px)=>{l();$n.notEqual=UH;$n.notOk=qH;$n.equal=MH;$n.ok=$n;Px.exports=$n;function MH(t,e,r){$n(t==e,r)}function UH(t,e,r){$n(t!=e,r)}function qH(t,e){$n(!t,e)}function $n(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ls=E(ra=>{"use strict";l();var Ww=P0(),ea=B0(),Rx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ra.Buffer=z;ra.SlowBuffer=QH;ra.INSPECT_MAX_BYTES=50;var Zh=2147483647;ra.kMaxLength=Zh;z.TYPED_ARRAY_SUPPORT=VH();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function VH(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function Kn(t){if(t>Zh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Yw(t)}return Mx(t,e,r)}z.poolSize=8192;function Mx(t,e,r){if(typeof t=="string")return GH(t,e);if(ArrayBuffer.isView(t))return kH(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(En(t,ArrayBuffer)||t&&En(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(En(t,SharedArrayBuffer)||t&&En(t.buffer,SharedArrayBuffer)))return $w(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=jH(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return Mx(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function Ux(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function HH(t,e,r){return Ux(t),t<=0?Kn(t):e!==void 0?typeof r=="string"?Kn(t).fill(e,r):Kn(t).fill(e):Kn(t)}z.alloc=function(t,e,r){return HH(t,e,r)};function Yw(t){return Ux(t),Kn(t<0?0:Jw(t)|0)}z.allocUnsafe=function(t){return Yw(t)};z.allocUnsafeSlow=function(t){return Yw(t)};function GH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=qx(t,e)|0,n=Kn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function zw(t){let e=t.length<0?0:Jw(t.length)|0,r=Kn(e);for(let n=0;n=Zh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zh.toString(16)+" bytes");return t|0}function QH(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(En(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),En(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function qx(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||En(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Kw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return $x(t).length;default:if(i)return n?-1:Kw(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=qx;function WH(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return rG(this,e,r);case"utf8":case"utf-8":return Hx(this,e,r);case"ascii":return eG(this,e,r);case"latin1":case"binary":return tG(this,e,r);case"base64":return XH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nG(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Bs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};Rx&&(z.prototype[Rx]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(En(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n);for(let h=0;h2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Zw(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:Bx(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Bx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Bx(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,h){return s===1?f[h]:f.readUInt16BE(h*s)}let c;if(i){let f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){let f=!0;for(let h=0;hi&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return zH(this,e,r,n);case"utf8":case"utf-8":return $H(this,e,r,n);case"ascii":case"latin1":case"binary":return KH(this,e,r,n);case"base64":return YH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return JH(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function XH(t,e,r){return e===0&&r===t.length?Ww.fromByteArray(t):Ww.fromByteArray(t.slice(e,r))}function Hx(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,c,f,h;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(h=(s&31)<<6|u&63,h>127&&(o=h));break;case 3:u=t[i+1],c=t[i+2],(u&192)===128&&(c&192)===128&&(h=(s&15)<<12|(u&63)<<6|c&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(h=(s&15)<<18|(u&63)<<12|(c&63)<<6|f&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return ZH(n)}var Lx=4096;function ZH(t){let e=t.length;if(e<=Lx)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Mt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Mt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Mt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Ci(function(e){e=e>>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Mt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Mt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Mt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Mt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Ci(function(e){e=e>>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Mt(e,4,this.length),ea.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),ea.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Mt(e,8,this.length),ea.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Mt(e,8,this.length),ea.read(this,e,!1,52,8)};function dr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;dr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;dr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Gx(t,e,r,n,i){zx(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function kx(t,e,r,n,i){zx(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Ci(function(e,r=0){return Gx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Ci(function(e,r=0){return kx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);dr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);dr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=Ci(function(e,r=0){return Gx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Ci(function(e,r=0){return kx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function jx(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Qx(t,e,r,n,i){return e=+e,r=r>>>0,i||jx(t,e,r,4,34028234663852886e22,-34028234663852886e22),ea.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return Qx(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return Qx(this,e,r,!1,n)};function Wx(t,e,r,n,i){return e=+e,r=r>>>0,i||jx(t,e,r,8,17976931348623157e292,-17976931348623157e292),ea.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return Wx(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return Wx(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=Fx(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Fx(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Fx(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function iG(t,e,r){ta(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Ac(e,t.length-(r+1))}function zx(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Zo.ERR_OUT_OF_RANGE("value",a,t)}iG(n,i,s)}function ta(t,e){if(typeof t!="number")throw new Zo.ERR_INVALID_ARG_TYPE(e,"number",t)}function Ac(t,e,r){throw Math.floor(t)!==t?(ta(t,r),new Zo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Zo.ERR_BUFFER_OUT_OF_BOUNDS:new Zo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var sG=/[^+/0-9A-Za-z-_]/g;function oG(t){if(t=t.split("=")[0],t=t.trim().replace(sG,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Kw(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function aG(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function $x(t){return Ww.toByteArray(oG(t))}function ed(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function En(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Zw(t){return t!==t}var cG=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ci(t){return typeof BigInt>"u"?lG:t}function lG(){throw new Error("BigInt not supported")}});var Yx=E((Oue,Kx)=>{l();Kx.exports=eE;eE.supported=typeof WebAssembly<"u";function eE(t){if(!eE.supported)return null;var e=t&&t.imports,r=fG("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function fG(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(hG)):new(Ls()).Buffer(t,"base64")}function hG(t){return t.charCodeAt(0)}});var nN=E((Bue,An)=>{l();var vn=Qw(),Ke=Yx()(),Yn=64,td=[];An.exports=Lr;var Jx=An.exports.BYTES_MIN=16,Xx=An.exports.BYTES_MAX=64,Pue=An.exports.BYTES=32,Zx=An.exports.KEYBYTES_MIN=16,eN=An.exports.KEYBYTES_MAX=64,Rue=An.exports.KEYBYTES=32,tN=An.exports.SALTBYTES=16,rN=An.exports.PERSONALBYTES=16;function Lr(t,e,r,n,i){if(!(this instanceof Lr))return new Lr(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(vn(t>=Jx,"digestLength must be at least "+Jx+", was given "+t),vn(t<=Xx,"digestLength must be at most "+Xx+", was given "+t),e!=null&&vn(e.length>=Zx,"key must be at least "+Zx+", was given "+e.length),e!=null&&vn(e.length<=eN,"key must be at least "+eN+", was given "+e.length),r!=null&&vn(r.length===tN,"salt must be exactly "+tN+", was given "+r.length),n!=null&&vn(n.length===rN,"personal must be exactly "+rN+", was given "+n.length)),td.length||(td.push(Yn),Yn+=216),this.digestLength=t,this.finalized=!1,this.pointer=td.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,Yn,Yn+e.length),Ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(t){return vn(this.finalized===!1,"Hash instance finalized"),vn(t,"input must be TypedArray or Buffer"),Yn+t.length>Ke.memory.length&&Ke.realloc(Yn+t.length),Ke.memory.set(t,Yn),Ke.exports.blake2b_update(this.pointer,Yn,Yn+t.length),this};Lr.prototype.digest=function(t){if(vn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,td.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return pG(Ke.memory,this.pointer+128,this.digestLength);vn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Oi=Qw(),Ic=nN();function rd(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function iN(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function fN(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function xi(t,e,r,n,i,s){var o=bc[i],a=bc[i+1],u=bc[s],c=bc[s+1];rd(Ce,t,e),iN(Ce,t,o,a);var f=Ce[n]^Ce[t],h=Ce[n+1]^Ce[t+1];Ce[n]=h,Ce[n+1]=f,rd(Ce,r,n),f=Ce[e]^Ce[r],h=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^h<<8,Ce[e+1]=h>>>24^f<<8,rd(Ce,t,e),iN(Ce,t,u,c),f=Ce[n]^Ce[t],h=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^h<<16,Ce[n+1]=h>>>16^f<<16,rd(Ce,r,n),f=Ce[e]^Ce[r],h=Ce[e+1]^Ce[r+1],Ce[e]=h>>>31^f<<1,Ce[e+1]=f>>>31^h<<1}var hN=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),yG=[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],Yt=new Uint8Array(yG.map(function(t){return t*2})),Ce=new Uint32Array(32),bc=new Uint32Array(32);function dN(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=hN[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)bc[r]=fN(t.b,4*r);for(r=0;r<12;r++)xi(0,8,16,24,Yt[r*16+0],Yt[r*16+1]),xi(2,10,18,26,Yt[r*16+2],Yt[r*16+3]),xi(4,12,20,28,Yt[r*16+4],Yt[r*16+5]),xi(6,14,22,30,Yt[r*16+6],Yt[r*16+7]),xi(0,10,20,30,Yt[r*16+8],Yt[r*16+9]),xi(2,12,22,24,Yt[r*16+10],Yt[r*16+11]),xi(4,14,16,26,Yt[r*16+12],Yt[r*16+13]),xi(6,8,18,28,Yt[r*16+14],Yt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ce[r]^Ce[r+16]}var Ni=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function na(t,e,r,n){Ni.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ni[0]=t,e&&(Ni[1]=e.length),Ni[2]=1,Ni[3]=1,r&&Ni.set(r,32),n&&Ni.set(n,48);for(var i=0;i<16;i++)this.h[i]=hN[i]^fN(Ni,i*4);e&&(pN(this,e),this.c=128)}na.prototype.update=function(t){return Oi(t!=null,"input must be Uint8Array or Buffer"),pN(this,t),this};na.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Oi(e.length>=this.outlen,"out must have at least outlen bytes of space"),mG(this,e),t==="hex"?wG(e):e};na.prototype.final=na.prototype.digest;na.ready=function(t){Ic.ready(function(){t()})};function pN(t,e){for(var r=0;r>2]>>8*(r&3);return e}function wG(t){for(var e="",r=0;r=sN,"outlen must be at least "+sN+", was given "+e),Oi(e<=oN,"outlen must be at most "+oN+", was given "+e),r!=null&&Oi(r.length>=aN,"key must be at least "+aN+", was given "+r.length),r!=null&&Oi(r.length<=uN,"key must be at most "+uN+", was given "+r.length),n!=null&&Oi(n.length===cN,"salt must be exactly "+cN+", was given "+n.length),i!=null&&Oi(i.length===lN,"personal must be exactly "+lN+", was given "+i.length)),new gN(e,r,n,i)};pr.exports.ready=function(t){Ic.ready(function(){t()})};pr.exports.WASM_SUPPORTED=Ic.SUPPORTED;pr.exports.WASM_LOADED=!1;var sN=pr.exports.BYTES_MIN=16,oN=pr.exports.BYTES_MAX=64,Fue=pr.exports.BYTES=32,aN=pr.exports.KEYBYTES_MIN=16,uN=pr.exports.KEYBYTES_MAX=64,Mue=pr.exports.KEYBYTES=32,cN=pr.exports.SALTBYTES=16,lN=pr.exports.PERSONALBYTES=16;Ic.ready(function(t){t||(pr.exports.WASM_LOADED=!0,gN=Ic)})});var bn=E(Fr=>{"use strict";l();var vG=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AG=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bG=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vG(e,t,r);return AG(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var ia=kt(),_c=ht(),IG=Wh(),_G=Ss(),SG=bG(Be()),TG=CC(),Jn=gc(),CG=Nx(),nd=vc(),mN=zn(),xG=vr(),NG=yN(),OG=32,tE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:c,chainID:f,version:h,options:g,guardian:y}){this.nonce=e||0,this.value=r?new ia.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||_G.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=c||new mN.TransactionPayload,this.chainID=f,this.version=h?new Jn.TransactionVersion(h.valueOf()):Jn.TransactionVersion.withDefaultVersion(),this.options=g?new Jn.TransactionOptions(g.valueOf()):Jn.TransactionOptions.withDefaultOptions(),this.guardian=y||_c.Address.empty(),this.signature=d.Buffer.from([]),this.guardianSignature=d.Buffer.from([]),this.hash=sa.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new Jn.TransactionVersion(e.valueOf())}getOptions(){return new Jn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new Jn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return xG.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return d.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),senderUsername:this.senderUsername?d.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?d.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return IG.Compatibility.guardAddressIsSetAndNonZero(new _c.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new ia.BigNumber(e.value).toFixed(0),receiver:_c.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?d.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:_c.Address.fromString(e.sender),senderUsername:e.senderUsername?d.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?_c.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new mN.TransactionPayload(d.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Jn.TransactionVersion(e.version),options:e.options!=null?new Jn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new nd.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new nd.Signature(e.guardianSignature)),r}applySignature(e){this.signature=nd.interpretSignatureAsBuffer(e),this.hash=sa.compute(this)}applyGuardianSignature(e){this.guardianSignature=nd.interpretSignatureAsBuffer(e),this.hash=sa.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new SG.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new ia.BigNumber(this.gasPrice.valueOf()),i=new ia.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new ia.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new ia.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Fr.Transaction=tE;var sa=class t extends TG.Hash{constructor(e){super(e)}static compute(e){let n=new CG.ProtoSerializer().serializeTransaction(e),i=NG(OG).update(n).digest("hex");return new t(i)}};Fr.TransactionHash=sa});var sE=E(sd=>{"use strict";l();Object.defineProperty(sd,"__esModule",{value:!0});sd.TransferTransactionsFactory=void 0;var rE=Yo(),Kr=St(),id=bn(),nE=zn(),iE=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new id.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new rE.ArgSerializer().valuesToString([Kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Kr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new nE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new id.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new rE.ArgSerializer().valuesToString([Kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Kr.U64Value(e.tokenTransfer.nonce),new Kr.BigUIntValue(e.tokenTransfer.valueOf()),new Kr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new nE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new id.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new Kr.AddressValue(e.destination),new Kr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Kr.BytesValue.fromUTF8(u.tokenIdentifier),new Kr.U64Value(u.nonce),new Kr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new rE.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new nE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new id.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};sd.TransferTransactionsFactory=iE});var aE=E(Fs=>{"use strict";l();Object.defineProperty(Fs,"__esModule",{value:!0});Fs.GasEstimator=Fs.DefaultGasConfiguration=void 0;Fs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var DG=1e5,wN=8e5,oE=class{constructor(e){this.gasConfiguration=e||Fs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+DG}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+wN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+wN)*r+this.gasConfiguration.gasPerDataByte*e}};Fs.GasEstimator=oE});var oa=E(od=>{"use strict";l();Object.defineProperty(od,"__esModule",{value:!0});od.Account=void 0;var PG=ht(),uE=class{constructor(e){this.address=new PG.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};od.Account=uE});var aa=E(Us=>{"use strict";l();Object.defineProperty(Us,"__esModule",{value:!0});Us.Logger=Us.LogLevel=void 0;var Ms;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(Ms=Us.LogLevel||(Us.LogLevel={}));var ad=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Ms.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Ms.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Ms.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Ms.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Ms.Error||console.error(e,r)}};Us.Logger=ad;ad.logLevel=Ms.Debug});var fE=E(In=>{"use strict";l();var RG=In&&In.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BG=In&&In.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LG=In&&In.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RG(e,t,r);return BG(e,t),e};Object.defineProperty(In,"__esModule",{value:!0});In.AsyncTimer=void 0;var FG=LG(Be()),MG=Be(),cE=aa(),lE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new FG.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,cE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){cE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new MG.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(cE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};In.AsyncTimer=lE});var ud=E(ua=>{"use strict";l();var Mr=ua&&ua.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(ua,"__esModule",{value:!0});ua.TransactionWatcher=void 0;var hE=fE(),Di=Be(),EN=aa(),Pi=class t{constructor(e,r={}){this.fetcher=new dE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Mr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Di.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Mr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new Di.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Di.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>a.includes(c))},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Di.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>a.includes(c))!=null},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Di.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Mr(this,void 0,void 0,function*(){let n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Di.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Mr(this,void 0,void 0,function*(){let i=new hE.AsyncTimer("watcher:periodic"),s=new hE.AsyncTimer("watcher:patience"),o=new hE.AsyncTimer("watcher:timeout"),a=!1,u,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),c=e(u),c||a)break}catch(f){if(EN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Di.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Di.Err))throw f}}if(c&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!c)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};ua.TransactionWatcher=Pi;Pi.DefaultPollingInterval=6e3;Pi.DefaultTimeout=Pi.DefaultPollingInterval*15;Pi.DefaultPatience=0;Pi.NoopOnStatusReceived=t=>{};var dE=class{constructor(e){this.fetcher=e}getTransaction(e){return Mr(this,void 0,void 0,function*(){return EN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var gE=E(fd=>{"use strict";l();Object.defineProperty(fd,"__esModule",{value:!0});fd.CodeMetadata=void 0;var pE=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=cd.Upgradeable),this.readable&&(e|=cd.Readable),this.payable&&(r|=ld.Payable),this.payableBySc&&(r|=ld.PayableBySc),d.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};fd.CodeMetadata=pE;var cd;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(cd||(cd={}));var ld;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(ld||(ld={}))});var Sc=E(_n=>{"use strict";l();var UG=_n&&_n.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qG=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VG=_n&&_n.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UG(e,t,r);return qG(e,t),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.ContractFunction=void 0;var HG=VG(Be()),yE=class t{constructor(e){if(this.name=e,e==null)throw new HG.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};_n.ContractFunction=yE});var EE=E(Ur=>{"use strict";l();var GG=Ur&&Ur.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kG=Ur&&Ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jG=Ur&&Ur.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GG(e,t,r);return kG(e,t),e},QG=Ur&&Ur.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.InteractionChecker=void 0;var mE=jG(Be()),WG=QG(kt()),wE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new WG.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new mE.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new mE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";l();Object.defineProperty(hd,"__esModule",{value:!0});hd.Query=void 0;var zG=ht(),$G=Yo(),vE=class{constructor(e){this.caller=e.caller||new zG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new $G.ArgSerializer().valuesToStrings(this.args)}};hd.Query=vE});var _E=E(dd=>{"use strict";l();Object.defineProperty(dd,"__esModule",{value:!0});dd.Interaction=void 0;var vN=ht(),KG=Wh(),AE=Ss(),bE=Sc(),YG=EE(),JG=Tc(),ca=St(),IE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new vN.Address,this.sender=new vN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new la([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){KG.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new bE.ContractFunction(AE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new bE.ContractFunction(AE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new bE.ContractFunction(AE.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new JG.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new la([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new la([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new la(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new YG.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};dd.Interaction=IE;var la=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new ca.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ca.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ca.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ca.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ca.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ca.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var AN=E(pd=>{"use strict";l();Object.defineProperty(pd,"__esModule",{value:!0});pd.ArgumentErrorContext=void 0;var XG=Be(),SE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new XG.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) +Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};pd.ArgumentErrorContext=SE});var CE=E(qs=>{"use strict";l();var ZG=qs&&qs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qs,"__esModule",{value:!0});qs.NativeSerializer=void 0;var ek=ZG(kt()),tk=ht(),TE=Be(),rk=bh(),nk=AN(),ve=St(),ik;(function(t){function e(A,_){A=A||[],r(A,_),n(_)&&(A=i(A,_));let N=_.input,I=[];for(let S=0;S0&&_[0].type.getCardinality().isComposite()&&(I=1/0,S=!0);for(let R of _){if(R.type.getCardinality().isSingular())break;N-=1}return{min:N,max:I,variadic:S}}function o(A,_,N){if(A&&A.belongsToTypesystem)return A;if(_ instanceof ve.OptionType)return a(A,_,N);if(_ instanceof ve.OptionalType)return u(A,_,N);if(_ instanceof ve.VariadicType)return c(A,_,N);if(_ instanceof ve.CompositeType)return h(A,_,N);if(_ instanceof ve.TupleType)return g(A,_,N);if(_ instanceof ve.StructType)return y(A,_,N);if(_ instanceof ve.ListType)return f(A,_,N);if(_ instanceof ve.PrimitiveType)return m(A,_,N);if(_ instanceof ve.EnumType)return T(A,_,N);N.throwError(`convertToTypedValue: unhandled type ${_}`)}function a(A,_,N){if(A==null)return ve.OptionValue.newMissing();let I=o(A,_.getFirstTypeParameter(),N);return ve.OptionValue.newProvided(I)}function u(A,_,N){if(A==null)return new ve.OptionalValue(_);let I=o(A,_.getFirstTypeParameter(),N);return new ve.OptionalValue(_,I)}function c(A,_,N){if(_.isCounted)throw new TE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');A==null&&(A=[]),A.map===void 0&&N.convertError(A,"Variadic");let I=A.map(function(S){return o(S,_.getFirstTypeParameter(),N)});return new ve.VariadicValue(_,I)}function f(A,_,N){A.map===void 0&&N.convertError(A,"List");let I=A.map(function(S){return o(S,_.getFirstTypeParameter(),N)});return new ve.List(_,I)}function h(A,_,N){let I=[],S=_.getTypeParameters();N.guardSameLength(A,S);for(let R=0;R{"use strict";l();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.ContractCallPayloadBuilder=Yr.ContractUpgradePayloadBuilder=Yr.ContractDeployPayloadBuilder=Yr.ArwenVirtualMachine=void 0;var DE=zn(),PE=vr(),sk=Yo();Yr.ArwenVirtualMachine="0500";var xE=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){PE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Yr.ArwenVirtualMachine}@${r}`;return n=RE(n,this.arguments),new DE.TransactionPayload(n)}};Yr.ContractDeployPayloadBuilder=xE;var NE=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){PE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=RE(n,this.arguments),new DE.TransactionPayload(n)}};Yr.ContractUpgradePayloadBuilder=NE;var OE=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){PE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=RE(e,this.arguments),new DE.TransactionPayload(e)}};Yr.ContractCallPayloadBuilder=OE;function RE(t,e){let{argumentsString:r,count:n}=new sk.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Xn=E((yce,LE)=>{"use strict";l();var fa=typeof Reflect=="object"?Reflect:null,bN=fa&&typeof fa.apply=="function"?fa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},gd;fa&&typeof fa.ownKeys=="function"?gd=fa.ownKeys:Object.getOwnPropertySymbols?gd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:gd=function(e){return Object.getOwnPropertyNames(e)};function ok(t){console&&console.warn&&console.warn(t)}var _N=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}LE.exports=ke;LE.exports.once=lk;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var IN=10;function yd(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return IN},set:function(t){if(typeof t!="number"||t<0||_N(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");IN=t}});ke.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||_N(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};function SN(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return SN(this)};ke.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")bN(u,this,r);else for(var c=u.length,f=ON(u,c),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,ok(a)}return t}ke.prototype.addListener=function(e,r){return TN(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return TN(this,e,r,!0)};function ak(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function CN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ak.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return yd(r),this.on(e,CN(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return yd(r),this.prependListener(e,CN(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(yd(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():uk(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ke.prototype.off=ke.prototype.removeListener;ke.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function xN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?ck(i):ON(i,i.length)}ke.prototype.listeners=function(e){return xN(this,e,!0)};ke.prototype.rawListeners=function(e){return xN(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):NN.call(t,e)};ke.prototype.listenerCount=NN;function NN(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ke.prototype.eventNames=function(){return this._eventsCount>0?gd(this._events):[]};function ON(t,e){for(var r=new Array(e),n=0;n{l();PN.exports=Xn().EventEmitter});var ME=E(()=>{l()});var UN=E((Ice,MN)=>{"use strict";l();function RN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function BN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return md.alloc(0);for(var n=md.allocUnsafe(r>>>0),i=this.head,s=0;i;)Ek(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=md.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:wk,value:function(r,n){return UE(this,BN(BN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var VE=E((Sce,VN)=>{"use strict";l();function vk(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(qE,this,t)):p.default.nextTick(qE,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(wd,r):(r._writableState.errorEmitted=!0,p.default.nextTick(qN,r,s)):p.default.nextTick(qN,r,s):e?(p.default.nextTick(wd,r),e(s)):p.default.nextTick(wd,r)}),this)}function qN(t,e){qE(t,e),wd(t)}function wd(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Ak(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function qE(t,e){t.emit("error",e)}function bk(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}VN.exports={destroy:vk,undestroy:Ak,errorOrDestroy:bk}});var Vs=E((Cce,kN)=>{"use strict";l();function Ik(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var GN={};function qr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){Ik(o,s);function o(a,u,c){return s.call(this,n(a,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,GN[t]=i}function HN(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function _k(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Sk(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Tk(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}qr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);qr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&_k(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(Sk(t," argument"))i="The ".concat(t," ").concat(n," ").concat(HN(e,"type"));else{var s=Tk(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(HN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);qr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");qr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});qr("ERR_STREAM_PREMATURE_CLOSE","Premature close");qr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});qr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");qr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");qr("ERR_STREAM_WRITE_AFTER_END","write after end");qr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);qr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");kN.exports.codes=GN});var HE=E((Nce,jN)=>{"use strict";l();var Ck=Vs().codes.ERR_INVALID_OPT_VALUE;function xk(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Nk(t,e,r,n){var i=xk(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new Ck(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}jN.exports={getHighWaterMark:Nk}});var ha=E((Dce,GE)=>{l();typeof Object.create=="function"?GE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:GE.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var WN=E((Rce,QN)=>{l();QN.exports=Ok;function Ok(t,e){if(kE("noDeprecation"))return t;var r=!1;function n(){if(!r){if(kE("throwDeprecation"))throw new Error(e);kE("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function kE(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var WE=E((Lce,XN)=>{"use strict";l();XN.exports=dt;function $N(t){var e=this;this.next=null,this.entry=null,this.finish=function(){nj(e,t)}}var da;dt.WritableState=xc;var Dk={deprecate:WN()},KN=FE(),vd=Ls().Buffer,Pk=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Rk(t){return vd.from(t)}function Bk(t){return vd.isBuffer(t)||t instanceof Pk}var QE=VE(),Lk=HE(),Fk=Lk.getHighWaterMark,Ri=Vs().codes,Mk=Ri.ERR_INVALID_ARG_TYPE,Uk=Ri.ERR_METHOD_NOT_IMPLEMENTED,qk=Ri.ERR_MULTIPLE_CALLBACK,Vk=Ri.ERR_STREAM_CANNOT_PIPE,Hk=Ri.ERR_STREAM_DESTROYED,Gk=Ri.ERR_STREAM_NULL_VALUES,kk=Ri.ERR_STREAM_WRITE_AFTER_END,jk=Ri.ERR_UNKNOWN_ENCODING,pa=QE.errorOrDestroy;ha()(dt,KN);function Qk(){}function xc(t,e,r){da=da||Hs(),t=t||{},typeof r!="boolean"&&(r=e instanceof da),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Fk(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){Xk(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new $N(this)}xc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(xc.prototype,"buffer",{get:Dk.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ed;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ed=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return Ed.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof xc}})):Ed=function(e){return e instanceof this};function dt(t){da=da||Hs();var e=this instanceof da;if(!e&&!Ed.call(dt,this))return new dt(t);this._writableState=new xc(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),KN.call(this)}dt.prototype.pipe=function(){pa(this,new Vk)};function Wk(t,e){var r=new kk;pa(t,r),p.default.nextTick(e,r)}function zk(t,e,r,n){var i;return r===null?i=new Gk:typeof r!="string"&&!e.objectMode&&(i=new Mk("chunk",["string","Buffer"],r)),i?(pa(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&Bk(t);return s&&!vd.isBuffer(t)&&(t=Rk(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=Qk),n.ending?Wk(this,r):(s||zk(this,n,t,r))&&(n.pendingcb++,i=Kk(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&YN(this,t))};dt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new jk(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function $k(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=vd.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Kk(t,e,r,n,i,s){if(!r){var o=$k(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";l();var ij=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};eO.exports=Sn;var ZN=KE(),$E=WE();ha()(Sn,ZN);for(zE=ij($E.prototype),Ad=0;Ad{l();var Id=Ls(),Tn=Id.Buffer;function tO(t,e){for(var r in t)e[r]=t[r]}Tn.from&&Tn.alloc&&Tn.allocUnsafe&&Tn.allocUnsafeSlow?rO.exports=Id:(tO(Id,YE),YE.Buffer=Gs);function Gs(t,e,r){return Tn(t,e,r)}Gs.prototype=Object.create(Tn.prototype);tO(Tn,Gs);Gs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Tn(t,e,r)};Gs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Tn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Gs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Tn(t)};Gs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Id.SlowBuffer(t)}});var ZE=E(sO=>{"use strict";l();var XE=nO().Buffer,iO=XE.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function aj(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function uj(t){var e=aj(t);if(typeof e!="string"&&(XE.isEncoding===iO||!iO(t)))throw new Error("Unknown encoding: "+t);return e||t}sO.StringDecoder=Nc;function Nc(t){this.encoding=uj(t);var e;switch(this.encoding){case"utf16le":this.text=pj,this.end=gj,e=4;break;case"utf8":this.fillLast=fj,e=4;break;case"base64":this.text=yj,this.end=mj,e=3;break;default:this.write=wj,this.end=Ej;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=XE.allocUnsafe(e)}Nc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function cj(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function lj(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function fj(t){var e=this.lastTotal-this.lastNeed,r=lj(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function hj(t,e){var r=cj(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function dj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function pj(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function gj(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function yj(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function mj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function wj(t){return t.toString(this.encoding)}function Ej(t){return t&&t.length?this.write(t):""}});var _d=E((Gce,uO)=>{"use strict";l();var oO=Vs().codes.ERR_STREAM_PREMATURE_CLOSE;function vj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";l();var Sd;function Bi(t,e,r){return e=Ij(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ij(t){var e=_j(t,"string");return typeof e=="symbol"?e:String(e)}function _j(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Sj=_d(),Li=Symbol("lastResolve"),ks=Symbol("lastReject"),Oc=Symbol("error"),Td=Symbol("ended"),js=Symbol("lastPromise"),ev=Symbol("handlePromise"),Qs=Symbol("stream");function Fi(t,e){return{value:t,done:e}}function Tj(t){var e=t[Li];if(e!==null){var r=t[Qs].read();r!==null&&(t[js]=null,t[Li]=null,t[ks]=null,e(Fi(r,!1)))}}function Cj(t){p.default.nextTick(Tj,t)}function xj(t,e){return function(r,n){t.then(function(){if(e[Td]){r(Fi(void 0,!0));return}e[ev](r,n)},n)}}var Nj=Object.getPrototypeOf(function(){}),Oj=Object.setPrototypeOf((Sd={get stream(){return this[Qs]},next:function(){var e=this,r=this[Oc];if(r!==null)return Promise.reject(r);if(this[Td])return Promise.resolve(Fi(void 0,!0));if(this[Qs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Oc]?a(e[Oc]):o(Fi(void 0,!0))})});var n=this[js],i;if(n)i=new Promise(xj(n,this));else{var s=this[Qs].read();if(s!==null)return Promise.resolve(Fi(s,!1));i=new Promise(this[ev])}return this[js]=i,i}},Bi(Sd,Symbol.asyncIterator,function(){return this}),Bi(Sd,"return",function(){var e=this;return new Promise(function(r,n){e[Qs].destroy(null,function(i){if(i){n(i);return}r(Fi(void 0,!0))})})}),Sd),Nj),Dj=function(e){var r,n=Object.create(Oj,(r={},Bi(r,Qs,{value:e,writable:!0}),Bi(r,Li,{value:null,writable:!0}),Bi(r,ks,{value:null,writable:!0}),Bi(r,Oc,{value:null,writable:!0}),Bi(r,Td,{value:e._readableState.endEmitted,writable:!0}),Bi(r,ev,{value:function(s,o){var a=n[Qs].read();a?(n[js]=null,n[Li]=null,n[ks]=null,s(Fi(a,!1))):(n[Li]=s,n[ks]=o)},writable:!0}),r));return n[js]=null,Sj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[ks];s!==null&&(n[js]=null,n[Li]=null,n[ks]=null,s(i)),n[Oc]=i;return}var o=n[Li];o!==null&&(n[js]=null,n[Li]=null,n[ks]=null,o(Fi(void 0,!0))),n[Td]=!0}),e.on("readable",Cj.bind(null,n)),n};cO.exports=Dj});var hO=E((Wce,fO)=>{l();fO.exports=function(){throw new Error("Readable.from is not available in the browser")}});var KE=E((Kce,bO)=>{"use strict";l();bO.exports=Me;var ga;Me.ReadableState=yO;var $ce=Xn().EventEmitter,gO=function(e,r){return e.listeners(r).length},Pc=FE(),Cd=Ls().Buffer,Pj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Rj(t){return Cd.from(t)}function Bj(t){return Cd.isBuffer(t)||t instanceof Pj}var tv=ME(),xe;tv&&tv.debuglog?xe=tv.debuglog("stream"):xe=function(){};var Lj=UN(),uv=VE(),Fj=HE(),Mj=Fj.getHighWaterMark,xd=Vs().codes,Uj=xd.ERR_INVALID_ARG_TYPE,qj=xd.ERR_STREAM_PUSH_AFTER_EOF,Vj=xd.ERR_METHOD_NOT_IMPLEMENTED,Hj=xd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ya,rv,nv;ha()(Me,Pc);var Dc=uv.errorOrDestroy,iv=["error","close","destroy","pause","resume"];function Gj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function yO(t,e,r){ga=ga||Hs(),t=t||{},typeof r!="boolean"&&(r=e instanceof ga),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Mj(this,t,"readableHighWaterMark",r),this.buffer=new Lj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(ya||(ya=ZE().StringDecoder),this.decoder=new ya(t.encoding),this.encoding=t.encoding)}function Me(t){if(ga=ga||Hs(),!(this instanceof Me))return new Me(t);var e=this instanceof ga;this._readableState=new yO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Pc.call(this)}Object.defineProperty(Me.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Me.prototype.destroy=uv.destroy;Me.prototype._undestroy=uv.undestroy;Me.prototype._destroy=function(t,e){e(t)};Me.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Cd.from(t,e),e=""),n=!0),mO(this,t,e,!1,n)};Me.prototype.unshift=function(t){return mO(this,t,null,!0,!1)};function mO(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Qj(t,s);else{var o;if(i||(o=kj(s,e)),o)Dc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Cd.prototype&&(e=Rj(e)),n)s.endEmitted?Dc(t,new Hj):sv(t,s,e,!0);else if(s.ended)Dc(t,new qj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?sv(t,s,e,!1):av(t,s)):sv(t,s,e,!1)}else n||(s.reading=!1,av(t,s))}return!s.ended&&(s.length=dO?t=dO:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function pO(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=jj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Me.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ov(this):Nd(this),null;if(t=pO(t,e),t===0&&e.ended)return e.length===0&&ov(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=vO(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&ov(this)),i!==null&&this.emit("data",i),i};function Qj(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Nd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,wO(t)))}}function Nd(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(wO,t))}function wO(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,cv(t)}function av(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Wj,t,e))}function Wj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&AO(n.pipes,t)!==-1)&&!c&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){xe("onerror",O),T(),t.removeListener("error",g),gO(t,"error")===0&&Dc(t,O)}Gj(t,"error",g);function y(){t.removeListener("finish",m),T()}t.once("close",y);function m(){xe("onfinish"),t.removeListener("close",y),T()}t.once("finish",m);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function zj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&gO(t,"data")&&(r.flowing=!0,cv(t))}}Me.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?Nd(this):n.reading||p.default.nextTick($j,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Pc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(EO,this),r};Me.prototype.removeAllListeners=function(t){var e=Pc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(EO,this),e};function EO(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function $j(t){xe("readable nexttick read 0"),t.read(0)}Me.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,Kj(this,t)),t.paused=!1,this};function Kj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(Yj,t,e))}function Yj(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),cv(t),e.flowing&&!e.reading&&t.read(0)}Me.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function cv(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Me.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function ov(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Jj,e,t))}function Jj(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Me.from=function(t,e){return nv===void 0&&(nv=hO()),nv(Me,t,e)});function AO(t,e){for(var r=0,n=t.length;r{"use strict";l();_O.exports=Zn;var Od=Vs().codes,Xj=Od.ERR_METHOD_NOT_IMPLEMENTED,Zj=Od.ERR_MULTIPLE_CALLBACK,e7=Od.ERR_TRANSFORM_ALREADY_TRANSFORMING,t7=Od.ERR_TRANSFORM_WITH_LENGTH_0,Dd=Hs();ha()(Zn,Dd);function r7(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Zj);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";l();TO.exports=Rc;var SO=lv();ha()(Rc,SO);function Rc(t){if(!(this instanceof Rc))return new Rc(t);SO.call(this,t)}Rc.prototype._transform=function(t,e,r){r(null,t)}});var PO=E((tle,DO)=>{"use strict";l();var fv;function i7(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var OO=Vs().codes,s7=OO.ERR_MISSING_ARGS,o7=OO.ERR_STREAM_DESTROYED;function xO(t){if(t)throw t}function a7(t){return t.setHeader&&typeof t.abort=="function"}function u7(t,e,r,n){n=i7(n);var i=!1;t.on("close",function(){i=!0}),fv===void 0&&(fv=_d()),fv(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,a7(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new o7("pipe"))}}}function NO(t){t()}function c7(t,e){return t.pipe(e)}function l7(t){return!t.length||typeof t[t.length-1]!="function"?xO:t.pop()}function f7(){for(var t=arguments.length,e=new Array(t),r=0;r0;return u7(o,u,c,function(f){i||(i=f),f&&s.forEach(NO),!u&&(s.forEach(NO),n(i))})});return e.reduce(c7)}DO.exports=f7});var hv=E((Vr,RO)=>{l();Vr=RO.exports=KE();Vr.Stream=Vr;Vr.Readable=Vr;Vr.Writable=WE();Vr.Duplex=Hs();Vr.Transform=lv();Vr.PassThrough=CO();Vr.finished=_d();Vr.pipeline=PO()});var FO=E((ile,LO)=>{l();var{Transform:h7}=hv();LO.exports=t=>class BO extends h7{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!d.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return d.Buffer.isBuffer(r)||(r=d.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new BO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var qO=E((ole,UO)=>{l();var{Transform:d7}=hv();UO.exports=t=>class MO extends d7{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!d.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return d.Buffer.isBuffer(r)||(r=d.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new MO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var HO=E((ule,VO)=>{l();var p7=FO(),g7=qO();VO.exports=function(t){let e=p7(t),r=g7(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var jO=E(kO=>{l();var GO=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];kO.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],h=t[9]^t[19]^t[29]^t[39]^t[49],g=f^(i<<1|s>>>31),y=h^(s<<1|i>>>31),m=t[0]^g,T=t[1]^y,O=t[10]^g,B=t[11]^y,W=t[20]^g,U=t[21]^y,A=t[30]^g,_=t[31]^y,N=t[40]^g,I=t[41]^y;g=r^(o<<1|a>>>31),y=n^(a<<1|o>>>31);let S=t[2]^g,R=t[3]^y,J=t[12]^g,Q=t[13]^y,V=t[22]^g,k=t[23]^y,K=t[32]^g,ge=t[33]^y,ue=t[42]^g,re=t[43]^y;g=i^(u<<1|c>>>31),y=s^(c<<1|u>>>31);let Y=t[4]^g,se=t[5]^y,te=t[14]^g,ie=t[15]^y,M=t[24]^g,le=t[25]^y,ae=t[34]^g,he=t[35]^y,oe=t[44]^g,ce=t[45]^y;g=o^(f<<1|h>>>31),y=a^(h<<1|f>>>31);let w=t[6]^g,v=t[7]^y,b=t[16]^g,P=t[17]^y,C=t[26]^g,D=t[27]^y,L=t[36]^g,x=t[37]^y,F=t[46]^g,H=t[47]^y;g=u^(r<<1|n>>>31),y=c^(n<<1|r>>>31);let q=t[8]^g,Z=t[9]^y,we=t[18]^g,Ae=t[19]^y,Re=t[28]^g,tt=t[29]^y,lt=t[38]^g,Oe=t[39]^y,Ue=t[48]^g,Ot=t[49]^y,gi=m,vs=T,As=B<<4|O>>>28,ar=O<<4|B>>>28,Gn=W<<3|U>>>29,$t=U<<3|W>>>29,Dt=_<<9|A>>>23,ze=A<<9|_>>>23,ky=N<<18|I>>>14,jy=I<<18|N>>>14,Qy=S<<1|R>>>31,Wy=R<<1|S>>>31,zy=Q<<12|J>>>20,$y=J<<12|Q>>>20,Ky=V<<10|k>>>22,Yy=k<<10|V>>>22,Jy=ge<<13|K>>>19,Xy=K<<13|ge>>>19,Zy=ue<<2|re>>>30,e0=re<<2|ue>>>30,t0=se<<30|Y>>>2,r0=Y<<30|se>>>2,n0=te<<6|ie>>>26,i0=ie<<6|te>>>26,s0=le<<11|M>>>21,o0=M<<11|le>>>21,a0=ae<<15|he>>>17,u0=he<<15|ae>>>17,c0=ce<<29|oe>>>3,l0=oe<<29|ce>>>3,f0=w<<28|v>>>4,h0=v<<28|w>>>4,d0=P<<23|b>>>9,p0=b<<23|P>>>9,g0=C<<25|D>>>7,y0=D<<25|C>>>7,m0=L<<21|x>>>11,w0=x<<21|L>>>11,E0=H<<24|F>>>8,v0=F<<24|H>>>8,A0=q<<27|Z>>>5,b0=Z<<27|q>>>5,I0=we<<20|Ae>>>12,_0=Ae<<20|we>>>12,S0=tt<<7|Re>>>25,T0=Re<<7|tt>>>25,C0=lt<<8|Oe>>>24,x0=Oe<<8|lt>>>24,N0=Ue<<14|Ot>>>18,O0=Ot<<14|Ue>>>18;t[0]=gi^~zy&s0,t[1]=vs^~$y&o0,t[10]=f0^~I0&Gn,t[11]=h0^~_0&$t,t[20]=Qy^~n0&g0,t[21]=Wy^~i0&y0,t[30]=A0^~As&Ky,t[31]=b0^~ar&Yy,t[40]=t0^~d0&S0,t[41]=r0^~p0&T0,t[2]=zy^~s0&m0,t[3]=$y^~o0&w0,t[12]=I0^~Gn&Jy,t[13]=_0^~$t&Xy,t[22]=n0^~g0&C0,t[23]=i0^~y0&x0,t[32]=As^~Ky&a0,t[33]=ar^~Yy&u0,t[42]=d0^~S0&Dt,t[43]=p0^~T0&ze,t[4]=s0^~m0&N0,t[5]=o0^~w0&O0,t[14]=Gn^~Jy&c0,t[15]=$t^~Xy&l0,t[24]=g0^~C0&ky,t[25]=y0^~x0&jy,t[34]=Ky^~a0&E0,t[35]=Yy^~u0&v0,t[44]=S0^~Dt&Zy,t[45]=T0^~ze&e0,t[6]=m0^~N0&gi,t[7]=w0^~O0&vs,t[16]=Jy^~c0&f0,t[17]=Xy^~l0&h0,t[26]=C0^~ky&Qy,t[27]=x0^~jy&Wy,t[36]=a0^~E0&A0,t[37]=u0^~v0&b0,t[46]=Dt^~Zy&t0,t[47]=ze^~e0&r0,t[8]=N0^~gi&zy,t[9]=O0^~vs&$y,t[18]=c0^~f0&I0,t[19]=l0^~h0&_0,t[28]=ky^~Qy&n0,t[29]=jy^~Wy&i0,t[38]=E0^~A0&As,t[39]=v0^~b0&ar,t[48]=Zy^~t0&d0,t[49]=e0^~r0&p0,t[0]^=GO[e*2],t[1]^=GO[e*2+1]}}});var WO=E((hle,QO)=>{l();var Pd=jO();function ma(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}ma.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};ma.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Pd.p1600(this.state),this.count=0);return e};ma.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};QO.exports=ma});var dv=E((ple,zO)=>{l();zO.exports=HO()(WO())});var mv=E(wa=>{"use strict";l();var y7=wa&&wa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wa,"__esModule",{value:!0});wa.SmartContract=void 0;var m7=y7(kt()),Bc=ht(),pv=Wh(),w7=Be(),gv=bn(),E7=vr(),v7=dc(),$O=gE(),KO=Sc(),YO=_E(),A7=CE(),b7=Tc(),Rd=BE(),I7=dv(),yv=class{constructor(e={}){this.address=new Bc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Bc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new KO.ContractFunction(i);return new YO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new KO.ContractFunction(i),a=A7.NativeSerializer.nativeToTypedValues(s||[],n);return new YO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return E7.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){pv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new $O.CodeMetadata,i=i||[],s=s||0;let c=new Rd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new gv.Transaction({receiver:Bc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){pv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new $O.CodeMetadata,i=i||[],s=s||0;let c=new Rd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new gv.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){pv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let c=new Rd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new gv.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:c,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new b7.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new w7.ErrContractHasNoAddress}static computeAddress(e,r){let n=d.Buffer.alloc(8,0),i=new Bc.Address(e.bech32()).pubkey(),s=i.slice(30),o=d.Buffer.alloc(8),a=new m7.default(r.valueOf().toString(10)),u=v7.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let c=d.Buffer.concat([i,o]),f=I7("keccak256").update(c).digest(),h=d.Buffer.from(Rd.ArwenVirtualMachine,"hex"),g=d.Buffer.concat([n,h,f.slice(10,30),s]);return new Bc.Address(g)}};wa.SmartContract=yv});var Bd=E(Ws=>{"use strict";l();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.SignableMessage=Ws.MESSAGE_PREFIX=void 0;var _7=ht(),S7=vc(),T7=dv();Ws.MESSAGE_PREFIX=`Elrond Signed Message: +`;var wv=class{constructor(e){this.message=d.Buffer.from([]),this.signature=d.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new _7.Address,Object.assign(this,e)}serializeForSigning(){let e=d.Buffer.from(this.message.length.toString()),r=d.Buffer.concat([e,this.message]),n=d.Buffer.concat([d.Buffer.from(Ws.MESSAGE_PREFIX),r]);return T7("keccak256").update(n).digest()}serializeForSigningRaw(){return d.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=S7.interpretSignatureAsBuffer(e)}getMessageSize(){let e=d.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};Ws.SignableMessage=wv});var JO=E(Mi=>{"use strict";l();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ErrAccountNotConnected=Mi.ErrCannotSignSingleTransaction=Mi.Err=void 0;var Lc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Mi.Err=Lc;var Ev=class extends Lc{constructor(){super("Cannot sign single transaction.")}};Mi.ErrCannotSignSingleTransaction=Ev;var vv=class extends Lc{constructor(){super("Account is not connected.")}};Mi.ErrAccountNotConnected=vv});var XO=E(Fc=>{"use strict";l();Object.defineProperty(Fc,"__esModule",{value:!0});Fc.Operation=void 0;var C7;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(C7=Fc.Operation||(Fc.Operation={}))});var Av=E(Ea=>{"use strict";l();var Ui=Ea&&Ea.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.ExtensionProvider=void 0;var x7=bn(),ZO=JO(),Mc=XO(),Uc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Ui(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Ui(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Mc.Operation.Connect,n),this.account.address})}logout(){return Ui(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Mc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Ui(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Ui(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Ui(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new ZO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new ZO.ErrAccountNotConnected}signTransactions(e){return Ui(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Mc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>x7.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Ui(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Mc.Operation.SignMessage,r)).signature,s=d.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Mc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};Ea.ExtensionProvider=Uc;Uc._instance=new Uc});function P7(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){R7(t);return}return e}function R7(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function qc(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!D7.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(N7.test(t)||O7.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,P7)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var N7,O7,D7,i2=fe(()=>{l();N7=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,O7=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,D7=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function B7(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Pt(t,...e){try{return B7(t(...e))}catch(r){return Promise.reject(r)}}function L7(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function F7(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Vc(t){if(L7(t))return String(t);if(F7(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Vc(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function s2(){if(typeof d.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function o2(t){if(typeof t=="string")return t;s2();let e=d.Buffer.from(t).toString("base64");return bv+e}function a2(t){return typeof t!="string"||!t.startsWith(bv)?t:(s2(),d.Buffer.from(t.slice(bv.length),"base64"))}function rr(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function u2(...t){return rr(t.join(":"))}function Hc(t){return t=rr(t),t?t+":":""}var bv,c2=fe(()=>{l();bv="base64:"});function h2(t={}){let e={mounts:{"":t.driver||U7()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(h=>h.startsWith(c)||f&&c.startsWith(h)).map(h=>({relativeBase:c.length>h.length?c.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),i=(c,f)=>{if(e.watching){f=rr(f);for(let h of e.watchListeners)h(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await l2(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,f,h)=>{let g=new Map,y=m=>{let T=g.get(m.base);return T||(T={driver:m.driver,base:m.base,items:[]},g.set(m.base,T)),T};for(let m of c){let T=typeof m=="string",O=rr(T?m:m.key),B=T?void 0:m.value,W=T||!m.options?f:{...f,...m.options},U=r(O);y(U).items.push({key:O,value:B,relativeKey:U.relativeKey,options:W})}return Promise.all([...g.values()].map(m=>h(m))).then(m=>m.flat())},u={hasItem(c,f={}){c=rr(c);let{relativeKey:h,driver:g}=r(c);return Pt(g.hasItem,h,f)},getItem(c,f={}){c=rr(c);let{relativeKey:h,driver:g}=r(c);return Pt(g.getItem,h,f).then(y=>qc(y))},getItems(c,f){return a(c,f,h=>h.driver.getItems?Pt(h.driver.getItems,h.items.map(g=>({key:g.relativeKey,options:g.options})),f).then(g=>g.map(y=>({key:u2(h.base,y.key),value:qc(y.value)}))):Promise.all(h.items.map(g=>Pt(h.driver.getItem,g.relativeKey,g.options).then(y=>({key:g.key,value:qc(y)})))))},getItemRaw(c,f={}){c=rr(c);let{relativeKey:h,driver:g}=r(c);return g.getItemRaw?Pt(g.getItemRaw,h,f):Pt(g.getItem,h,f).then(y=>a2(y))},async setItem(c,f,h={}){if(f===void 0)return u.removeItem(c);c=rr(c);let{relativeKey:g,driver:y}=r(c);y.setItem&&(await Pt(y.setItem,g,Vc(f),h),y.watch||i("update",c))},async setItems(c,f){await a(c,f,async h=>{h.driver.setItems&&await Pt(h.driver.setItems,h.items.map(g=>({key:g.relativeKey,value:Vc(g.value),options:g.options})),f),h.driver.setItem&&await Promise.all(h.items.map(g=>Pt(h.driver.setItem,g.relativeKey,Vc(g.value),g.options)))})},async setItemRaw(c,f,h={}){if(f===void 0)return u.removeItem(c,h);c=rr(c);let{relativeKey:g,driver:y}=r(c);if(y.setItemRaw)await Pt(y.setItemRaw,g,f,h);else if(y.setItem)await Pt(y.setItem,g,o2(f),h);else return;y.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=rr(c);let{relativeKey:h,driver:g}=r(c);g.removeItem&&(await Pt(g.removeItem,h,f),(f.removeMeta||f.removeMata)&&await Pt(g.removeItem,h+"$",f),g.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=rr(c);let{relativeKey:h,driver:g}=r(c),y=Object.create(null);if(g.getMeta&&Object.assign(y,await Pt(g.getMeta,h,f)),!f.nativeOnly){let m=await Pt(g.getItem,h+"$",f).then(T=>qc(T));m&&typeof m=="object"&&(typeof m.atime=="string"&&(m.atime=new Date(m.atime)),typeof m.mtime=="string"&&(m.mtime=new Date(m.mtime)),Object.assign(y,m))}return y},setMeta(c,f,h={}){return this.setItem(c+"$",f,h)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=Hc(c);let h=n(c,!0),g=[],y=[];for(let m of h){let O=(await Pt(m.driver.getKeys,m.relativeBase,f)).map(B=>m.mountpoint+rr(B)).filter(B=>!g.some(W=>B.startsWith(W)));y.push(...O),g=[m.mountpoint,...g.filter(B=>!B.startsWith(m.mountpoint))]}return c?y.filter(m=>m.startsWith(c)&&!m.endsWith("$")):y.filter(m=>!m.endsWith("$"))},async clear(c,f={}){c=Hc(c),await Promise.all(n(c,!1).map(async h=>{if(h.driver.clear)return Pt(h.driver.clear,h.relativeBase,f);if(h.driver.removeItem){let g=await h.driver.getKeys(h.relativeBase||"",f);return Promise.all(g.map(y=>h.driver.removeItem(y,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>f2(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=Hc(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((h,g)=>g.length-h.length)),e.mounts[c]=f,e.watching&&Promise.resolve(l2(f,i,c)).then(h=>{e.unwatch[c]=h}).catch(console.error),u},async unmount(c,f=!0){c=Hc(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await f2(e.mounts[c]),e.mountpoints=e.mountpoints.filter(h=>h!==c),delete e.mounts[c])},getMount(c=""){c=rr(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=rr(c),n(c,f.parents).map(g=>({driver:g.driver,base:g.mountpoint}))}};return u}function l2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function f2(t){typeof t.dispose=="function"&&await Pt(t.dispose)}var M7,U7,d2=fe(()=>{l();i2();c2();M7="memory",U7=()=>{let t=new Map;return{name:M7,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function zs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function _v(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=zs(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function Gc(){return Iv||(Iv=_v("keyval-store","keyval")),Iv}function Sv(t,e=Gc()){return e("readonly",r=>zs(r.get(t)))}function p2(t,e,r=Gc()){return r("readwrite",n=>(n.put(e,t),zs(n.transaction)))}function g2(t,e=Gc()){return e("readwrite",r=>(r.delete(t),zs(r.transaction)))}function y2(t=Gc()){return t("readwrite",e=>(e.clear(),zs(e.transaction)))}function q7(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},zs(t.transaction)}function m2(t=Gc()){return t("readonly",e=>{if(e.getAllKeys)return zs(e.getAllKeys());let r=[];return q7(e,n=>r.push(n.key)).then(()=>r)})}var Iv,w2=fe(()=>{l()});var E2={};ct(E2,{safeJsonParse:()=>Vi,safeJsonStringify:()=>Hi});function Vi(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return H7(t)}catch{return t}}function Hi(t){return typeof t=="string"?t:V7(t)||""}var V7,H7,kc=fe(()=>{l();V7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),H7=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var A2={};ct(A2,{KeyValueStorage:()=>Nv,default:()=>Nv});function W7(t){var e;return[t[0],Vi((e=t[1])!=null?e:"")]}var G7,k7,j7,Q7,Cv,Tv,Ud,xv,z7,v2,$7,K7,Nv,b2=fe(()=>{l();d2();w2();kc();G7="idb-keyval",k7=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=_v(t.dbName,t.storeName)),{name:G7,options:t,async hasItem(i){return!(typeof await Sv(r(i),n)>"u")},async getItem(i){return await Sv(r(i),n)??null},setItem(i,s){return p2(r(i),s,n)},removeItem(i){return g2(r(i),n)},getKeys(){return m2(n)},clear(){return y2(n)}}},j7="WALLET_CONNECT_V2_INDEXED_DB",Q7="keyvaluestorage",Cv=class{constructor(){this.indexedDb=h2({driver:k7({dbName:j7,storeName:Q7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Hi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ud={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Tv<"u"&&Tv.localStorage?Ud.exports=Tv.localStorage:typeof window<"u"&&window.localStorage?Ud.exports=window.localStorage:Ud.exports=new e})();xv=class{constructor(){this.localStorage=Ud.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(W7)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Vi(r)}async setItem(e,r){this.localStorage.setItem(e,Hi(r))}async removeItem(e){this.localStorage.removeItem(e)}},z7="wc_storage_version",v2=1,$7=async(t,e,r)=>{let n=z7,i=await e.getItem(n);if(i&&i>=v2){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let a=s.shift();if(!a)continue;let u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){let c=await t.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(n,v2),r(e),K7(t,o)},K7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},Nv=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new xv;this.storage=e;try{let r=new Cv;$7(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var Jr={};ct(Jr,{__assign:()=>Dv,__asyncDelegator:()=>uQ,__asyncGenerator:()=>aQ,__asyncValues:()=>cQ,__await:()=>jc,__awaiter:()=>tQ,__classPrivateFieldGet:()=>dQ,__classPrivateFieldSet:()=>pQ,__createBinding:()=>nQ,__decorate:()=>X7,__exportStar:()=>iQ,__extends:()=>Y7,__generator:()=>rQ,__importDefault:()=>hQ,__importStar:()=>fQ,__makeTemplateObject:()=>lQ,__metadata:()=>eQ,__param:()=>Z7,__read:()=>I2,__rest:()=>J7,__spread:()=>sQ,__spreadArrays:()=>oQ,__values:()=>Pv});function Y7(t,e){Ov(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function J7(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Z7(t,e){return function(r,n){e(r,n,t)}}function eQ(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function tQ(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function rQ(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function sQ(){for(var t=[],e=0;e1||a(g,y)})})}function a(g,y){try{u(n[g](y))}catch(m){h(s[0][3],m)}}function u(g){g.value instanceof jc?Promise.resolve(g.value.v).then(c,f):h(s[0][2],g)}function c(g){a("next",g)}function f(g){a("throw",g)}function h(g,y){g(y),s.shift(),s.length&&a(s[0][0],s[0][1])}}function uQ(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:jc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function cQ(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Pv=="function"?Pv(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}}function lQ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fQ(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function hQ(t){return t&&t.__esModule?t:{default:t}}function dQ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function pQ(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var Ov,Dv,Xr=fe(()=>{l();Ov=function(t,e){return Ov=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ov(t,e)};Dv=function(){return Dv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";l();Object.defineProperty(qd,"__esModule",{value:!0});qd.delay=void 0;function gQ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}qd.delay=gQ});var S2=E(va=>{"use strict";l();Object.defineProperty(va,"__esModule",{value:!0});va.ONE_THOUSAND=va.ONE_HUNDRED=void 0;va.ONE_HUNDRED=100;va.ONE_THOUSAND=1e3});var T2=E(pe=>{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ONE_YEAR=pe.FOUR_WEEKS=pe.THREE_WEEKS=pe.TWO_WEEKS=pe.ONE_WEEK=pe.THIRTY_DAYS=pe.SEVEN_DAYS=pe.FIVE_DAYS=pe.THREE_DAYS=pe.ONE_DAY=pe.TWENTY_FOUR_HOURS=pe.TWELVE_HOURS=pe.SIX_HOURS=pe.THREE_HOURS=pe.ONE_HOUR=pe.SIXTY_MINUTES=pe.THIRTY_MINUTES=pe.TEN_MINUTES=pe.FIVE_MINUTES=pe.ONE_MINUTE=pe.SIXTY_SECONDS=pe.THIRTY_SECONDS=pe.TEN_SECONDS=pe.FIVE_SECONDS=pe.ONE_SECOND=void 0;pe.ONE_SECOND=1;pe.FIVE_SECONDS=5;pe.TEN_SECONDS=10;pe.THIRTY_SECONDS=30;pe.SIXTY_SECONDS=60;pe.ONE_MINUTE=pe.SIXTY_SECONDS;pe.FIVE_MINUTES=pe.ONE_MINUTE*5;pe.TEN_MINUTES=pe.ONE_MINUTE*10;pe.THIRTY_MINUTES=pe.ONE_MINUTE*30;pe.SIXTY_MINUTES=pe.ONE_MINUTE*60;pe.ONE_HOUR=pe.SIXTY_MINUTES;pe.THREE_HOURS=pe.ONE_HOUR*3;pe.SIX_HOURS=pe.ONE_HOUR*6;pe.TWELVE_HOURS=pe.ONE_HOUR*12;pe.TWENTY_FOUR_HOURS=pe.ONE_HOUR*24;pe.ONE_DAY=pe.TWENTY_FOUR_HOURS;pe.THREE_DAYS=pe.ONE_DAY*3;pe.FIVE_DAYS=pe.ONE_DAY*5;pe.SEVEN_DAYS=pe.ONE_DAY*7;pe.THIRTY_DAYS=pe.ONE_DAY*30;pe.ONE_WEEK=pe.SEVEN_DAYS;pe.TWO_WEEKS=pe.ONE_WEEK*2;pe.THREE_WEEKS=pe.ONE_WEEK*3;pe.FOUR_WEEKS=pe.ONE_WEEK*4;pe.ONE_YEAR=pe.ONE_DAY*365});var Rv=E(Vd=>{"use strict";l();Object.defineProperty(Vd,"__esModule",{value:!0});var C2=(Xr(),ft(Jr));C2.__exportStar(S2(),Vd);C2.__exportStar(T2(),Vd)});var N2=E(Aa=>{"use strict";l();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.fromMiliseconds=Aa.toMiliseconds=void 0;var x2=Rv();function yQ(t){return t*x2.ONE_THOUSAND}Aa.toMiliseconds=yQ;function mQ(t){return Math.floor(t/x2.ONE_THOUSAND)}Aa.fromMiliseconds=mQ});var D2=E(Hd=>{"use strict";l();Object.defineProperty(Hd,"__esModule",{value:!0});var O2=(Xr(),ft(Jr));O2.__exportStar(_2(),Hd);O2.__exportStar(N2(),Hd)});var P2=E(Qc=>{"use strict";l();Object.defineProperty(Qc,"__esModule",{value:!0});Qc.Watch=void 0;var Gd=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};Qc.Watch=Gd;Qc.default=Gd});var R2=E(kd=>{"use strict";l();Object.defineProperty(kd,"__esModule",{value:!0});kd.IWatch=void 0;var Bv=class{};kd.IWatch=Bv});var B2=E(Lv=>{"use strict";l();Object.defineProperty(Lv,"__esModule",{value:!0});var wQ=(Xr(),ft(Jr));wQ.__exportStar(R2(),Lv)});var $s=E(ba=>{"use strict";l();Object.defineProperty(ba,"__esModule",{value:!0});var jd=(Xr(),ft(Jr));jd.__exportStar(D2(),ba);jd.__exportStar(P2(),ba);jd.__exportStar(B2(),ba);jd.__exportStar(Rv(),ba)});var Fv,L2=fe(()=>{l();Fv=class{}});var Mv={};ct(Mv,{IEvents:()=>Fv});var Uv=fe(()=>{l();L2()});var F2=E(Qd=>{"use strict";l();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.IHeartBeat=void 0;var EQ=(Uv(),ft(Mv)),qv=class extends EQ.IEvents{constructor(e){super()}};Qd.IHeartBeat=qv});var Hv=E(Vv=>{"use strict";l();Object.defineProperty(Vv,"__esModule",{value:!0});var vQ=(Xr(),ft(Jr));vQ.__exportStar(F2(),Vv)});var M2=E(Ia=>{"use strict";l();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HEARTBEAT_EVENTS=Ia.HEARTBEAT_INTERVAL=void 0;var AQ=$s();Ia.HEARTBEAT_INTERVAL=AQ.FIVE_SECONDS;Ia.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var kv=E(Gv=>{"use strict";l();Object.defineProperty(Gv,"__esModule",{value:!0});var bQ=(Xr(),ft(Jr));bQ.__exportStar(M2(),Gv)});var U2=E(Wd=>{"use strict";l();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.HeartBeat=void 0;var jv=(Xr(),ft(Jr)),IQ=Xn(),_Q=$s(),SQ=Hv(),Qv=kv(),Wv=class t extends SQ.IHeartBeat{constructor(e){super(e),this.events=new IQ.EventEmitter,this.interval=Qv.HEARTBEAT_INTERVAL,this.interval=e?.interval||Qv.HEARTBEAT_INTERVAL}static init(e){return jv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return jv.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return jv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),_Q.toMiliseconds(this.interval))})}pulse(){this.events.emit(Qv.HEARTBEAT_EVENTS.pulse)}};Wd.HeartBeat=Wv});var q2=E(Wc=>{"use strict";l();Object.defineProperty(Wc,"__esModule",{value:!0});var zv=(Xr(),ft(Jr));zv.__exportStar(U2(),Wc);zv.__exportStar(Hv(),Wc);zv.__exportStar(kv(),Wc)});var H2=E((Pfe,V2)=>{"use strict";l();function TQ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}V2.exports=CQ;function CQ(t,e,r){var n=r&&r.stringify||TQ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?h:0,t.charCodeAt(y+1)){case 100:case 102:if(f>=u||e[f]==null)break;h=u||e[f]==null)break;h=u||e[f]===void 0)break;h",h=y+2,y++;break}c+=n(e[f]),h=y+2,y++;break;case 115:if(f>=u)break;h{"use strict";l();var G2=H2();Q2.exports=Cn;var zc=MQ().console||{},xQ={mapHttpRequest:zd,mapHttpResponse:zd,wrapRequestSerializer:$v,wrapResponseSerializer:$v,wrapErrorSerializer:$v,req:zd,res:zd,err:RQ};function NQ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Cn(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||zc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=NQ(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=$c),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:h,set:g});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:BQ(t)};u.levels=Cn.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=$c,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=y,e&&(u._logEvent=Kv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function h(){return this._level}function g(m){if(m!=="silent"&&!this.levels.values[m])throw Error("unknown level "+m);this._level=m,_a(c,u,"error","log"),_a(c,u,"fatal","error"),_a(c,u,"warn","error"),_a(c,u,"info","log"),_a(c,u,"debug","log"),_a(c,u,"trace","log")}function y(m,T){if(!m)throw new Error("missing bindings for child Pino");T=T||{},i&&m.serializers&&(T.serializers=m.serializers);let O=T.serializers;if(i&&O){var B=Object.assign({},n,O),W=t.browser.serialize===!0?Object.keys(B):i;delete m.serializers,$d([m],W,B,this._stdErrSerialize)}function U(A){this._childLevel=(A._childLevel|0)+1,this.error=Sa(A,m,"error"),this.fatal=Sa(A,m,"fatal"),this.warn=Sa(A,m,"warn"),this.info=Sa(A,m,"info"),this.debug=Sa(A,m,"debug"),this.trace=Sa(A,m,"trace"),B&&(this.serializers=B,this._serialize=W),e&&(this._logEvent=Kv([].concat(A._logEvent.bindings,m)))}return U.prototype=this,new U(this)}return u}Cn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Cn.stdSerializers=xQ;Cn.stdTimeFunctions=Object.assign({},{nullTime:k2,epochTime:j2,unixTime:LQ,isoTime:FQ});function _a(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?$c:i[r]?i[r]:zc[r]||zc[n]||$c,OQ(t,e,r)}function OQ(t,e,r){!t.transmit&&e[r]===$c||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===zc?zc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Sa(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";l();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.PINO_CUSTOM_CONTEXT_KEY=Ta.PINO_LOGGER_DEFAULTS=void 0;Ta.PINO_LOGGER_DEFAULTS={level:"info"};Ta.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var J2=E(gr=>{"use strict";l();Object.defineProperty(gr,"__esModule",{value:!0});gr.generateChildLogger=gr.formatChildLoggerContext=gr.getLoggerContext=gr.setBrowserLoggerContext=gr.getBrowserLoggerContext=gr.getDefaultLoggerOptions=void 0;var Ca=Yv();function UQ(t){return Object.assign(Object.assign({},t),{level:t?.level||Ca.PINO_LOGGER_DEFAULTS.level})}gr.getDefaultLoggerOptions=UQ;function z2(t,e=Ca.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}gr.getBrowserLoggerContext=z2;function $2(t,e,r=Ca.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}gr.setBrowserLoggerContext=$2;function K2(t,e=Ca.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=z2(t,e):r=t.bindings().context||"",r}gr.getLoggerContext=K2;function Y2(t,e,r=Ca.PINO_CUSTOM_CONTEXT_KEY){let n=K2(t,r);return n.trim()?`${n}/${e}`:e}gr.formatChildLoggerContext=Y2;function qQ(t,e,r=Ca.PINO_CUSTOM_CONTEXT_KEY){let n=Y2(t,e,r),i=t.child({context:n});return $2(i,n,r)}gr.generateChildLogger=qQ});var Xv=E(xa=>{"use strict";l();Object.defineProperty(xa,"__esModule",{value:!0});xa.pino=void 0;var Jv=(Xr(),ft(Jr)),VQ=Jv.__importDefault(W2());Object.defineProperty(xa,"pino",{enumerable:!0,get:function(){return VQ.default}});Jv.__exportStar(Yv(),xa);Jv.__exportStar(J2(),xa)});var y1=E(Rt=>{"use strict";l();Object.defineProperty(Rt,"__esModule",{value:!0});var Na=(Uv(),ft(Mv)),X2=Xn();function HQ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var GQ=HQ(X2),Zv=class extends Na.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},e1=class{constructor(e,r,n){this.core=e,this.logger=r}},t1=class extends Na.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},r1=class{constructor(e,r){this.logger=e,this.core=r}},n1=class extends Na.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},i1=class extends Na.IEvents{constructor(e){super()}},s1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},o1=class{constructor(){this.map=new Map}},a1=class extends Na.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},u1=class{constructor(e,r){this.core=e,this.logger=r}},c1=class extends Na.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},l1=class{constructor(e,r){this.logger=e,this.core=r}},f1=class{constructor(e,r){this.projectId=e,this.logger=r}},h1=class extends GQ.default{constructor(){super()}},d1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},p1=class extends X2.EventEmitter{constructor(){super()}},g1=class{constructor(e){this.client=e}};Rt.ICore=Zv,Rt.ICrypto=e1,Rt.IEngine=g1,Rt.IEngineEvents=p1,Rt.IExpirer=c1,Rt.IJsonRpcHistory=t1,Rt.IKeyChain=u1,Rt.IMessageTracker=r1,Rt.IPairing=l1,Rt.IPublisher=n1,Rt.IRelayer=i1,Rt.ISignClient=d1,Rt.ISignClientEvents=h1,Rt.IStore=s1,Rt.ISubscriber=a1,Rt.ISubscriberTopicMap=o1,Rt.IVerify=f1});var eD=E(Kd=>{"use strict";l();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.BrowserRandomSource=void 0;var Z2=65536,m1=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";l();Object.defineProperty(w1,"__esModule",{value:!0});function kQ(t){for(var e=0;e{l()});var rD=E(Yd=>{"use strict";l();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.NodeRandomSource=void 0;var jQ=Hr(),E1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof hS<"u"){let e=tD();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";l();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.SystemRandomSource=void 0;var QQ=eD(),WQ=rD(),v1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new QQ.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new WQ.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};Jd.SystemRandomSource=v1});var iD=E(Ar=>{"use strict";l();Object.defineProperty(Ar,"__esModule",{value:!0});function zQ(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}Ar.mul=Math.imul||zQ;function $Q(t,e){return t+e|0}Ar.add=$Q;function KQ(t,e){return t-e|0}Ar.sub=KQ;function YQ(t,e){return t<>>32-e}Ar.rotl=YQ;function JQ(t,e){return t<<32-e|t>>>e}Ar.rotr=JQ;function XQ(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ar.isInteger=Number.isInteger||XQ;Ar.MAX_SAFE_INTEGER=9007199254740991;Ar.isSafeInteger=function(t){return Ar.isInteger(t)&&t>=-Ar.MAX_SAFE_INTEGER&&t<=Ar.MAX_SAFE_INTEGER}});var Oa=E(Ne=>{"use strict";l();Object.defineProperty(Ne,"__esModule",{value:!0});var sD=iD();function ZQ(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=ZQ;function e9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=e9;function t9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=t9;function r9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=r9;function oD(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=oD;Ne.writeInt16BE=oD;function aD(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=aD;Ne.writeInt16LE=aD;function A1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=A1;function b1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=b1;function I1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=I1;function _1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=_1;function Xd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Xd;Ne.writeInt32BE=Xd;function Zd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Zd;Ne.writeInt32LE=Zd;function n9(t,e){e===void 0&&(e=0);var r=A1(t,e),n=A1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=n9;function i9(t,e){e===void 0&&(e=0);var r=b1(t,e),n=b1(t,e+4);return r*4294967296+n}Ne.readUint64BE=i9;function s9(t,e){e===void 0&&(e=0);var r=I1(t,e),n=I1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=s9;function o9(t,e){e===void 0&&(e=0);var r=_1(t,e),n=_1(t,e+4);return n*4294967296+r}Ne.readUint64LE=o9;function uD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Xd(t/4294967296>>>0,e,r),Xd(t>>>0,e,r+4),e}Ne.writeUint64BE=uD;Ne.writeInt64BE=uD;function cD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Zd(t>>>0,e,r),Zd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=cD;Ne.writeInt64LE=cD;function a9(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=a9;function u9(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=c9;function l9(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!sD.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";l();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.randomStringForEntropy=Xt.randomString=Xt.randomUint32=Xt.randomBytes=Xt.defaultRandomSource=void 0;var E9=nD(),v9=Oa(),lD=Hr();Xt.defaultRandomSource=new E9.SystemRandomSource;function S1(t,e=Xt.defaultRandomSource){return e.randomBytes(t)}Xt.randomBytes=S1;function A9(t=Xt.defaultRandomSource){let e=S1(4,t),r=(0,v9.readUint32LE)(e);return(0,lD.wipe)(e),r}Xt.randomUint32=A9;var fD="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function hD(t,e=fD,r=Xt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=S1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(ei,"__esModule",{value:!0});var Pa=Oa(),Da=Hr();ei.DIGEST_LENGTH=64;ei.BLOCK_SIZE=128;var pD=function(){function t(){this.digestLength=ei.DIGEST_LENGTH,this.blockSize=ei.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Da.wipe(this._buffer),Da.wipe(this._tempHi),Da.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(T1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=T1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Da.wipe(e.stateHi),Da.wipe(e.stateLo),e.buffer&&Da.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();ei.SHA512=pD;var dD=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function T1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],c=r[2],f=r[3],h=r[4],g=r[5],y=r[6],m=r[7],T=n[0],O=n[1],B=n[2],W=n[3],U=n[4],A=n[5],_=n[6],N=n[7],I,S,R,J,Q,V,k,K;o>=128;){for(var ge=0;ge<16;ge++){var ue=8*ge+s;t[ge]=Pa.readUint32BE(i,ue),e[ge]=Pa.readUint32BE(i,ue+4)}for(var ge=0;ge<80;ge++){var re=a,Y=u,se=c,te=f,ie=h,M=g,le=y,ae=m,he=T,oe=O,ce=B,w=W,v=U,b=A,P=_,C=N;if(I=m,S=N,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=(h>>>14|U<<18)^(h>>>18|U<<14)^(U>>>9|h<<23),S=(U>>>14|h<<18)^(U>>>18|h<<14)^(h>>>9|U<<23),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=h&g^~h&y,S=U&A^~U&_,Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=dD[ge*2],S=dD[ge*2+1],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=t[ge%16],S=e[ge%16],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,R=k&65535|K<<16,J=Q&65535|V<<16,I=R,S=J,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=(a>>>28|T<<4)^(T>>>2|a<<30)^(T>>>7|a<<25),S=(T>>>28|a<<4)^(a>>>2|T<<30)^(a>>>7|T<<25),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=a&u^a&c^u&c,S=T&O^T&B^O&B,Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,ae=k&65535|K<<16,C=Q&65535|V<<16,I=te,S=w,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=R,S=J,Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,te=k&65535|K<<16,w=Q&65535|V<<16,u=re,c=Y,f=se,h=te,g=ie,y=M,m=le,a=ae,O=he,B=oe,W=ce,U=w,A=v,_=b,N=P,T=C,ge%16===15)for(var ue=0;ue<16;ue++)I=t[ue],S=e[ue],Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=t[(ue+9)%16],S=e[(ue+9)%16],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,R=t[(ue+1)%16],J=e[(ue+1)%16],I=(R>>>1|J<<31)^(R>>>8|J<<24)^R>>>7,S=(J>>>1|R<<31)^(J>>>8|R<<24)^(J>>>7|R<<25),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,R=t[(ue+14)%16],J=e[(ue+14)%16],I=(R>>>19|J<<13)^(J>>>29|R<<3)^R>>>6,S=(J>>>19|R<<13)^(R>>>29|J<<3)^(J>>>6|R<<26),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,t[ue]=k&65535|K<<16,e[ue]=Q&65535|V<<16}I=a,S=T,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[0],S=n[0],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[0]=a=k&65535|K<<16,n[0]=T=Q&65535|V<<16,I=u,S=O,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[1],S=n[1],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[1]=u=k&65535|K<<16,n[1]=O=Q&65535|V<<16,I=c,S=B,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[2],S=n[2],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[2]=c=k&65535|K<<16,n[2]=B=Q&65535|V<<16,I=f,S=W,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[3],S=n[3],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[3]=f=k&65535|K<<16,n[3]=W=Q&65535|V<<16,I=h,S=U,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[4],S=n[4],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[4]=h=k&65535|K<<16,n[4]=U=Q&65535|V<<16,I=g,S=A,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[5],S=n[5],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[5]=g=k&65535|K<<16,n[5]=A=Q&65535|V<<16,I=y,S=_,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[6],S=n[6],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[6]=y=k&65535|K<<16,n[6]=_=Q&65535|V<<16,I=m,S=N,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[7],S=n[7],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[7]=m=k&65535|K<<16,n[7]=N=Q&65535|V<<16,s+=128,o-=128}return s}function I9(t){var e=new pD;e.update(t);var r=e.digest();return e.clean(),r}ei.hash=I9});var ND=E(Ve=>{"use strict";l();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.convertSecretKeyToX25519=Ve.convertPublicKeyToX25519=Ve.verify=Ve.sign=Ve.extractPublicKeyFromSecretKey=Ve.generateKeyPair=Ve.generateKeyPairFromSeed=Ve.SEED_LENGTH=Ve.SECRET_KEY_LENGTH=Ve.PUBLIC_KEY_LENGTH=Ve.SIGNATURE_LENGTH=void 0;var _9=Kc(),Yc=gD(),vD=Hr();Ve.SIGNATURE_LENGTH=64;Ve.PUBLIC_KEY_LENGTH=32;Ve.SECRET_KEY_LENGTH=64;Ve.SEED_LENGTH=32;function Ie(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,AD(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function bD(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function wD(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Jc(r,t),Jc(n,e),bD(r,n)}function ID(t){let e=new Uint8Array(32);return Jc(e,t),e[0]&1}function N9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Ks(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Js(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function je(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,h=0,g=0,y=0,m=0,T=0,O=0,B=0,W=0,U=0,A=0,_=0,N=0,I=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,ge=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],he=r[5],oe=r[6],ce=r[7],w=r[8],v=r[9],b=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,c+=n*ae,f+=n*he,h+=n*oe,g+=n*ce,y+=n*w,m+=n*v,T+=n*b,O+=n*P,B+=n*C,W+=n*D,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,c+=n*le,f+=n*ae,h+=n*he,g+=n*oe,y+=n*ce,m+=n*w,T+=n*v,O+=n*b,B+=n*P,W+=n*C,U+=n*D,A+=n*L,_+=n*x,n=e[2],a+=n*te,u+=n*ie,c+=n*M,f+=n*le,h+=n*ae,g+=n*he,y+=n*oe,m+=n*ce,T+=n*w,O+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*D,_+=n*L,N+=n*x,n=e[3],u+=n*te,c+=n*ie,f+=n*M,h+=n*le,g+=n*ae,y+=n*he,m+=n*oe,T+=n*ce,O+=n*w,B+=n*v,W+=n*b,U+=n*P,A+=n*C,_+=n*D,N+=n*L,I+=n*x,n=e[4],c+=n*te,f+=n*ie,h+=n*M,g+=n*le,y+=n*ae,m+=n*he,T+=n*oe,O+=n*ce,B+=n*w,W+=n*v,U+=n*b,A+=n*P,_+=n*C,N+=n*D,I+=n*L,S+=n*x,n=e[5],f+=n*te,h+=n*ie,g+=n*M,y+=n*le,m+=n*ae,T+=n*he,O+=n*oe,B+=n*ce,W+=n*w,U+=n*v,A+=n*b,_+=n*P,N+=n*C,I+=n*D,S+=n*L,R+=n*x,n=e[6],h+=n*te,g+=n*ie,y+=n*M,m+=n*le,T+=n*ae,O+=n*he,B+=n*oe,W+=n*ce,U+=n*w,A+=n*v,_+=n*b,N+=n*P,I+=n*C,S+=n*D,R+=n*L,J+=n*x,n=e[7],g+=n*te,y+=n*ie,m+=n*M,T+=n*le,O+=n*ae,B+=n*he,W+=n*oe,U+=n*ce,A+=n*w,_+=n*v,N+=n*b,I+=n*P,S+=n*C,R+=n*D,J+=n*L,Q+=n*x,n=e[8],y+=n*te,m+=n*ie,T+=n*M,O+=n*le,B+=n*ae,W+=n*he,U+=n*oe,A+=n*ce,_+=n*w,N+=n*v,I+=n*b,S+=n*P,R+=n*C,J+=n*D,Q+=n*L,V+=n*x,n=e[9],m+=n*te,T+=n*ie,O+=n*M,B+=n*le,W+=n*ae,U+=n*he,A+=n*oe,_+=n*ce,N+=n*w,I+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*D,V+=n*L,k+=n*x,n=e[10],T+=n*te,O+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*he,_+=n*oe,N+=n*ce,I+=n*w,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*D,k+=n*L,K+=n*x,n=e[11],O+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,_+=n*he,N+=n*oe,I+=n*ce,S+=n*w,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*D,K+=n*L,ge+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,_+=n*ae,N+=n*he,I+=n*oe,S+=n*ce,R+=n*w,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*D,ge+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,_+=n*le,N+=n*ae,I+=n*he,S+=n*oe,R+=n*ce,J+=n*w,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,ge+=n*D,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,_+=n*M,N+=n*le,I+=n*ae,S+=n*he,R+=n*oe,J+=n*ce,Q+=n*w,V+=n*v,k+=n*b,K+=n*P,ge+=n*C,ue+=n*D,re+=n*L,Y+=n*x,n=e[15],A+=n*te,_+=n*ie,N+=n*M,I+=n*le,S+=n*ae,R+=n*he,J+=n*oe,Q+=n*ce,V+=n*w,k+=n*v,K+=n*b,ge+=n*P,ue+=n*C,re+=n*D,Y+=n*L,se+=n*x,s+=38*_,o+=38*N,a+=38*I,u+=38*S,c+=38*R,f+=38*J,h+=38*Q,g+=38*V,y+=38*k,m+=38*K,T+=38*ge,O+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=h,t[7]=g,t[8]=y,t[9]=m,t[10]=T,t[11]=O,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function Ys(t,e){je(t,e,e)}function _D(t,e){let r=Ie(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Ys(r,r),n!==2&&n!==4&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function O9(t,e){let r=Ie(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Ys(r,r),n!==1&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function O1(t,e){let r=Ie(),n=Ie(),i=Ie(),s=Ie(),o=Ie(),a=Ie(),u=Ie(),c=Ie(),f=Ie();Js(r,t[1],t[0]),Js(f,e[1],e[0]),je(r,r,f),Ks(n,t[0],t[1]),Ks(f,e[0],e[1]),je(n,n,f),je(i,t[3],e[3]),je(i,i,C9),je(s,t[2],e[2]),Ks(s,s,s),Js(o,n,r),Js(a,s,i),Ks(u,s,i),Ks(c,n,r),je(t[0],o,a),je(t[1],c,u),je(t[2],u,a),je(t[3],o,c)}function ED(t,e,r){for(let n=0;n<4;n++)AD(t[n],e[n],r)}function P1(t,e){let r=Ie(),n=Ie(),i=Ie();_D(i,e[2]),je(r,e[0],i),je(n,e[1],i),Jc(t,n),t[31]^=ID(r)<<7}function SD(t,e,r){Gi(t[0],N1),Gi(t[1],Ra),Gi(t[2],Ra),Gi(t[3],N1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;ED(t,e,i),O1(e,t),O1(t,t),ED(t,e,i)}}function R1(t,e){let r=[Ie(),Ie(),Ie(),Ie()];Gi(r[0],yD),Gi(r[1],mD),Gi(r[2],Ra),je(r[3],yD,mD),SD(t,r,e)}function TD(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Yc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ie(),Ie(),Ie(),Ie()];R1(n,e),P1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=TD;function D9(t){let e=(0,_9.randomBytes)(32,t),r=TD(e);return(0,vD.wipe)(e),r}Ve.generateKeyPair=D9;function P9(t){if(t.length!==Ve.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ve.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ve.extractPublicKeyFromSecretKey=P9;var x1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function CD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*x1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*x1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function D1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;CD(t,e)}function R9(t,e){let r=new Float64Array(64),n=[Ie(),Ie(),Ie(),Ie()],i=(0,Yc.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new Yc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),D1(a),R1(n,a),P1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();D1(u);for(let c=0;c<32;c++)r[c]=a[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=u[c]*i[f];return CD(s.subarray(32),r),s}Ve.sign=R9;function xD(t,e){let r=Ie(),n=Ie(),i=Ie(),s=Ie(),o=Ie(),a=Ie(),u=Ie();return Gi(t[2],Ra),N9(t[1],e),Ys(i,t[1]),je(s,i,T9),Js(i,i,t[2]),Ks(s,t[2],s),Ys(o,s),Ys(a,o),je(u,a,o),je(r,u,i),je(r,r,s),O9(r,r),je(r,r,i),je(r,r,s),je(r,r,s),je(t[0],r,s),Ys(n,t[0]),je(n,n,s),wD(n,i)&&je(t[0],t[0],x9),Ys(n,t[0]),je(n,n,s),wD(n,i)?-1:(ID(t[0])===e[31]>>7&&Js(t[0],N1,t[0]),je(t[3],t[0],t[1]),0)}function B9(t,e,r){let n=new Uint8Array(32),i=[Ie(),Ie(),Ie(),Ie()],s=[Ie(),Ie(),Ie(),Ie()];if(r.length!==Ve.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ve.SIGNATURE_LENGTH} bytes`);if(xD(s,t))return!1;let o=new Yc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return D1(a),SD(i,s,a),R1(s,r.subarray(32)),O1(i,s),P1(n,i),!bD(r,n)}Ve.verify=B9;function L9(t){let e=[Ie(),Ie(),Ie(),Ie()];if(xD(e,t))throw new Error("Ed25519: invalid public key");let r=Ie(),n=Ie(),i=e[1];Ks(r,Ra,i),Js(n,Ra,i),_D(n,n),je(r,r,n);let s=new Uint8Array(32);return Jc(s,r),s}Ve.convertPublicKeyToX25519=L9;function F9(t){let e=(0,Yc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,vD.wipe)(e),r}Ve.convertSecretKeyToX25519=F9});var ep,tp,Xs,Ba,rp,Xc,np,ip,sp,La,op,ap,OD,DD,up=fe(()=>{l();ep="EdDSA",tp="JWT",Xs=".",Ba="base64url",rp="utf8",Xc="utf8",np=":",ip="did",sp="key",La="base58btc",op="z",ap="K36",OD=32,DD=32});function ki(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var Zc=fe(()=>{l()});function Fa(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?ki(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var cp=fe(()=>{l();Zc()});function lp(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Fa(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return ki(r)}var B1=fe(()=>{l();cp();Zc()});function M9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var _=m[B],N=0,I=U-1;(_!==0||N>>0,A[I]=_%a>>>0,_=_/a>>>0;if(_!==0)throw new Error("Non-zero carry");O=N,B++}for(var S=U-O;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);m[T];){var A=r[m.charCodeAt(T)];if(A===255)return;for(var _=0,N=W-1;(A!==0||_>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=_,T++}if(m[T]!==" "){for(var I=W-B;I!==W&&U[I]===0;)I++;for(var S=new Uint8Array(O+(W-I)),R=O;I!==W;)S[R++]=U[I++];return S}}}function y(m){var T=g(m);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:g,decode:y}}var U9,q9,PD,RD=fe(()=>{l();U9=M9,q9=U9,PD=q9});var She,BD,ti,LD,FD,ji=fe(()=>{l();She=new Uint8Array(0),BD=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},LD=t=>new TextEncoder().encode(t),FD=t=>new TextDecoder().decode(t)});var L1,F1,M1,UD,U1,Ma,Qi,V9,H9,pt,Zr=fe(()=>{l();RD();ji();L1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},F1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return UD(this,e)}},M1=class{constructor(e){this.decoders=e}or(e){return UD(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},UD=(t,e)=>new M1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),U1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new L1(e,r,n),this.decoder=new F1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ma=({name:t,prefix:e,encode:r,decode:n})=>new U1(t,e,r,n),Qi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=PD(r,e);return Ma({prefix:t,name:e,encode:n,decode:s=>ti(i(s))})},V9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},H9=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Ma({prefix:e,name:t,encode(i){return H9(i,n,r)},decode(i){return V9(i,n,r,t)}})});var q1={};ct(q1,{identity:()=>G9});var G9,qD=fe(()=>{l();Zr();ji();G9=Ma({prefix:"\0",name:"identity",encode:t=>FD(t),decode:t=>LD(t)})});var V1={};ct(V1,{base2:()=>k9});var k9,VD=fe(()=>{l();Zr();k9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var H1={};ct(H1,{base8:()=>j9});var j9,HD=fe(()=>{l();Zr();j9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var G1={};ct(G1,{base10:()=>Q9});var Q9,GD=fe(()=>{l();Zr();Q9=Qi({prefix:"9",name:"base10",alphabet:"0123456789"})});var k1={};ct(k1,{base16:()=>W9,base16upper:()=>z9});var W9,z9,kD=fe(()=>{l();Zr();W9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),z9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var j1={};ct(j1,{base32:()=>Ua,base32hex:()=>J9,base32hexpad:()=>Z9,base32hexpadupper:()=>eW,base32hexupper:()=>X9,base32pad:()=>K9,base32padupper:()=>Y9,base32upper:()=>$9,base32z:()=>tW});var Ua,$9,K9,Y9,J9,X9,Z9,eW,tW,Q1=fe(()=>{l();Zr();Ua=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),$9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),K9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Y9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),J9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),X9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Z9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eW=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tW=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var W1={};ct(W1,{base36:()=>rW,base36upper:()=>nW});var rW,nW,jD=fe(()=>{l();Zr();rW=Qi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nW=Qi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var z1={};ct(z1,{base58btc:()=>xn,base58flickr:()=>iW});var xn,iW,$1=fe(()=>{l();Zr();xn=Qi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iW=Qi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var K1={};ct(K1,{base64:()=>sW,base64pad:()=>oW,base64url:()=>aW,base64urlpad:()=>uW});var sW,oW,aW,uW,QD=fe(()=>{l();Zr();sW=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),oW=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),aW=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uW=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Y1={};ct(Y1,{base256emoji:()=>dW});function fW(t){return t.reduce((e,r)=>(e+=cW[r],e),"")}function hW(t){let e=[];for(let r of t){let n=lW[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var WD,cW,lW,dW,zD=fe(()=>{l();Zr();WD=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),cW=WD.reduce((t,e,r)=>(t[r]=e,t),[]),lW=WD.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);dW=Ma({prefix:"\u{1F680}",name:"base256emoji",encode:fW,decode:hW})});function YD(t,e,r){e=e||[],r=r||0;for(var n=r;t>=mW;)e[r++]=t&255|$D,t/=128;for(;t&yW;)e[r++]=t&255|$D,t>>>=7;return e[r]=t|0,YD.bytes=r-n+1,e}function J1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw J1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&KD)<=EW);return J1.bytes=s-n,r}var pW,$D,gW,yW,mW,wW,EW,KD,vW,AW,bW,IW,_W,SW,TW,CW,xW,NW,OW,DW,el,JD=fe(()=>{l();pW=YD,$D=128,gW=127,yW=~gW,mW=Math.pow(2,31);wW=J1,EW=128,KD=127;vW=Math.pow(2,7),AW=Math.pow(2,14),bW=Math.pow(2,21),IW=Math.pow(2,28),_W=Math.pow(2,35),SW=Math.pow(2,42),TW=Math.pow(2,49),CW=Math.pow(2,56),xW=Math.pow(2,63),NW=function(t){return t{l();JD();tl=(t,e=0)=>[el.decode(t,e),el.decode.bytes],qa=(t,e,r=0)=>(el.encode(t,e,r),e),Va=t=>el.encodingLength(t)});var Zs,XD,ZD,Ha,nl=fe(()=>{l();ji();hp();Zs=(t,e)=>{let r=e.byteLength,n=Va(t),i=n+Va(r),s=new Uint8Array(i+r);return qa(t,s,0),qa(r,s,n),s.set(e,i),new Ha(t,r,e,s)},XD=t=>{let e=ti(t),[r,n]=tl(e),[i,s]=tl(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ha(r,i,o,e)},ZD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&BD(t.bytes,e.bytes),Ha=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var Z1,X1,eA=fe(()=>{l();nl();Z1=({name:t,code:e,encode:r})=>new X1(t,e,r),X1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Zs(this.code,r):r.then(n=>Zs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var tA={};ct(tA,{sha256:()=>PW,sha512:()=>RW});var tP,PW,RW,rP=fe(()=>{l();eA();tP=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),PW=Z1({name:"sha2-256",code:18,encode:tP("SHA-256")}),RW=Z1({name:"sha2-512",code:19,encode:tP("SHA-512")})});var rA={};ct(rA,{identity:()=>FW});var nP,BW,iP,LW,FW,sP=fe(()=>{l();ji();nl();nP=0,BW="identity",iP=ti,LW=t=>Zs(nP,iP(t)),FW={code:nP,name:BW,encode:iP,digest:LW}});var oP=fe(()=>{l();ji()});var fde,hde,aP=fe(()=>{l();fde=new TextEncoder,hde=new TextDecoder});var gp,qW,VW,HW,il,GW,uP,cP,dp,pp,kW,jW,QW,lP=fe(()=>{l();hp();nl();$1();Q1();ji();gp=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:pp,byteLength:pp,code:dp,version:dp,multihash:dp,bytes:dp,_baseCache:pp,asCID:pp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==il)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==GW)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Zs(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&ZD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return VW(r,i,e||xn.encoder);default:return HW(r,i,e||Ua.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return jW(/^0\.0/,QW),!!(e&&(e[cP]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||uP(r,n,i.bytes))}else if(e!=null&&e[cP]===!0){let{version:r,multihash:n,code:i}=e,s=XD(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==il)throw new Error(`Version 0 CID must use dag-pb (code: ${il}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=uP(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,il,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=ti(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Ha(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[h,g]=tl(e.subarray(r));return r+=g,h},i=n(),s=il;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),c=r+u,f=c-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=qW(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},qW=(t,e)=>{switch(t[0]){case"Q":{let r=e||xn;return[xn.prefix,r.decode(`${xn.prefix}${t}`)]}case xn.prefix:{let r=e||xn;return[xn.prefix,r.decode(t)]}case Ua.prefix:{let r=e||Ua;return[Ua.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},VW=(t,e,r)=>{let{prefix:n}=r;if(n!==xn.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},HW=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},il=112,GW=18,uP=(t,e,r)=>{let n=Va(t),i=n+Va(e),s=new Uint8Array(i+r.byteLength);return qa(t,s,0),qa(e,s,n),s.set(r,i),s},cP=Symbol.for("@ipld/js-cid/CID"),dp={writable:!1,configurable:!1,enumerable:!0},pp={writable:!1,enumerable:!1,configurable:!1},kW="0.0.0-dev",jW=(t,e)=>{if(t.test(kW))console.warn(e);else throw new Error(e)},QW=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -17,33 +18,32 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var UD=ge(()=>{c();MD();cp();qi();H1();zc()});var j1,Dhe,qD=ge(()=>{c();hD();dD();pD();gD();yD();P1();mD();L1();wD();vD();ND();PD();RD();BD();UD();j1={...T1,...C1,...x1,...N1,...O1,...D1,...R1,...B1,...F1,...M1},Dhe={...G1,...k1}});function HD(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var VD,Q1,nW,dp,W1=ge(()=>{c();qD();op();VD=HD("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Q1=HD("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ra(t.length);for(let r=0;r{c();W1()});function Sn(t,e="utf8"){let r=dp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ui(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var z1=ge(()=>{c();W1();jc()});function Yc(t){return Uc(Zn(Sn(t,Da),Zd))}function Jc(t){return Zn(Sn(qc(t),Zd),Da)}function K1(t){let e=Sn(ip,Pa),r=np+Zn(ap([e,t]),Pa);return[tp,rp,r].join(ep)}function Y1(t){let[e,r,n]=t.split(ep);if(e!==tp||r!==rp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==np)throw new Error("Issuer must be a key in mulicodec format");let s=Sn(n.slice(1),Pa);if(Zn(s.slice(0,2),Pa)!==ip)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function GD(t){return Zn(t,Da)}function kD(t){return Sn(t,Da)}function J1(t){return Sn([Jc(t.header),Jc(t.payload)].join($s),kc)}function iW(t){let e=Zn(t,kc).split($s),r=Yc(e[0]),n=Yc(e[1]);return{header:r,payload:n}}function X1(t){return[Jc(t.header),Jc(t.payload),GD(t.signature)].join($s)}function Z1(t){let e=t.split($s),r=Yc(e[0]),n=Yc(e[1]),i=kD(e[2]),s=Sn(e.slice(0,2).join($s),kc);return{header:r,payload:n,signature:i,data:s}}var eA=ge(()=>{c();A1();$1();z1();Qd();sp()});function sW(t=(0,jD.randomBytes)(32)){return qa.generateKeyPairFromSeed(t)}async function oW(t,e,r,n,i=(0,QD.fromMiliseconds)(Date.now())){let s={alg:Jd,typ:Xd},o=K1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=J1({header:s,payload:u}),f=qa.sign(n.secretKey,l);return X1({header:s,payload:u,signature:f})}async function aW(t){let{header:e,payload:r,data:n,signature:i}=Z1(t);if(e.alg!==Jd||e.typ!==Xd)throw new Error("JWT must use EdDSA algorithm");let s=Y1(r.iss);return qa.verify(s,n,i)}var qa,jD,QD,WD=ge(()=>{c();qa=_e(rD()),jD=_e(Vc()),QD=_e(ks());sp();eA()});var $D=ge(()=>{c()});var zD={};ft(zD,{DATA_ENCODING:()=>kc,DID_DELIMITER:()=>ep,DID_METHOD:()=>rp,DID_PREFIX:()=>tp,JSON_ENCODING:()=>Zd,JWT_DELIMITER:()=>$s,JWT_ENCODING:()=>Da,JWT_IRIDIUM_ALG:()=>Jd,JWT_IRIDIUM_TYP:()=>Xd,KEY_PAIR_SEED_LENGTH:()=>iD,MULTICODEC_ED25519_BASE:()=>np,MULTICODEC_ED25519_ENCODING:()=>Pa,MULTICODEC_ED25519_HEADER:()=>ip,MULTICODEC_ED25519_LENGTH:()=>nD,decodeData:()=>iW,decodeIss:()=>Y1,decodeJSON:()=>Yc,decodeJWT:()=>Z1,decodeSig:()=>kD,encodeData:()=>J1,encodeIss:()=>K1,encodeJSON:()=>Jc,encodeJWT:()=>X1,encodeSig:()=>GD,generateKeyPair:()=>sW,signJWT:()=>oW,verifyJWT:()=>aW});var KD=ge(()=>{c();WD();sp();$D();eA()});var JD=m(pp=>{"use strict";c();Object.defineProperty(pp,"__esModule",{value:!0});var Xt=Ca(),tA=qr(),uW=20;function cW(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],W=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,A=i,I=s,N=o,_=a,S=u,R=l,J=f,Q=d,V=g,k=w,K=E,pe=T,ue=D,re=B,Y=W,se=0;se>>32-16|pe<<16,Q=Q+pe|0,_^=Q,_=_>>>32-12|_<<12,A=A+S|0,ue^=A,ue=ue>>>32-16|ue<<16,V=V+ue|0,S^=V,S=S>>>32-12|S<<12,I=I+R|0,re^=I,re=re>>>32-16|re<<16,k=k+re|0,R^=k,R=R>>>32-12|R<<12,N=N+J|0,Y^=N,Y=Y>>>32-16|Y<<16,K=K+Y|0,J^=K,J=J>>>32-12|J<<12,I=I+R|0,re^=I,re=re>>>32-8|re<<8,k=k+re|0,R^=k,R=R>>>32-7|R<<7,N=N+J|0,Y^=N,Y=Y>>>32-8|Y<<8,K=K+Y|0,J^=K,J=J>>>32-7|J<<7,A=A+S|0,ue^=A,ue=ue>>>32-8|ue<<8,V=V+ue|0,S^=V,S=S>>>32-7|S<<7,U=U+_|0,pe^=U,pe=pe>>>32-8|pe<<8,Q=Q+pe|0,_^=Q,_=_>>>32-7|_<<7,U=U+S|0,Y^=U,Y=Y>>>32-16|Y<<16,k=k+Y|0,S^=k,S=S>>>32-12|S<<12,A=A+R|0,pe^=A,pe=pe>>>32-16|pe<<16,K=K+pe|0,R^=K,R=R>>>32-12|R<<12,I=I+J|0,ue^=I,ue=ue>>>32-16|ue<<16,Q=Q+ue|0,J^=Q,J=J>>>32-12|J<<12,N=N+_|0,re^=N,re=re>>>32-16|re<<16,V=V+re|0,_^=V,_=_>>>32-12|_<<12,I=I+J|0,ue^=I,ue=ue>>>32-8|ue<<8,Q=Q+ue|0,J^=Q,J=J>>>32-7|J<<7,N=N+_|0,re^=N,re=re>>>32-8|re<<8,V=V+re|0,_^=V,_=_>>>32-7|_<<7,A=A+R|0,pe^=A,pe=pe>>>32-8|pe<<8,K=K+pe|0,R^=K,R=R>>>32-7|R<<7,U=U+S|0,Y^=U,Y=Y>>>32-8|Y<<8,k=k+Y|0,S^=k,S=S>>>32-7|S<<7;Xt.writeUint32LE(U+n|0,t,0),Xt.writeUint32LE(A+i|0,t,4),Xt.writeUint32LE(I+s|0,t,8),Xt.writeUint32LE(N+o|0,t,12),Xt.writeUint32LE(_+a|0,t,16),Xt.writeUint32LE(S+u|0,t,20),Xt.writeUint32LE(R+l|0,t,24),Xt.writeUint32LE(J+f|0,t,28),Xt.writeUint32LE(Q+d|0,t,32),Xt.writeUint32LE(V+g|0,t,36),Xt.writeUint32LE(k+w|0,t,40),Xt.writeUint32LE(K+E|0,t,44),Xt.writeUint32LE(pe+T|0,t,48),Xt.writeUint32LE(ue+D|0,t,52),Xt.writeUint32LE(re+B|0,t,56),Xt.writeUint32LE(Y+W|0,t,60)}function YD(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var gp=m(Va=>{"use strict";c();Object.defineProperty(Va,"__esModule",{value:!0});function hW(t,e,r){return~(t-1)&e|t-1&r}Va.select=hW;function dW(t,e){return(t|0)-(e|0)-1>>>31&1}Va.lessOrEqual=dW;function XD(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Va.compare=XD;function pW(t,e){return t.length===0||e.length===0?!1:XD(t,e)!==0}Va.equal=pW});var eP=m(ei=>{"use strict";c();Object.defineProperty(ei,"__esModule",{value:!0});var gW=gp(),yp=qr();ei.DIGEST_LENGTH=16;var ZD=function(){function t(e){this.digestLength=ei.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],w=this._h[8],E=this._h[9],T=this._r[0],D=this._r[1],B=this._r[2],W=this._r[3],U=this._r[4],A=this._r[5],I=this._r[6],N=this._r[7],_=this._r[8],S=this._r[9];n>=16;){var R=e[r+0]|e[r+1]<<8;s+=R&8191;var J=e[r+2]|e[r+3]<<8;o+=(R>>>13|J<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(J>>>10|Q<<6)&8191;var V=e[r+6]|e[r+7]<<8;u+=(Q>>>7|V<<9)&8191;var k=e[r+8]|e[r+9]<<8;l+=(V>>>4|k<<12)&8191,f+=k>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(k>>>14|K<<2)&8191;var pe=e[r+12]|e[r+13]<<8;g+=(K>>>11|pe<<5)&8191;var ue=e[r+14]|e[r+15]<<8;w+=(pe>>>8|ue<<8)&8191,E+=ue>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*S),Y+=a*(5*_),Y+=u*(5*N),Y+=l*(5*I),re=Y>>>13,Y&=8191,Y+=f*(5*A),Y+=d*(5*U),Y+=g*(5*W),Y+=w*(5*B),Y+=E*(5*D),re+=Y>>>13,Y&=8191;var se=re;se+=s*D,se+=o*T,se+=a*(5*S),se+=u*(5*_),se+=l*(5*N),re=se>>>13,se&=8191,se+=f*(5*I),se+=d*(5*A),se+=g*(5*U),se+=w*(5*W),se+=E*(5*B),re+=se>>>13,se&=8191;var te=re;te+=s*B,te+=o*D,te+=a*T,te+=u*(5*S),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*N),te+=d*(5*I),te+=g*(5*A),te+=w*(5*U),te+=E*(5*W),re+=te>>>13,te&=8191;var ie=re;ie+=s*W,ie+=o*B,ie+=a*D,ie+=u*T,ie+=l*(5*S),re=ie>>>13,ie&=8191,ie+=f*(5*_),ie+=d*(5*N),ie+=g*(5*I),ie+=w*(5*A),ie+=E*(5*U),re+=ie>>>13,ie&=8191;var M=re;M+=s*U,M+=o*W,M+=a*B,M+=u*D,M+=l*T,re=M>>>13,M&=8191,M+=f*(5*S),M+=d*(5*_),M+=g*(5*N),M+=w*(5*I),M+=E*(5*A),re+=M>>>13,M&=8191;var le=re;le+=s*A,le+=o*U,le+=a*W,le+=u*B,le+=l*D,re=le>>>13,le&=8191,le+=f*T,le+=d*(5*S),le+=g*(5*_),le+=w*(5*N),le+=E*(5*I),re+=le>>>13,le&=8191;var ae=re;ae+=s*I,ae+=o*A,ae+=a*U,ae+=u*W,ae+=l*B,re=ae>>>13,ae&=8191,ae+=f*D,ae+=d*T,ae+=g*(5*S),ae+=w*(5*_),ae+=E*(5*N),re+=ae>>>13,ae&=8191;var fe=re;fe+=s*N,fe+=o*I,fe+=a*A,fe+=u*U,fe+=l*W,re=fe>>>13,fe&=8191,fe+=f*B,fe+=d*D,fe+=g*T,fe+=w*(5*S),fe+=E*(5*_),re+=fe>>>13,fe&=8191;var oe=re;oe+=s*_,oe+=o*N,oe+=a*I,oe+=u*A,oe+=l*U,re=oe>>>13,oe&=8191,oe+=f*W,oe+=d*B,oe+=g*D,oe+=w*T,oe+=E*(5*S),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*S,ce+=o*_,ce+=a*N,ce+=u*I,ce+=l*A,re=ce>>>13,ce&=8191,ce+=f*U,ce+=d*W,ce+=g*B,ce+=w*D,ce+=E*T,re+=ce>>>13,ce&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,se+=re,s=Y,o=se,a=te,u=ie,l=M,f=le,d=ae,g=fe,w=oe,E=ce,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(ti,"__esModule",{value:!0});var mp=JD(),wW=eP(),Xc=qr(),tP=Ca(),EW=gp();ti.KEY_LENGTH=32;ti.NONCE_LENGTH=12;ti.TAG_LENGTH=16;var rP=new Uint8Array(16),vW=function(){function t(e){if(this.nonceLength=ti.NONCE_LENGTH,this.tagLength=ti.TAG_LENGTH,e.length!==ti.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);mp.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return mp.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),Xc.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(rP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(rP.subarray(n.length%16));var o=new Uint8Array(8);i&&tP.writeUint64LE(i.length,o),s.update(o),tP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(rA,"__esModule",{value:!0});function AW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}rA.isSerializableHash=AW});var oP=m(Zc=>{"use strict";c();Object.defineProperty(Zc,"__esModule",{value:!0});var Tn=iP(),bW=gp(),_W=qr(),sP=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(nA,"__esModule",{value:!0});var aP=oP(),uP=qr(),SW=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=aP.hmac(this._hash,n,r);this._hmac=new aP.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});var Ep=Ca(),wp=qr();Hi.DIGEST_LENGTH=32;Hi.BLOCK_SIZE=64;var lP=function(){function t(){this.digestLength=Hi.DIGEST_LENGTH,this.blockSize=Hi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){wp.wipe(this._buffer),wp.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(iA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=iA(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){wp.wipe(e.state),e.buffer&&wp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Hi.SHA256=lP;var TW=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function iA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],g=e[7],w=0;w<16;w++){var E=n+w*4;t[w]=Ep.readUint32BE(r,E)}for(var w=16;w<64;w++){var T=t[w-2],D=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[w-15];var B=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[w]=(D+t[w-7]|0)+(B+t[w-16]|0)}for(var w=0;w<64;w++){var D=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(TW[w]+t[w]|0)|0)|0,B=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;g=d,d=f,f=l,l=u+D|0,u=a,a=o,o=s,s=D+B|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function CW(t){var e=new lP;e.update(t);var r=e.digest();return e.clean(),r}Hi.hash=CW});var gP=m(gt=>{"use strict";c();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var xW=Vc(),NW=qr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.SHARED_KEY_LENGTH=32;function Cn(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,el(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function PW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function vp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ap(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ri(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function tl(t,e){ri(t,e,e)}function RW(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)tl(r,r),n!==2&&n!==4&&ri(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function oA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Cn(),s=Cn(),o=Cn(),a=Cn(),u=Cn(),l=Cn();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,PW(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;el(i,s,E),el(o,a,E),vp(u,i,o),Ap(i,i,o),vp(o,s,a),Ap(s,s,a),tl(a,u),tl(l,i),ri(i,o,i),ri(o,s,u),vp(u,i,o),Ap(i,i,o),tl(s,i),Ap(o,a,l),ri(i,o,OW),vp(i,i,a),ri(o,o,i),ri(i,a,l),ri(a,s,n),tl(s,u),el(i,s,E),el(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);RW(f,f),ri(d,d,f);let g=new Uint8Array(32);return DW(g,d),g}gt.scalarMult=oA;function dP(t){return oA(t,hP)}gt.scalarMultBase=dP;function pP(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:dP(e),secretKey:e}}gt.generateKeyPairFromSeed=pP;function BW(t){let e=(0,xW.randomBytes)(32,t),r=pP(e);return(0,NW.wipe)(e),r}gt.generateKeyPair=BW;function LW(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=oA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function wP(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function vP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ra(t.length);for(let n=0;n{c();op();jc()});var aA={};ft(aA,{compare:()=>yP,concat:()=>ap,equals:()=>wP,fromString:()=>Sn,toString:()=>Zn,xor:()=>vP});var uA=ge(()=>{c();mP();A1();EP();z1();$1();AP()});var RP=m(st=>{"use strict";c();var bP=st&&st.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new NP:typeof navigator<"u"?cA(navigator.userAgent):PP()}st.detect=qW;function OP(t){return t!==""&&UW.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function VW(t){var e=OP(t);return e?e[0]:null}st.browserName=VW;function cA(t){var e=OP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new xP;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_P&&(i=bP(bP([],i,!0),HW(_P-i.length),!0)):i=[];var s=i.join("."),o=DP(t),a=MW.exec(t);return a&&a[1]?new CP(r,s,o,a[1]):new SP(r,s,o)}st.parseUserAgent=cA;function DP(t){for(var e=0,r=IP.length;e{"use strict";c();Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getLocalStorage=Ye.getLocalStorageOrThrow=Ye.getCrypto=Ye.getCryptoOrThrow=Ye.getLocation=Ye.getLocationOrThrow=Ye.getNavigator=Ye.getNavigatorOrThrow=Ye.getDocument=Ye.getDocumentOrThrow=Ye.getFromWindowOrThrow=Ye.getFromWindow=void 0;function Ks(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=Ks;function Ha(t){let e=Ks(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=Ha;function GW(){return Ha("document")}Ye.getDocumentOrThrow=GW;function kW(){return Ks("document")}Ye.getDocument=kW;function jW(){return Ha("navigator")}Ye.getNavigatorOrThrow=jW;function QW(){return Ks("navigator")}Ye.getNavigator=QW;function WW(){return Ha("location")}Ye.getLocationOrThrow=WW;function $W(){return Ks("location")}Ye.getLocation=$W;function zW(){return Ha("crypto")}Ye.getCryptoOrThrow=zW;function KW(){return Ks("crypto")}Ye.getCrypto=KW;function YW(){return Ha("localStorage")}Ye.getLocalStorageOrThrow=YW;function JW(){return Ks("localStorage")}Ye.getLocalStorage=JW});var LP=m(bp=>{"use strict";c();Object.defineProperty(bp,"__esModule",{value:!0});bp.getWindowMetadata=void 0;var BP=lA();function XW(){let t,e;try{t=BP.getDocumentOrThrow(),e=BP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let w=0;w-1){let D=E.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(D.indexOf("/")===0)B+=D;else{let W=e.pathname.split("/");W.pop();let U=W.join("/");B+=U+"/"+D}g.push(B)}else if(D.indexOf("//")===0){let B=e.protocol+D;g.push(B)}else g.push(D)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(D)).filter(D=>D?d.includes(D):!1);if(T.length&&T){let D=E.getAttribute("content");if(D)return D}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}bp.getWindowMetadata=XW});var MP=m(($de,FP)=>{"use strict";c();FP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GP=m((Kde,HP)=>{"use strict";c();var VP="%[a-f0-9]{2}",UP=new RegExp("("+VP+")|([^%]+?)","gi"),qP=new RegExp("("+VP+")+","gi");function fA(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],fA(r),fA(n))}function ZW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(UP)||[],r=1;r{"use strict";c();kP.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var WP=m((Zde,QP)=>{"use strict";c();QP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var t$=MP(),r$=GP(),zP=jP(),n$=WP(),i$=t=>t==null,hA=Symbol("encodeFragmentIdentifier");function s$(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[",i,"]"].join("")]:[...r,[vt(e,t),"[",vt(i,t),"]=",vt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[]"].join("")]:[...r,[vt(e,t),"[]=",vt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),":list="].join("")]:[...r,[vt(e,t),":list=",vt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[vt(r,t),e,vt(i,t)].join("")]:[[n,vt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,vt(e,t)]:[...r,[vt(e,t),"=",vt(n,t)].join("")]}}function o$(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&ni(n,t).includes(t.arrayFormatSeparator);n=o?ni(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ni(u,t)):n===null?n:ni(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ni(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ni(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function KP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function vt(t,e){return e.encode?e.strict?t$(t):encodeURIComponent(t):t}function ni(t,e){return e.decode?r$(t):t}function YP(t){return Array.isArray(t)?t.sort():typeof t=="object"?YP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function JP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function a$(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function XP(t){t=JP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function $P(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function ZP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),KP(e.arrayFormatSeparator);let r=o$(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=zP(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ni(o,e),r(ni(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=$P(s[o],e);else n[i]=$P(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=YP(o):i[s]=o,i},Object.create(null))}pr.extract=XP;pr.parse=ZP;pr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),KP(e.arrayFormatSeparator);let r=o=>e.skipNull&&i$(t[o])||e.skipEmptyString&&t[o]==="",n=s$(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?vt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?vt(o,e)+"[]":a.reduce(n(o),[]).join("&"):vt(o,e)+"="+vt(a,e)}).filter(o=>o.length>0).join("&")};pr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=zP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:ZP(XP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ni(n,e)}:{})};pr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[hA]:!0},e);let r=JP(t.url).split("?")[0]||"",n=pr.extract(t.url),i=pr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=pr.stringify(s,e);o&&(o=`?${o}`);let a=a$(t.url);return t.fragmentIdentifier&&(a=`#${e[hA]?vt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};pr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[hA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=pr.parseUrl(t,r);return pr.stringifyUrl({url:n,query:n$(i,e),fragmentIdentifier:s},r)};pr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return pr.pick(t,n,r)}});var t3=ge(()=>{c()});function Gi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function u$(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function c$(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function l$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function rl(t,e,r){return(!r.length?c$(t,e.length):l$(t,e.length))?u$(t,e):!1}function nl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var dA=ge(()=>{c()});function f$(t){return _p(t.method)&&Ip(t.params)}function _p(t){return nl(t,"subscribe")}function Ip(t){return rl(t,["topic"],[])}function h$(t){return Sp(t.method)&&Tp(t.params)}function Sp(t){return nl(t,"publish")}function Tp(t){return rl(t,["message","topic","ttl"],["prompt","tag"])}function d$(t){return Cp(t.method)&&xp(t.params)}function Cp(t){return nl(t,"unsubscribe")}function xp(t){return rl(t,["id","topic"],[])}function p$(t){return Np(t.method)&&Op(t.params)}function Np(t){return nl(t,"subscription")}function Op(t){return rl(t,["id","data"],[])}var pA=ge(()=>{c();dA()});function g$(t){if(!_p(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Ip(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Gi(e,"topic"),e}function y$(t){if(!Sp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Tp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Gi(e,"topic"),Gi(e,"message"),Gi(e,"ttl","number"),e}function m$(t){if(!Cp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!xp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Gi(e,"id"),e}function w$(t){if(!Np(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Op(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Gi(e,"id"),Gi(e,"data"),e}var r3=ge(()=>{c();dA();pA()});var E$,n3=ge(()=>{c();E$={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var i3={};ft(i3,{RELAY_JSONRPC:()=>E$,isPublishMethod:()=>Sp,isPublishParams:()=>Tp,isPublishRequest:()=>h$,isSubscribeMethod:()=>_p,isSubscribeParams:()=>Ip,isSubscribeRequest:()=>f$,isSubscriptionMethod:()=>Np,isSubscriptionParams:()=>Op,isSubscriptionRequest:()=>p$,isUnsubscribeMethod:()=>Cp,isUnsubscribeParams:()=>xp,isUnsubscribeRequest:()=>d$,parsePublishRequest:()=>y$,parseSubscribeRequest:()=>g$,parseSubscriptionRequest:()=>w$,parseUnsubscribeRequest:()=>m$});var s3=ge(()=>{c();t3();r3();n3();pA()});var cl=m(G=>{"use strict";c();Object.defineProperty(G,"__esModule",{value:!0});var g3=nP(),v$=cP(),y3=Vc(),vA=fP(),A$=gP(),ot=(uA(),ct(aA)),b$=RP(),Ga=ks(),il=lA(),_$=LP(),I$=e3(),S$=(s3(),ct(i3));function m3(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var w3=m3(A$),Dp=m3(I$),Bp=":";function E3(t){let[e,r]=t.split(Bp);return{namespace:e,reference:r}}function v3(t){let{namespace:e,reference:r}=t;return[e,r].join(Bp)}function AA(t){let[e,r,n]=t.split(Bp);return{namespace:e,reference:r,address:n}}function A3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Bp)}function bA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function b3(t){let{address:e}=AA(t);return e}function _3(t){let{namespace:e,reference:r}=AA(t);return v3({namespace:e,reference:r})}function T$(t,e){let{namespace:r,reference:n}=E3(e);return A3({namespace:r,reference:n,address:t})}function C$(t){return bA(t,b3)}function I3(t){return bA(t,_3)}function x$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function N$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...I3(i.accounts))}),r}function O$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Lp(n,i))}),r}function Lp(t,e){return t.includes(":")?[t]:e.chains||[]}var Fp=t=>t?.split(":"),S3=t=>{let e=t&&Fp(t);if(e)return e[3]},D$=t=>{let e=t&&Fp(t);if(e)return e[2]+":"+e[3]},T3=t=>{let e=t&&Fp(t);if(e)return e.pop()},P$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=T3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${S3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: -${t.resources.map(d=>`- ${d}`).join(` -`)}`:void 0;return[r,n,"",i,"",s,o,a,u,l,f].filter(d=>d!=null).join(` -`)},_A="base10",rr="base16",Pp="base64pad",Mp="utf8",IA=0,ka=1,R$=0,o3=1,yA=12,SA=32;function B$(){let t=w3.generateKeyPair();return{privateKey:ot.toString(t.secretKey,rr),publicKey:ot.toString(t.publicKey,rr)}}function L$(){let t=y3.randomBytes(SA);return ot.toString(t,rr)}function F$(t,e){let r=w3.sharedKey(ot.fromString(t,rr),ot.fromString(e,rr),!0),n=new v$.HKDF(vA.SHA256,r).expand(SA);return ot.toString(n,rr)}function M$(t){let e=vA.hash(ot.fromString(t,rr));return ot.toString(e,rr)}function U$(t){let e=vA.hash(ot.fromString(t,Mp));return ot.toString(e,rr)}function C3(t){return ot.fromString(`${t}`,_A)}function ol(t){return Number(ot.toString(t,_A))}function q$(t){let e=C3(typeof t.type<"u"?t.type:IA);if(ol(e)===ka&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,rr):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,rr):y3.randomBytes(yA),i=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)).seal(n,ot.fromString(t.message,Mp));return x3({type:e,sealed:i,iv:n,senderPublicKey:r})}function V$(t){let e=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)),{sealed:r,iv:n}=TA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Mp)}function x3(t){if(ol(t.type)===ka){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Pp)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Pp)}function TA(t){let e=ot.fromString(t,Pp),r=e.slice(R$,o3),n=o3;if(ol(r)===ka){let a=n+SA,u=a+yA,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+yA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function H$(t,e){let r=TA(t);return N3({type:ol(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,rr):void 0,receiverPublicKey:e?.receiverPublicKey})}function N3(t){let e=t?.type||IA;if(e===ka){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function G$(t){return t.type===ka&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var k$=Object.defineProperty,a3=Object.getOwnPropertySymbols,j$=Object.prototype.hasOwnProperty,Q$=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?k$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c3=(t,e)=>{for(var r in e||(e={}))j$.call(e,r)&&u3(t,r,e[r]);if(a3)for(var r of a3(e))Q$.call(e,r)&&u3(t,r,e[r]);return t},O3="ReactNative",tr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Rp=" ",W$=":",D3="/",CA=2,$$=1e3,P3="js";function xA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function al(){return!il.getDocument()&&!!il.getNavigator()&&navigator.product===O3}function Up(){return!xA()&&!!il.getNavigator()}function Js(){return al()?tr.reactNative:xA()?tr.node:Up()?tr.browser:tr.unknown}function R3(t,e){let r=Dp.parse(t);return r=c3(c3({},r),e),t=Dp.stringify(r),t}function z$(){return _$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function K$(t,e){var r;let n=Js(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=il.getLocation())==null?void 0:r.host)||"unknown"),i}function B3(){if(Js()===tr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=b$.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function L3(){var t;let e=Js();return e===tr.browser?[e,((t=il.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function F3(t,e,r){let n=B3(),i=L3();return[[t,e].join("-"),[P3,r].join("-"),n,i].join("/")}function Y$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=F3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=R3(a[1]||"",l);return a[0]+"?"+f}function J$(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function X$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function M3(t,e=CA){return U3(t.split(D3),e)}function Z$(t){return M3(t).join(Rp)}function ki(t,e){return t.filter(r=>e.includes(r)).length===t.length}function U3(t,e=CA){return t.slice(Math.max(t.length-e,0))}function ez(t){return Object.fromEntries(t.entries())}function tz(t){return new Map(Object.entries(t))}function rz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var nz=t=>t;function q3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function iz(t){return t.split(Rp).map(e=>q3(e)).join(Rp)}function sz(t=Ga.FIVE_MINUTES,e){let r=Ga.toMiliseconds(t||Ga.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function oz(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function NA(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function az(t){return NA("topic",t)}function uz(t){return NA("id",t)}function cz(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function lz(t,e){return Ga.fromMiliseconds((e||Date.now())+Ga.toMiliseconds(t))}function fz(t){return Date.now()>=Ga.toMiliseconds(t)}function hz(t,e){return`${t}${e?`:${e}`:""}`}function ji(t=[],e=[]){return[...new Set([...t,...e])]}async function dz({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=Js();o===tr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===tr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var V3="irn";function pz(t){return t?.relay||{protocol:V3}}function gz(t){let e=S$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var yz=Object.defineProperty,l3=Object.getOwnPropertySymbols,mz=Object.prototype.hasOwnProperty,wz=Object.prototype.propertyIsEnumerable,f3=(t,e,r)=>e in t?yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ez=(t,e)=>{for(var r in e||(e={}))mz.call(e,r)&&f3(t,r,e[r]);if(l3)for(var r of l3(e))wz.call(e,r)&&f3(t,r,e[r]);return t};function H3(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function vz(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Dp.parse(s);return{protocol:n,topic:G3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:H3(o)}}function G3(t){return t.startsWith("//")?t.substring(2):t}function k3(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Az(t){return`${t.protocol}:${t.topic}@${t.version}?`+Dp.stringify(Ez({symKey:t.symKey},k3(t.relay)))}var bz=Object.defineProperty,_z=Object.defineProperties,Iz=Object.getOwnPropertyDescriptors,h3=Object.getOwnPropertySymbols,Sz=Object.prototype.hasOwnProperty,Tz=Object.prototype.propertyIsEnumerable,d3=(t,e,r)=>e in t?bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cz=(t,e)=>{for(var r in e||(e={}))Sz.call(e,r)&&d3(t,r,e[r]);if(h3)for(var r of h3(e))Tz.call(e,r)&&d3(t,r,e[r]);return t},xz=(t,e)=>_z(t,Iz(e));function Xs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function j3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Xs(r.accounts))}),e}function Q3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function W3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Nz(t,e){let r=eR(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function Oz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=mA(e),s=mA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,w=n[l].accounts;f.forEach(E=>{if(!w.some(T=>T.includes(E)))throw new Error(`No accounts provided for chain ${E} in namespace ${l}`)}),o[l]={chains:f,methods:d,events:g,accounts:w}});let a=rR(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.chains)==null?void 0:D.includes(E)}),d=n[l].methods.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.methods)==null?void 0:D.includes(E)}),g=n[l].events.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.events)==null?void 0:D.includes(E)}),w=f.map(E=>n[l].accounts.filter(T=>T.includes(`${E}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,g,w,E,T;if(!n[l])return;let D=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(A=>n[l].chains.includes(A)),B=n[l].methods.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.methods)==null?void 0:N.includes(A)}),W=n[l].events.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.events)==null?void 0:N.includes(A)}),U=D?.map(A=>n[l].accounts.filter(I=>I.includes(`${A}:`))).flat();u[l]={chains:ji((g=u[l])==null?void 0:g.chains,D),methods:ji((w=u[l])==null?void 0:w.methods,B),events:ji((E=u[l])==null?void 0:E.events,W),accounts:ji((T=u[l])==null?void 0:T.accounts,U)}}),u)}function OA(t){return t.includes(":")}function $3(t){return OA(t)?t.split(":")[0]:t}function mA(t){var e,r,n;let i={};if(!qp(t))return i;for(let[s,o]of Object.entries(t)){let a=OA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=$3(s);i[f]=xz(Cz({},i[f]),{chains:ji(a,(e=i[f])==null?void 0:e.chains),methods:ji(u,(r=i[f])==null?void 0:r.methods),events:ji(l,(n=i[f])==null?void 0:n.events)})}return i}var Dz={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Pz={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ii(t,e){let{message:r,code:n}=Pz[t];return{message:e?`${r} ${e}`:r,code:n}}function Ys(t,e){let{message:r,code:n}=Dz[t];return{message:e?`${r} ${e}`:r,code:n}}function ul(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function qp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Qi(t){return typeof t>"u"}function br(t,e){return e&&Qi(t)?!0:typeof t=="string"&&!!t.trim().length}function Vp(t,e){return e&&Qi(t)?!0:typeof t=="number"&&!isNaN(t)}function Rz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return ki(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Xs(a),d=r[o];(!ki(Lp(o,d),f)||!ki(d.methods,u)||!ki(d.events,l))&&(s=!1)}),s):!1}function sl(t){return br(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function z3(t){if(br(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&sl(r)}}return!1}function Bz(t){if(br(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Lz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Fz(t){return t?.topic}function Mz(t,e){let r=null;return br(t?.publicKey,!1)||(r=ii("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function wA(t){let e=!0;return ul(t)?t.length&&(e=t.every(r=>br(r,!1))):e=!1,e}function K3(t,e,r){let n=null;return ul(e)&&e.length?e.forEach(i=>{n||sl(i)||(n=Ys("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):sl(t)||(n=Ys("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function Y3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=K3(i,Lp(i,s),`${e} ${r}`);o&&(n=o)}),n}function J3(t,e){let r=null;return ul(t)?t.forEach(n=>{r||z3(n)||(r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function X3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=J3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function Z3(t,e){let r=null;return wA(t?.methods)?wA(t?.events)||(r=Ys("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ys("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function DA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Z3(n,`${e}, namespace`);i&&(r=i)}),r}function Uz(t,e,r){let n=null;if(t&&qp(t)){let i=DA(t,e);i&&(n=i);let s=Y3(t,e,r);s&&(n=s)}else n=ii("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function eR(t,e){let r=null;if(t&&qp(t)){let n=DA(t,e);n&&(r=n);let i=X3(t,e);i&&(r=i)}else r=ii("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function tR(t){return br(t.protocol,!0)}function qz(t,e){let r=!1;return e&&!t?r=!0:t&&ul(t)&&t.length&&t.forEach(n=>{r=tR(n)}),r}function Vz(t){return typeof t=="number"}function Hz(t){return typeof t<"u"&&typeof t!==null}function Gz(t){return!(!t||typeof t!="object"||!t.code||!Vp(t.code,!1)||!t.message||!br(t.message,!1))}function kz(t){return!(Qi(t)||!br(t.method,!1))}function jz(t){return!(Qi(t)||Qi(t.result)&&Qi(t.error)||!Vp(t.id,!1)||!br(t.jsonrpc,!1))}function Qz(t){return!(Qi(t)||!br(t.name,!1))}function Wz(t,e){return!(!sl(e)||!j3(t).includes(e))}function $z(t,e,r){return br(r,!1)?Q3(t,e).includes(r):!1}function zz(t,e,r){return br(r,!1)?W3(t,e).includes(r):!1}function rR(t,e,r){let n=null,i=Kz(t),s=Yz(e),o=Object.keys(i),a=Object.keys(s),u=p3(Object.keys(t)),l=p3(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`});var fP=fe(()=>{l();lP();hp();ji();eA();nl()});var nA,Ide,hP=fe(()=>{l();qD();VD();HD();GD();kD();Q1();jD();$1();QD();zD();rP();sP();oP();aP();fP();nA={...q1,...V1,...H1,...G1,...k1,...j1,...W1,...z1,...K1,...Y1},Ide={...tA,...rA}});function pP(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var dP,iA,WW,yp,sA=fe(()=>{l();hP();cp();dP=pP("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),iA=pP("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Fa(t.length);for(let r=0;r{l();sA()});function Nn(t,e="utf8"){let r=yp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ki(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var aA=fe(()=>{l();sA();Zc()});function sl(t){return Vi(ri(Nn(t,Ba),rp))}function ol(t){return ri(Nn(Hi(t),rp),Ba)}function uA(t){let e=Nn(ap,La),r=op+ri(lp([e,t]),La);return[ip,sp,r].join(np)}function cA(t){let[e,r,n]=t.split(np);if(e!==ip||r!==sp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==op)throw new Error("Issuer must be a key in mulicodec format");let s=Nn(n.slice(1),La);if(ri(s.slice(0,2),La)!==ap)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function gP(t){return ri(t,Ba)}function yP(t){return Nn(t,Ba)}function lA(t){return Nn([ol(t.header),ol(t.payload)].join(Xs),Xc)}function zW(t){let e=ri(t,Xc).split(Xs),r=sl(e[0]),n=sl(e[1]);return{header:r,payload:n}}function fA(t){return[ol(t.header),ol(t.payload),gP(t.signature)].join(Xs)}function hA(t){let e=t.split(Xs),r=sl(e[0]),n=sl(e[1]),i=yP(e[2]),s=Nn(e.slice(0,2).join(Xs),Xc);return{header:r,payload:n,signature:i,data:s}}var dA=fe(()=>{l();B1();oA();aA();kc();up()});function $W(t=(0,mP.randomBytes)(32)){return Ga.generateKeyPairFromSeed(t)}async function KW(t,e,r,n,i=(0,wP.fromMiliseconds)(Date.now())){let s={alg:ep,typ:tp},o=uA(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},c=lA({header:s,payload:u}),f=Ga.sign(n.secretKey,c);return fA({header:s,payload:u,signature:f})}async function YW(t){let{header:e,payload:r,data:n,signature:i}=hA(t);if(e.alg!==ep||e.typ!==tp)throw new Error("JWT must use EdDSA algorithm");let s=cA(r.iss);return Ga.verify(s,n,i)}var Ga,mP,wP,EP=fe(()=>{l();Ga=be(ND()),mP=be(Kc()),wP=be($s());up();dA()});var vP=fe(()=>{l()});var AP={};ct(AP,{DATA_ENCODING:()=>Xc,DID_DELIMITER:()=>np,DID_METHOD:()=>sp,DID_PREFIX:()=>ip,JSON_ENCODING:()=>rp,JWT_DELIMITER:()=>Xs,JWT_ENCODING:()=>Ba,JWT_IRIDIUM_ALG:()=>ep,JWT_IRIDIUM_TYP:()=>tp,KEY_PAIR_SEED_LENGTH:()=>DD,MULTICODEC_ED25519_BASE:()=>op,MULTICODEC_ED25519_ENCODING:()=>La,MULTICODEC_ED25519_HEADER:()=>ap,MULTICODEC_ED25519_LENGTH:()=>OD,decodeData:()=>zW,decodeIss:()=>cA,decodeJSON:()=>sl,decodeJWT:()=>hA,decodeSig:()=>yP,encodeData:()=>lA,encodeIss:()=>uA,encodeJSON:()=>ol,encodeJWT:()=>fA,encodeSig:()=>gP,generateKeyPair:()=>$W,signJWT:()=>KW,verifyJWT:()=>YW});var bP=fe(()=>{l();EP();up();vP();dA()});var _P=E(mp=>{"use strict";l();Object.defineProperty(mp,"__esModule",{value:!0});var Zt=Oa(),pA=Hr(),JW=20;function XW(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],c=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],h=r[19]<<24|r[18]<<16|r[17]<<8|r[16],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],y=r[27]<<24|r[26]<<16|r[25]<<8|r[24],m=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],W=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,A=i,_=s,N=o,I=a,S=u,R=c,J=f,Q=h,V=g,k=y,K=m,ge=T,ue=O,re=B,Y=W,se=0;se>>16|ge<<16,Q=Q+ge|0,I^=Q,I=I>>>20|I<<12,A=A+S|0,ue^=A,ue=ue>>>16|ue<<16,V=V+ue|0,S^=V,S=S>>>20|S<<12,_=_+R|0,re^=_,re=re>>>16|re<<16,k=k+re|0,R^=k,R=R>>>20|R<<12,N=N+J|0,Y^=N,Y=Y>>>16|Y<<16,K=K+Y|0,J^=K,J=J>>>20|J<<12,_=_+R|0,re^=_,re=re>>>24|re<<8,k=k+re|0,R^=k,R=R>>>25|R<<7,N=N+J|0,Y^=N,Y=Y>>>24|Y<<8,K=K+Y|0,J^=K,J=J>>>25|J<<7,A=A+S|0,ue^=A,ue=ue>>>24|ue<<8,V=V+ue|0,S^=V,S=S>>>25|S<<7,U=U+I|0,ge^=U,ge=ge>>>24|ge<<8,Q=Q+ge|0,I^=Q,I=I>>>25|I<<7,U=U+S|0,Y^=U,Y=Y>>>16|Y<<16,k=k+Y|0,S^=k,S=S>>>20|S<<12,A=A+R|0,ge^=A,ge=ge>>>16|ge<<16,K=K+ge|0,R^=K,R=R>>>20|R<<12,_=_+J|0,ue^=_,ue=ue>>>16|ue<<16,Q=Q+ue|0,J^=Q,J=J>>>20|J<<12,N=N+I|0,re^=N,re=re>>>16|re<<16,V=V+re|0,I^=V,I=I>>>20|I<<12,_=_+J|0,ue^=_,ue=ue>>>24|ue<<8,Q=Q+ue|0,J^=Q,J=J>>>25|J<<7,N=N+I|0,re^=N,re=re>>>24|re<<8,V=V+re|0,I^=V,I=I>>>25|I<<7,A=A+R|0,ge^=A,ge=ge>>>24|ge<<8,K=K+ge|0,R^=K,R=R>>>25|R<<7,U=U+S|0,Y^=U,Y=Y>>>24|Y<<8,k=k+Y|0,S^=k,S=S>>>25|S<<7;Zt.writeUint32LE(U+n|0,t,0),Zt.writeUint32LE(A+i|0,t,4),Zt.writeUint32LE(_+s|0,t,8),Zt.writeUint32LE(N+o|0,t,12),Zt.writeUint32LE(I+a|0,t,16),Zt.writeUint32LE(S+u|0,t,20),Zt.writeUint32LE(R+c|0,t,24),Zt.writeUint32LE(J+f|0,t,28),Zt.writeUint32LE(Q+h|0,t,32),Zt.writeUint32LE(V+g|0,t,36),Zt.writeUint32LE(k+y|0,t,40),Zt.writeUint32LE(K+m|0,t,44),Zt.writeUint32LE(ge+T|0,t,48),Zt.writeUint32LE(ue+O|0,t,52),Zt.writeUint32LE(re+B|0,t,56),Zt.writeUint32LE(Y+W|0,t,60)}function IP(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var wp=E(ka=>{"use strict";l();Object.defineProperty(ka,"__esModule",{value:!0});function tz(t,e,r){return~(t-1)&e|t-1&r}ka.select=tz;function rz(t,e){return(t|0)-(e|0)-1>>>31&1}ka.lessOrEqual=rz;function SP(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}ka.compare=SP;function nz(t,e){return t.length===0||e.length===0?!1:SP(t,e)!==0}ka.equal=nz});var CP=E(ni=>{"use strict";l();Object.defineProperty(ni,"__esModule",{value:!0});var iz=wp(),Ep=Hr();ni.DIGEST_LENGTH=16;var TP=function(){function t(e){this.digestLength=ni.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var c=e[14]|e[15]<<8;this._r[8]=(u>>>8|c<<8)&8191,this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],c=this._h[4],f=this._h[5],h=this._h[6],g=this._h[7],y=this._h[8],m=this._h[9],T=this._r[0],O=this._r[1],B=this._r[2],W=this._r[3],U=this._r[4],A=this._r[5],_=this._r[6],N=this._r[7],I=this._r[8],S=this._r[9];n>=16;){var R=e[r+0]|e[r+1]<<8;s+=R&8191;var J=e[r+2]|e[r+3]<<8;o+=(R>>>13|J<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(J>>>10|Q<<6)&8191;var V=e[r+6]|e[r+7]<<8;u+=(Q>>>7|V<<9)&8191;var k=e[r+8]|e[r+9]<<8;c+=(V>>>4|k<<12)&8191,f+=k>>>1&8191;var K=e[r+10]|e[r+11]<<8;h+=(k>>>14|K<<2)&8191;var ge=e[r+12]|e[r+13]<<8;g+=(K>>>11|ge<<5)&8191;var ue=e[r+14]|e[r+15]<<8;y+=(ge>>>8|ue<<8)&8191,m+=ue>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*S),Y+=a*(5*I),Y+=u*(5*N),Y+=c*(5*_),re=Y>>>13,Y&=8191,Y+=f*(5*A),Y+=h*(5*U),Y+=g*(5*W),Y+=y*(5*B),Y+=m*(5*O),re+=Y>>>13,Y&=8191;var se=re;se+=s*O,se+=o*T,se+=a*(5*S),se+=u*(5*I),se+=c*(5*N),re=se>>>13,se&=8191,se+=f*(5*_),se+=h*(5*A),se+=g*(5*U),se+=y*(5*W),se+=m*(5*B),re+=se>>>13,se&=8191;var te=re;te+=s*B,te+=o*O,te+=a*T,te+=u*(5*S),te+=c*(5*I),re=te>>>13,te&=8191,te+=f*(5*N),te+=h*(5*_),te+=g*(5*A),te+=y*(5*U),te+=m*(5*W),re+=te>>>13,te&=8191;var ie=re;ie+=s*W,ie+=o*B,ie+=a*O,ie+=u*T,ie+=c*(5*S),re=ie>>>13,ie&=8191,ie+=f*(5*I),ie+=h*(5*N),ie+=g*(5*_),ie+=y*(5*A),ie+=m*(5*U),re+=ie>>>13,ie&=8191;var M=re;M+=s*U,M+=o*W,M+=a*B,M+=u*O,M+=c*T,re=M>>>13,M&=8191,M+=f*(5*S),M+=h*(5*I),M+=g*(5*N),M+=y*(5*_),M+=m*(5*A),re+=M>>>13,M&=8191;var le=re;le+=s*A,le+=o*U,le+=a*W,le+=u*B,le+=c*O,re=le>>>13,le&=8191,le+=f*T,le+=h*(5*S),le+=g*(5*I),le+=y*(5*N),le+=m*(5*_),re+=le>>>13,le&=8191;var ae=re;ae+=s*_,ae+=o*A,ae+=a*U,ae+=u*W,ae+=c*B,re=ae>>>13,ae&=8191,ae+=f*O,ae+=h*T,ae+=g*(5*S),ae+=y*(5*I),ae+=m*(5*N),re+=ae>>>13,ae&=8191;var he=re;he+=s*N,he+=o*_,he+=a*A,he+=u*U,he+=c*W,re=he>>>13,he&=8191,he+=f*B,he+=h*O,he+=g*T,he+=y*(5*S),he+=m*(5*I),re+=he>>>13,he&=8191;var oe=re;oe+=s*I,oe+=o*N,oe+=a*_,oe+=u*A,oe+=c*U,re=oe>>>13,oe&=8191,oe+=f*W,oe+=h*B,oe+=g*O,oe+=y*T,oe+=m*(5*S),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*S,ce+=o*I,ce+=a*N,ce+=u*_,ce+=c*A,re=ce>>>13,ce&=8191,ce+=f*U,ce+=h*W,ce+=g*B,ce+=y*O,ce+=m*T,re+=ce>>>13,ce&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,se+=re,s=Y,o=se,a=te,u=ie,c=M,f=le,h=ae,g=he,y=oe,m=ce,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=c,this._h[5]=f,this._h[6]=h,this._h[7]=g,this._h[8]=y,this._h[9]=m},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";l();Object.defineProperty(ii,"__esModule",{value:!0});var vp=_P(),az=CP(),al=Hr(),xP=Oa(),uz=wp();ii.KEY_LENGTH=32;ii.NONCE_LENGTH=12;ii.TAG_LENGTH=16;var NP=new Uint8Array(16),cz=function(){function t(e){if(this.nonceLength=ii.NONCE_LENGTH,this.tagLength=ii.TAG_LENGTH,e.length!==ii.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);vp.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return vp.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),al.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(NP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(NP.subarray(n.length%16));var o=new Uint8Array(8);i&&xP.writeUint64LE(i.length,o),s.update(o),xP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(gA,"__esModule",{value:!0});function lz(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}gA.isSerializableHash=lz});var RP=E(ul=>{"use strict";l();Object.defineProperty(ul,"__esModule",{value:!0});var On=DP(),fz=wp(),hz=Hr(),PP=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";l();Object.defineProperty(yA,"__esModule",{value:!0});var BP=RP(),LP=Hr(),pz=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=BP.hmac(this._hash,n,r);this._hmac=new BP.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";l();Object.defineProperty(Wi,"__esModule",{value:!0});var bp=Oa(),Ap=Hr();Wi.DIGEST_LENGTH=32;Wi.BLOCK_SIZE=64;var MP=function(){function t(){this.digestLength=Wi.DIGEST_LENGTH,this.blockSize=Wi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Ap.wipe(this._buffer),Ap.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(mA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=mA(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Ap.wipe(e.state),e.buffer&&Ap.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Wi.SHA256=MP;var gz=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function mA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],c=e[4],f=e[5],h=e[6],g=e[7],y=0;y<16;y++){var m=n+y*4;t[y]=bp.readUint32BE(r,m)}for(var y=16;y<64;y++){var T=t[y-2],O=(T>>>17|T<<15)^(T>>>19|T<<13)^T>>>10;T=t[y-15];var B=(T>>>7|T<<25)^(T>>>18|T<<14)^T>>>3;t[y]=(O+t[y-7]|0)+(B+t[y-16]|0)}for(var y=0;y<64;y++){var O=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&h)|0)+(g+(gz[y]+t[y]|0)|0)|0,B=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&a^o&a)|0;g=h,h=f,f=c,c=u+O|0,u=a,a=o,o=s,s=O+B|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=c,e[5]+=f,e[6]+=h,e[7]+=g,n+=64,i-=64}return n}function yz(t){var e=new MP;e.update(t);var r=e.digest();return e.clean(),r}Wi.hash=yz});var GP=E(gt=>{"use strict";l();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var mz=Kc(),wz=Hr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.SHARED_KEY_LENGTH=32;function Dn(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,cl(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function Az(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Ip(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function _p(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function si(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,h=0,g=0,y=0,m=0,T=0,O=0,B=0,W=0,U=0,A=0,_=0,N=0,I=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,ge=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],he=r[5],oe=r[6],ce=r[7],w=r[8],v=r[9],b=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,c+=n*ae,f+=n*he,h+=n*oe,g+=n*ce,y+=n*w,m+=n*v,T+=n*b,O+=n*P,B+=n*C,W+=n*D,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,c+=n*le,f+=n*ae,h+=n*he,g+=n*oe,y+=n*ce,m+=n*w,T+=n*v,O+=n*b,B+=n*P,W+=n*C,U+=n*D,A+=n*L,_+=n*x,n=e[2],a+=n*te,u+=n*ie,c+=n*M,f+=n*le,h+=n*ae,g+=n*he,y+=n*oe,m+=n*ce,T+=n*w,O+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*D,_+=n*L,N+=n*x,n=e[3],u+=n*te,c+=n*ie,f+=n*M,h+=n*le,g+=n*ae,y+=n*he,m+=n*oe,T+=n*ce,O+=n*w,B+=n*v,W+=n*b,U+=n*P,A+=n*C,_+=n*D,N+=n*L,I+=n*x,n=e[4],c+=n*te,f+=n*ie,h+=n*M,g+=n*le,y+=n*ae,m+=n*he,T+=n*oe,O+=n*ce,B+=n*w,W+=n*v,U+=n*b,A+=n*P,_+=n*C,N+=n*D,I+=n*L,S+=n*x,n=e[5],f+=n*te,h+=n*ie,g+=n*M,y+=n*le,m+=n*ae,T+=n*he,O+=n*oe,B+=n*ce,W+=n*w,U+=n*v,A+=n*b,_+=n*P,N+=n*C,I+=n*D,S+=n*L,R+=n*x,n=e[6],h+=n*te,g+=n*ie,y+=n*M,m+=n*le,T+=n*ae,O+=n*he,B+=n*oe,W+=n*ce,U+=n*w,A+=n*v,_+=n*b,N+=n*P,I+=n*C,S+=n*D,R+=n*L,J+=n*x,n=e[7],g+=n*te,y+=n*ie,m+=n*M,T+=n*le,O+=n*ae,B+=n*he,W+=n*oe,U+=n*ce,A+=n*w,_+=n*v,N+=n*b,I+=n*P,S+=n*C,R+=n*D,J+=n*L,Q+=n*x,n=e[8],y+=n*te,m+=n*ie,T+=n*M,O+=n*le,B+=n*ae,W+=n*he,U+=n*oe,A+=n*ce,_+=n*w,N+=n*v,I+=n*b,S+=n*P,R+=n*C,J+=n*D,Q+=n*L,V+=n*x,n=e[9],m+=n*te,T+=n*ie,O+=n*M,B+=n*le,W+=n*ae,U+=n*he,A+=n*oe,_+=n*ce,N+=n*w,I+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*D,V+=n*L,k+=n*x,n=e[10],T+=n*te,O+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*he,_+=n*oe,N+=n*ce,I+=n*w,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*D,k+=n*L,K+=n*x,n=e[11],O+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,_+=n*he,N+=n*oe,I+=n*ce,S+=n*w,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*D,K+=n*L,ge+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,_+=n*ae,N+=n*he,I+=n*oe,S+=n*ce,R+=n*w,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*D,ge+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,_+=n*le,N+=n*ae,I+=n*he,S+=n*oe,R+=n*ce,J+=n*w,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,ge+=n*D,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,_+=n*M,N+=n*le,I+=n*ae,S+=n*he,R+=n*oe,J+=n*ce,Q+=n*w,V+=n*v,k+=n*b,K+=n*P,ge+=n*C,ue+=n*D,re+=n*L,Y+=n*x,n=e[15],A+=n*te,_+=n*ie,N+=n*M,I+=n*le,S+=n*ae,R+=n*he,J+=n*oe,Q+=n*ce,V+=n*w,k+=n*v,K+=n*b,ge+=n*P,ue+=n*C,re+=n*D,Y+=n*L,se+=n*x,s+=38*_,o+=38*N,a+=38*I,u+=38*S,c+=38*R,f+=38*J,h+=38*Q,g+=38*V,y+=38*k,m+=38*K,T+=38*ge,O+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=h,t[7]=g,t[8]=y,t[9]=m,t[10]=T,t[11]=O,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function ll(t,e){si(t,e,e)}function bz(t,e){let r=Dn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)ll(r,r),n!==2&&n!==4&&si(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function EA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Dn(),s=Dn(),o=Dn(),a=Dn(),u=Dn(),c=Dn();for(let y=0;y<31;y++)r[y]=t[y];r[31]=t[31]&127|64,r[0]&=248,Az(n,e);for(let y=0;y<16;y++)s[y]=n[y];i[0]=a[0]=1;for(let y=254;y>=0;--y){let m=r[y>>>3]>>>(y&7)&1;cl(i,s,m),cl(o,a,m),Ip(u,i,o),_p(i,i,o),Ip(o,s,a),_p(s,s,a),ll(a,u),ll(c,i),si(i,o,i),si(o,s,u),Ip(u,i,o),_p(i,i,o),ll(s,i),_p(o,a,c),si(i,o,Ez),Ip(i,i,a),si(o,o,i),si(i,a,c),si(a,s,n),ll(s,u),cl(i,s,m),cl(o,a,m)}for(let y=0;y<16;y++)n[y+16]=i[y],n[y+32]=o[y],n[y+48]=s[y],n[y+64]=a[y];let f=n.subarray(32),h=n.subarray(16);bz(f,f),si(h,h,f);let g=new Uint8Array(32);return vz(g,h),g}gt.scalarMult=EA;function VP(t){return EA(t,qP)}gt.scalarMultBase=VP;function HP(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:VP(e),secretKey:e}}gt.generateKeyPairFromSeed=HP;function Iz(t){let e=(0,mz.randomBytes)(32,t),r=HP(e);return(0,wz.wipe)(e),r}gt.generateKeyPair=Iz;function _z(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=EA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{l()});function QP(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{l()});function zP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Fa(t.length);for(let n=0;n{l();cp();Zc()});var vA={};ct(vA,{compare:()=>kP,concat:()=>lp,equals:()=>QP,fromString:()=>Nn,toString:()=>ri,xor:()=>zP});var AA=fe(()=>{l();jP();B1();WP();aA();oA();$P()});var o3=E(st=>{"use strict";l();var KP=st&&st.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new r3:typeof navigator<"u"?bA(navigator.userAgent):s3()}st.detect=xz;function n3(t){return t!==""&&Cz.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Nz(t){var e=n3(t);return e?e[0]:null}st.browserName=Nz;function bA(t){var e=n3(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new t3;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";l();Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getLocalStorage=Ye.getLocalStorageOrThrow=Ye.getCrypto=Ye.getCryptoOrThrow=Ye.getLocation=Ye.getLocationOrThrow=Ye.getNavigator=Ye.getNavigatorOrThrow=Ye.getDocument=Ye.getDocumentOrThrow=Ye.getFromWindowOrThrow=Ye.getFromWindow=void 0;function eo(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=eo;function ja(t){let e=eo(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=ja;function Dz(){return ja("document")}Ye.getDocumentOrThrow=Dz;function Pz(){return eo("document")}Ye.getDocument=Pz;function Rz(){return ja("navigator")}Ye.getNavigatorOrThrow=Rz;function Bz(){return eo("navigator")}Ye.getNavigator=Bz;function Lz(){return ja("location")}Ye.getLocationOrThrow=Lz;function Fz(){return eo("location")}Ye.getLocation=Fz;function Mz(){return ja("crypto")}Ye.getCryptoOrThrow=Mz;function Uz(){return eo("crypto")}Ye.getCrypto=Uz;function qz(){return ja("localStorage")}Ye.getLocalStorageOrThrow=qz;function Vz(){return eo("localStorage")}Ye.getLocalStorage=Vz});var u3=E(Sp=>{"use strict";l();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.getWindowMetadata=void 0;var a3=IA();function Hz(){let t,e;try{t=a3.getDocumentOrThrow(),e=a3.getLocationOrThrow()}catch{return null}function r(){let h=t.getElementsByTagName("link"),g=[];for(let y=0;y-1){let O=m.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(O.indexOf("/")===0)B+=O;else{let W=e.pathname.split("/");W.pop();let U=W.join("/");B+=U+"/"+O}g.push(B)}else if(O.indexOf("//")===0){let B=e.protocol+O;g.push(B)}else g.push(O)}}return g}function n(...h){let g=t.getElementsByTagName("meta");for(let y=0;ym.getAttribute(O)).filter(O=>O?h.includes(O):!1);if(T.length&&T){let O=m.getAttribute("content");if(O)return O}}return""}function i(){let h=n("name","og:site_name","og:title","twitter:title");return h||(h=t.title),h}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,c=r();return{description:a,url:u,icons:c,name:o}}Sp.getWindowMetadata=Hz});var l3=E((qpe,c3)=>{"use strict";l();c3.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var g3=E((Hpe,p3)=>{"use strict";l();var d3="%[a-f0-9]{2}",f3=new RegExp("("+d3+")|([^%]+?)","gi"),h3=new RegExp("("+d3+")+","gi");function _A(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],_A(r),_A(n))}function Gz(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(f3)||[],r=1;r{"use strict";l();y3.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var E3=E((Qpe,w3)=>{"use strict";l();w3.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";l();var jz=l3(),Qz=g3(),A3=m3(),Wz=E3(),zz=t=>t==null,SA=Symbol("encodeFragmentIdentifier");function $z(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[",i,"]"].join("")]:[...r,[vt(e,t),"[",vt(i,t),"]=",vt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[]"].join("")]:[...r,[vt(e,t),"[]=",vt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),":list="].join("")]:[...r,[vt(e,t),":list=",vt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[vt(r,t),e,vt(i,t)].join("")]:[[n,vt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,vt(e,t)]:[...r,[vt(e,t),"=",vt(n,t)].join("")]}}function Kz(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&oi(n,t).includes(t.arrayFormatSeparator);n=o?oi(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>oi(u,t)):n===null?n:oi(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&oi(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>oi(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function b3(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function vt(t,e){return e.encode?e.strict?jz(t):encodeURIComponent(t):t}function oi(t,e){return e.decode?Qz(t):t}function I3(t){return Array.isArray(t)?t.sort():typeof t=="object"?I3(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function _3(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function Yz(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function S3(t){t=_3(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function v3(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function T3(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),b3(e.arrayFormatSeparator);let r=Kz(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=A3(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:oi(o,e),r(oi(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=v3(s[o],e);else n[i]=v3(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=I3(o):i[s]=o,i},Object.create(null))}yr.extract=S3;yr.parse=T3;yr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),b3(e.arrayFormatSeparator);let r=o=>e.skipNull&&zz(t[o])||e.skipEmptyString&&t[o]==="",n=$z(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?vt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?vt(o,e)+"[]":a.reduce(n(o),[]).join("&"):vt(o,e)+"="+vt(a,e)}).filter(o=>o.length>0).join("&")};yr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=A3(t,"#");return Object.assign({url:r.split("?")[0]||"",query:T3(S3(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:oi(n,e)}:{})};yr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[SA]:!0},e);let r=_3(t.url).split("?")[0]||"",n=yr.extract(t.url),i=yr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=yr.stringify(s,e);o&&(o=`?${o}`);let a=Yz(t.url);return t.fragmentIdentifier&&(a=`#${e[SA]?vt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};yr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[SA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=yr.parseUrl(t,r);return yr.stringifyUrl({url:n,query:Wz(i,e),fragmentIdentifier:s},r)};yr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return yr.pick(t,n,r)}});var x3=fe(()=>{l()});function zi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function Jz(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function Xz(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function Zz(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function fl(t,e,r){return(!r.length?Xz(t,e.length):Zz(t,e.length))?Jz(t,e):!1}function hl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var TA=fe(()=>{l()});function e$(t){return Tp(t.method)&&Cp(t.params)}function Tp(t){return hl(t,"subscribe")}function Cp(t){return fl(t,["topic"],[])}function t$(t){return xp(t.method)&&Np(t.params)}function xp(t){return hl(t,"publish")}function Np(t){return fl(t,["message","topic","ttl"],["prompt","tag"])}function r$(t){return Op(t.method)&&Dp(t.params)}function Op(t){return hl(t,"unsubscribe")}function Dp(t){return fl(t,["id","topic"],[])}function n$(t){return Pp(t.method)&&Rp(t.params)}function Pp(t){return hl(t,"subscription")}function Rp(t){return fl(t,["id","data"],[])}var CA=fe(()=>{l();TA()});function i$(t){if(!Tp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Cp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return zi(e,"topic"),e}function s$(t){if(!xp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Np(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return zi(e,"topic"),zi(e,"message"),zi(e,"ttl","number"),e}function o$(t){if(!Op(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Dp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return zi(e,"id"),e}function a$(t){if(!Pp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Rp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return zi(e,"id"),zi(e,"data"),e}var N3=fe(()=>{l();TA();CA()});var u$,O3=fe(()=>{l();u$={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var D3={};ct(D3,{RELAY_JSONRPC:()=>u$,isPublishMethod:()=>xp,isPublishParams:()=>Np,isPublishRequest:()=>t$,isSubscribeMethod:()=>Tp,isSubscribeParams:()=>Cp,isSubscribeRequest:()=>e$,isSubscriptionMethod:()=>Pp,isSubscriptionParams:()=>Rp,isSubscriptionRequest:()=>n$,isUnsubscribeMethod:()=>Op,isUnsubscribeParams:()=>Dp,isUnsubscribeRequest:()=>r$,parsePublishRequest:()=>s$,parseSubscribeRequest:()=>i$,parseSubscriptionRequest:()=>a$,parseUnsubscribeRequest:()=>o$});var P3=fe(()=>{l();x3();N3();O3();CA()});var wl=E(G=>{"use strict";l();Object.defineProperty(G,"__esModule",{value:!0});var G3=OP(),c$=FP(),k3=Kc(),RA=UP(),l$=GP(),ot=(AA(),ft(vA)),f$=o3(),Qa=$s(),dl=IA(),h$=u3(),d$=C3(),p$=(P3(),ft(D3));function j3(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var Q3=j3(l$),Bp=j3(d$),Mp=":";function W3(t){let[e,r]=t.split(Mp);return{namespace:e,reference:r}}function z3(t){let{namespace:e,reference:r}=t;return[e,r].join(Mp)}function BA(t){let[e,r,n]=t.split(Mp);return{namespace:e,reference:r,address:n}}function $3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Mp)}function LA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function K3(t){let{address:e}=BA(t);return e}function Y3(t){let{namespace:e,reference:r}=BA(t);return z3({namespace:e,reference:r})}function g$(t,e){let{namespace:r,reference:n}=W3(e);return $3({namespace:r,reference:n,address:t})}function y$(t){return LA(t,K3)}function J3(t){return LA(t,Y3)}function m$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function w$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...J3(i.accounts))}),r}function E$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Up(n,i))}),r}function Up(t,e){return t.includes(":")?[t]:e.chains||[]}var qp=t=>t?.split(":"),X3=t=>{let e=t&&qp(t);if(e)return e[3]},v$=t=>{let e=t&&qp(t);if(e)return e[2]+":"+e[3]},Z3=t=>{let e=t&&qp(t);if(e)return e.pop()},A$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=Z3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${X3(e)}`,u=`Nonce: ${t.nonce}`,c=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +${t.resources.map(h=>`- ${h}`).join(` +`)}`:void 0;return[r,n,"",i,"",s,o,a,u,c,f].filter(h=>h!=null).join(` +`)},FA="base10",ir="base16",Lp="base64pad",Vp="utf8",MA=0,Wa=1,b$=0,R3=1,NA=12,UA=32;function I$(){let t=Q3.generateKeyPair();return{privateKey:ot.toString(t.secretKey,ir),publicKey:ot.toString(t.publicKey,ir)}}function _$(){let t=k3.randomBytes(UA);return ot.toString(t,ir)}function S$(t,e){let r=Q3.sharedKey(ot.fromString(t,ir),ot.fromString(e,ir),!0),n=new c$.HKDF(RA.SHA256,r).expand(UA);return ot.toString(n,ir)}function T$(t){let e=RA.hash(ot.fromString(t,ir));return ot.toString(e,ir)}function C$(t){let e=RA.hash(ot.fromString(t,Vp));return ot.toString(e,ir)}function eR(t){return ot.fromString(`${t}`,FA)}function gl(t){return Number(ot.toString(t,FA))}function x$(t){let e=eR(typeof t.type<"u"?t.type:MA);if(gl(e)===Wa&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,ir):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,ir):k3.randomBytes(NA),i=new G3.ChaCha20Poly1305(ot.fromString(t.symKey,ir)).seal(n,ot.fromString(t.message,Vp));return tR({type:e,sealed:i,iv:n,senderPublicKey:r})}function N$(t){let e=new G3.ChaCha20Poly1305(ot.fromString(t.symKey,ir)),{sealed:r,iv:n}=qA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Vp)}function tR(t){if(gl(t.type)===Wa){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Lp)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Lp)}function qA(t){let e=ot.fromString(t,Lp),r=e.slice(b$,R3),n=R3;if(gl(r)===Wa){let a=n+UA,u=a+NA,c=e.slice(n,a),f=e.slice(a,u),h=e.slice(u);return{type:r,sealed:h,iv:f,senderPublicKey:c}}let i=n+NA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function O$(t,e){let r=qA(t);return rR({type:gl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,ir):void 0,receiverPublicKey:e?.receiverPublicKey})}function rR(t){let e=t?.type||MA;if(e===Wa){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function D$(t){return t.type===Wa&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var P$=Object.defineProperty,B3=Object.getOwnPropertySymbols,R$=Object.prototype.hasOwnProperty,B$=Object.prototype.propertyIsEnumerable,L3=(t,e,r)=>e in t?P$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F3=(t,e)=>{for(var r in e||(e={}))R$.call(e,r)&&L3(t,r,e[r]);if(B3)for(var r of B3(e))B$.call(e,r)&&L3(t,r,e[r]);return t},nR="ReactNative",nr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Fp=" ",L$=":",iR="/",VA=2,F$=1e3,sR="js";function HA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function yl(){return!dl.getDocument()&&!!dl.getNavigator()&&navigator.product===nR}function Hp(){return!HA()&&!!dl.getNavigator()}function ro(){return yl()?nr.reactNative:HA()?nr.node:Hp()?nr.browser:nr.unknown}function oR(t,e){let r=Bp.parse(t);return r=F3(F3({},r),e),t=Bp.stringify(r),t}function M$(){return h$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function U$(t,e){var r;let n=ro(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=dl.getLocation())==null?void 0:r.host)||"unknown"),i}function aR(){if(ro()===nr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=f$.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function uR(){var t;let e=ro();return e===nr.browser?[e,((t=dl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function cR(t,e,r){let n=aR(),i=uR();return[[t,e].join("-"),[sR,r].join("-"),n,i].join("/")}function q$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=cR(t,e,n),c={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=oR(a[1]||"",c);return a[0]+"?"+f}function V$(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function H$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function lR(t,e=VA){return fR(t.split(iR),e)}function G$(t){return lR(t).join(Fp)}function $i(t,e){return t.filter(r=>e.includes(r)).length===t.length}function fR(t,e=VA){return t.slice(Math.max(t.length-e,0))}function k$(t){return Object.fromEntries(t.entries())}function j$(t){return new Map(Object.entries(t))}function Q$(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var W$=t=>t;function hR(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function z$(t){return t.split(Fp).map(e=>hR(e)).join(Fp)}function $$(t=Qa.FIVE_MINUTES,e){let r=Qa.toMiliseconds(t||Qa.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function K$(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function GA(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Y$(t){return GA("topic",t)}function J$(t){return GA("id",t)}function X$(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Z$(t,e){return Qa.fromMiliseconds((e||Date.now())+Qa.toMiliseconds(t))}function eK(t){return Date.now()>=Qa.toMiliseconds(t)}function tK(t,e){return`${t}${e?`:${e}`:""}`}function Ki(t=[],e=[]){return[...new Set([...t,...e])]}async function rK({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=ro();o===nr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===nr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var dR="irn";function nK(t){return t?.relay||{protocol:dR}}function iK(t){let e=p$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var sK=Object.defineProperty,M3=Object.getOwnPropertySymbols,oK=Object.prototype.hasOwnProperty,aK=Object.prototype.propertyIsEnumerable,U3=(t,e,r)=>e in t?sK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uK=(t,e)=>{for(var r in e||(e={}))oK.call(e,r)&&U3(t,r,e[r]);if(M3)for(var r of M3(e))aK.call(e,r)&&U3(t,r,e[r]);return t};function pR(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function cK(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Bp.parse(s);return{protocol:n,topic:gR(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:pR(o)}}function gR(t){return t.startsWith("//")?t.substring(2):t}function yR(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function lK(t){return`${t.protocol}:${t.topic}@${t.version}?`+Bp.stringify(uK({symKey:t.symKey},yR(t.relay)))}var fK=Object.defineProperty,hK=Object.defineProperties,dK=Object.getOwnPropertyDescriptors,q3=Object.getOwnPropertySymbols,pK=Object.prototype.hasOwnProperty,gK=Object.prototype.propertyIsEnumerable,V3=(t,e,r)=>e in t?fK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yK=(t,e)=>{for(var r in e||(e={}))pK.call(e,r)&&V3(t,r,e[r]);if(q3)for(var r of q3(e))gK.call(e,r)&&V3(t,r,e[r]);return t},mK=(t,e)=>hK(t,dK(e));function no(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function mR(t){let e=[];return Object.values(t).forEach(r=>{e.push(...no(r.accounts))}),e}function wR(t,e){let r=[];return Object.values(t).forEach(n=>{no(n.accounts).includes(e)&&r.push(...n.methods)}),r}function ER(t,e){let r=[];return Object.values(t).forEach(n=>{no(n.accounts).includes(e)&&r.push(...n.events)}),r}function wK(t,e){let r=CR(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function EK(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=OA(e),s=OA(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,h=n[c].methods,g=n[c].events,y=n[c].accounts;f.forEach(m=>{if(!y.some(T=>T.includes(m)))throw new Error(`No accounts provided for chain ${m} in namespace ${c}`)}),o[c]={chains:f,methods:h,events:g,accounts:y}});let a=NR(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(m=>{var T,O;return(O=(T=i[c])==null?void 0:T.chains)==null?void 0:O.includes(m)}),h=n[c].methods.filter(m=>{var T,O;return(O=(T=i[c])==null?void 0:T.methods)==null?void 0:O.includes(m)}),g=n[c].events.filter(m=>{var T,O;return(O=(T=i[c])==null?void 0:T.events)==null?void 0:O.includes(m)}),y=f.map(m=>n[c].accounts.filter(T=>T.includes(`${m}:`))).flat();u[c]={chains:f,methods:h,events:g,accounts:y}}),Object.keys(s).forEach(c=>{var f,h,g,y,m,T;if(!n[c])return;let O=(h=(f=s[c])==null?void 0:f.chains)==null?void 0:h.filter(A=>n[c].chains.includes(A)),B=n[c].methods.filter(A=>{var _,N;return(N=(_=s[c])==null?void 0:_.methods)==null?void 0:N.includes(A)}),W=n[c].events.filter(A=>{var _,N;return(N=(_=s[c])==null?void 0:_.events)==null?void 0:N.includes(A)}),U=O?.map(A=>n[c].accounts.filter(_=>_.includes(`${A}:`))).flat();u[c]={chains:Ki((g=u[c])==null?void 0:g.chains,O),methods:Ki((y=u[c])==null?void 0:y.methods,B),events:Ki((m=u[c])==null?void 0:m.events,W),accounts:Ki((T=u[c])==null?void 0:T.accounts,U)}}),u)}function kA(t){return t.includes(":")}function vR(t){return kA(t)?t.split(":")[0]:t}function OA(t){var e,r,n;let i={};if(!Gp(t))return i;for(let[s,o]of Object.entries(t)){let a=kA(s)?[s]:o.chains,u=o.methods||[],c=o.events||[],f=vR(s);i[f]=mK(yK({},i[f]),{chains:Ki(a,(e=i[f])==null?void 0:e.chains),methods:Ki(u,(r=i[f])==null?void 0:r.methods),events:Ki(c,(n=i[f])==null?void 0:n.events)})}return i}var vK={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},AK={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ai(t,e){let{message:r,code:n}=AK[t];return{message:e?`${r} ${e}`:r,code:n}}function to(t,e){let{message:r,code:n}=vK[t];return{message:e?`${r} ${e}`:r,code:n}}function ml(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Gp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Yi(t){return typeof t>"u"}function br(t,e){return e&&Yi(t)?!0:typeof t=="string"&&!!t.trim().length}function kp(t,e){return e&&Yi(t)?!0:typeof t=="number"&&!isNaN(t)}function bK(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return $i(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:c}=t.namespaces[o],f=no(a),h=r[o];(!$i(Up(o,h),f)||!$i(h.methods,u)||!$i(h.events,c))&&(s=!1)}),s):!1}function pl(t){return br(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function AR(t){if(br(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&pl(r)}}return!1}function IK(t){if(br(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function _K(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function SK(t){return t?.topic}function TK(t,e){let r=null;return br(t?.publicKey,!1)||(r=ai("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function DA(t){let e=!0;return ml(t)?t.length&&(e=t.every(r=>br(r,!1))):e=!1,e}function bR(t,e,r){let n=null;return ml(e)&&e.length?e.forEach(i=>{n||pl(i)||(n=to("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):pl(t)||(n=to("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function IR(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=bR(i,Up(i,s),`${e} ${r}`);o&&(n=o)}),n}function _R(t,e){let r=null;return ml(t)?t.forEach(n=>{r||AR(n)||(r=to("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=to("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function SR(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=_R(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function TR(t,e){let r=null;return DA(t?.methods)?DA(t?.events)||(r=to("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=to("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function jA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=TR(n,`${e}, namespace`);i&&(r=i)}),r}function CK(t,e,r){let n=null;if(t&&Gp(t)){let i=jA(t,e);i&&(n=i);let s=IR(t,e,r);s&&(n=s)}else n=ai("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function CR(t,e){let r=null;if(t&&Gp(t)){let n=jA(t,e);n&&(r=n);let i=SR(t,e);i&&(r=i)}else r=ai("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function xR(t){return br(t.protocol,!0)}function xK(t,e){let r=!1;return e&&!t?r=!0:t&&ml(t)&&t.length&&t.forEach(n=>{r=xR(n)}),r}function NK(t){return typeof t=="number"}function OK(t){return typeof t<"u"&&typeof t!==null}function DK(t){return!(!t||typeof t!="object"||!t.code||!kp(t.code,!1)||!t.message||!br(t.message,!1))}function PK(t){return!(Yi(t)||!br(t.method,!1))}function RK(t){return!(Yi(t)||Yi(t.result)&&Yi(t.error)||!kp(t.id,!1)||!br(t.jsonrpc,!1))}function BK(t){return!(Yi(t)||!br(t.name,!1))}function LK(t,e){return!(!pl(e)||!mR(t).includes(e))}function FK(t,e,r){return br(r,!1)?wR(t,e).includes(r):!1}function MK(t,e,r){return br(r,!1)?ER(t,e).includes(r):!1}function NR(t,e,r){let n=null,i=UK(t),s=qK(e),o=Object.keys(i),a=Object.keys(s),u=H3(Object.keys(t)),c=H3(Object.keys(e)),f=u.filter(h=>!c.includes(h));return f.length&&(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),ki(o,a)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),$i(o,a)||(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let g=Xs(e[d].accounts);g.includes(d)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} - Required: ${d} - Approved: ${g.toString()}`))}),o.forEach(d=>{n||(ki(i[d].methods,s[d].methods)?ki(i[d].events,s[d].events)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Kz(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function p3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Yz(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Xs(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function Jz(t,e){return Vp(t,!1)&&t<=e.max&&t>=e.min}function Xz(){let t=Js();return new Promise(e=>{switch(t){case tr.browser:e(nR());break;case tr.reactNative:e(iR());break;case tr.node:e(sR());break;default:e(!0)}})}function nR(){return Up()&&navigator?.onLine}async function iR(){return al()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function sR(){return!0}function Zz(t){switch(Js()){case tr.browser:oR(t);break;case tr.reactNative:aR(t);break;case tr.node:break}}function oR(t){!al()&&Up()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function aR(t){al()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var gA={},EA=class{static get(e){return gA[e]}static set(e,r){gA[e]=r}static delete(e){delete gA[e]}};G.BASE10=_A,G.BASE16=rr,G.BASE64=Pp,G.COLON=W$,G.DEFAULT_DEPTH=CA,G.EMPTY_SPACE=Rp,G.ENV_MAP=tr,G.MemoryStore=EA,G.ONE_THOUSAND=$$,G.REACT_NATIVE_PRODUCT=O3,G.RELAYER_DEFAULT_PROTOCOL=V3,G.SDK_TYPE=P3,G.SLASH=D3,G.TYPE_0=IA,G.TYPE_1=ka,G.UTF8=Mp,G.appendToQueryString=R3,G.assertType=X$,G.buildApprovedNamespaces=Oz,G.calcExpiry=lz,G.capitalize=iz,G.capitalizeWord=q3,G.createDelayedPromise=sz,G.createExpiringPromise=oz,G.decodeTypeByte=ol,G.decrypt=V$,G.deriveSymKey=F$,G.deserialize=TA,G.encodeTypeByte=C3,G.encrypt=q$,G.engineEvent=hz,G.enumify=nz,G.formatAccountId=A3,G.formatAccountWithChain=T$,G.formatChainId=v3,G.formatExpirerTarget=NA,G.formatIdTarget=uz,G.formatMessage=P$,G.formatMessageContext=Z$,G.formatRelayParams=k3,G.formatRelayRpcUrl=Y$,G.formatTopicTarget=az,G.formatUA=F3,G.formatUri=Az,G.generateKeyPair=B$,G.generateRandomBytes32=L$,G.getAccountsChains=Xs,G.getAccountsFromNamespaces=x$,G.getAddressFromAccount=b3,G.getAddressesFromAccounts=C$,G.getAppMetadata=z$,G.getBrowserOnlineStatus=nR,G.getChainFromAccount=_3,G.getChainsFromAccounts=I3,G.getChainsFromNamespace=Lp,G.getChainsFromNamespaces=N$,G.getChainsFromRequiredNamespaces=O$,G.getDidAddress=T3,G.getDidAddressSegments=Fp,G.getDidChainId=S3,G.getEnvironment=Js,G.getHttpUrl=J$,G.getInternalError=ii,G.getJavascriptID=L3,G.getJavascriptOS=B3,G.getLastItems=U3,G.getNamespacedDidChainId=D$,G.getNamespacesChains=j3,G.getNamespacesEventsForChainId=W3,G.getNamespacesMethodsForChainId=Q3,G.getNodeOnlineStatus=sR,G.getReactNativeOnlineStatus=iR,G.getRelayClientMetadata=K$,G.getRelayProtocolApi=gz,G.getRelayProtocolName=pz,G.getRequiredNamespacesFromNamespaces=Nz,G.getSdkError=Ys,G.getUniqueValues=bA,G.handleDeeplinkRedirect=dz,G.hasOverlap=ki,G.hashKey=M$,G.hashMessage=U$,G.isBrowser=Up,G.isCaipNamespace=OA,G.isConformingNamespaces=rR,G.isExpired=fz,G.isNode=xA,G.isOnline=Xz,G.isProposalStruct=Lz,G.isReactNative=al,G.isSessionCompatible=Rz,G.isSessionStruct=Fz,G.isTypeOneEnvelope=G$,G.isUndefined=Qi,G.isValidAccountId=z3,G.isValidAccounts=J3,G.isValidActions=Z3,G.isValidArray=ul,G.isValidChainId=sl,G.isValidChains=K3,G.isValidController=Mz,G.isValidErrorReason=Gz,G.isValidEvent=Qz,G.isValidId=Vz,G.isValidNamespaceAccounts=X3,G.isValidNamespaceActions=DA,G.isValidNamespaceChains=Y3,G.isValidNamespaceMethodsOrEvents=wA,G.isValidNamespaces=eR,G.isValidNamespacesChainId=Wz,G.isValidNamespacesEvent=zz,G.isValidNamespacesRequest=$z,G.isValidNumber=Vp,G.isValidObject=qp,G.isValidParams=Hz,G.isValidRelay=tR,G.isValidRelays=qz,G.isValidRequest=kz,G.isValidRequestExpiry=Jz,G.isValidRequiredNamespaces=Uz,G.isValidResponse=jz,G.isValidString=br,G.isValidUrl=Bz,G.mapEntries=rz,G.mapToObj=ez,G.mergeArrays=ji,G.normalizeNamespaces=mA,G.objToMap=tz,G.parseAccountId=AA,G.parseChainId=E3,G.parseContextNames=M3,G.parseExpirerTarget=cz,G.parseNamespaceKey=$3,G.parseRelayParams=H3,G.parseTopic=G3,G.parseUri=vz,G.serialize=x3,G.subscribeToBrowserNetworkChange=oR,G.subscribeToNetworkChange=Zz,G.subscribeToReactNativeNetworkChange=aR,G.validateDecoding=H$,G.validateEncoding=N3});var uR,cR,lR,fR,Hp,ll,PA,Gp,Wi,fl,kp=ge(()=>{c();uR="PARSE_ERROR",cR="INVALID_REQUEST",lR="METHOD_NOT_FOUND",fR="INVALID_PARAMS",Hp="INTERNAL_ERROR",ll="SERVER_ERROR",PA=[-32700,-32600,-32601,-32602,-32603],Gp=[-32e3,-32099],Wi={[uR]:{code:-32700,message:"Parse error"},[cR]:{code:-32600,message:"Invalid Request"},[lR]:{code:-32601,message:"Method not found"},[fR]:{code:-32602,message:"Invalid params"},[Hp]:{code:-32603,message:"Internal error"},[ll]:{code:-32e3,message:"Server error"}},fl=ll});function eK(t){return t<=Gp[0]&&t>=Gp[1]}function jp(t){return PA.includes(t)}function hR(t){return typeof t=="number"}function Qp(t){return Object.keys(Wi).includes(t)?Wi[t]:Wi[fl]}function Wp(t){let e=Object.values(Wi).find(r=>r.code===t);return e||Wi[fl]}function tK(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!hR(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(jp(t.error.code)){let e=Wp(t.error.code);if(e.message!==Wi[fl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function RA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var BA=ge(()=>{c();kp()});var pR=m($i=>{"use strict";c();Object.defineProperty($i,"__esModule",{value:!0});$i.isBrowserCryptoAvailable=$i.getSubtleCrypto=$i.getBrowerCrypto=void 0;function LA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}$i.getBrowerCrypto=LA;function dR(){let t=LA();return t.subtle||t.webkitSubtle}$i.getSubtleCrypto=dR;function rK(){return!!LA()&&!!dR()}$i.isBrowserCryptoAvailable=rK});var mR=m(zi=>{"use strict";c();Object.defineProperty(zi,"__esModule",{value:!0});zi.isBrowser=zi.isNode=zi.isReactNative=void 0;function gR(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zi.isReactNative=gR;function yR(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}zi.isNode=yR;function nK(){return!gR()&&!yR()}zi.isBrowser=nK});var FA=m($p=>{"use strict";c();Object.defineProperty($p,"__esModule",{value:!0});var wR=(vr(),ct(Er));wR.__exportStar(pR(),$p);wR.__exportStar(mR(),$p)});var Ft={};ft(Ft,{isNodeJs:()=>vR});var ER,vR,AR=ge(()=>{c();ER=_e(FA());Ht(Ft,_e(FA()));vR=ER.isNode});function MA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function UA(t=6){return BigInt(MA(t))}function qA(t,e,r){return{id:r||MA(),jsonrpc:"2.0",method:t,params:e}}function iK(t,e){return{id:t,jsonrpc:"2.0",result:e}}function VA(t,e,r){return{id:t,jsonrpc:"2.0",error:bR(e,r)}}function bR(t,e){return typeof t>"u"?Qp(Hp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Qp(ll)),{message:t})),typeof e<"u"&&(t.data=e),jp(t.code)&&(t=Wp(t.code)),t)}var _R=ge(()=>{c();BA();kp()});function sK(t){return t.includes("*")?Kp(t):!/\W/g.test(t)}function zp(t){return t==="*"}function Kp(t){return zp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function oK(t){return!zp(t)&&Kp(t)&&!t.split("*")[0].trim()}function aK(t){return!zp(t)&&Kp(t)&&!t.split("*")[1].trim()}var IR=ge(()=>{c()});var SR=ge(()=>{c()});var ja,HA=ge(()=>{c();ja=class{}});var GA,Yp,hl,TR=ge(()=>{c();HA();GA=class extends ja{constructor(e){super()}},Yp=class extends ja{constructor(){super()}},hl=class extends Yp{constructor(e){super()}}});var CR=ge(()=>{c()});var xR=ge(()=>{c();SR();HA();TR();CR()});var NR=ge(()=>{c();xR()});function lK(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function OR(t,e){let r=lK(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function fK(t){return OR(t,uK)}function Jp(t){return OR(t,cK)}function kA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var uK,cK,DR=ge(()=>{c();uK="^https?:",cK="^wss?:"});function jA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function hK(t){return jA(t)&&"method"in t}function QA(t){return jA(t)&&(PR(t)||Xp(t))}function PR(t){return"result"in t}function Xp(t){return"error"in t}function dK(t){return"error"in t&&t.valid===!1}var RR=ge(()=>{c()});var Zt={};ft(Zt,{DEFAULT_ERROR:()=>fl,IBaseJsonRpcProvider:()=>Yp,IEvents:()=>ja,IJsonRpcConnection:()=>GA,IJsonRpcProvider:()=>hl,INTERNAL_ERROR:()=>Hp,INVALID_PARAMS:()=>fR,INVALID_REQUEST:()=>cR,METHOD_NOT_FOUND:()=>lR,PARSE_ERROR:()=>uR,RESERVED_ERROR_CODES:()=>PA,SERVER_ERROR:()=>ll,SERVER_ERROR_CODE_RANGE:()=>Gp,STANDARD_ERROR_MAP:()=>Wi,formatErrorMessage:()=>bR,formatJsonRpcError:()=>VA,formatJsonRpcRequest:()=>qA,formatJsonRpcResult:()=>iK,getBigIntRpcId:()=>UA,getError:()=>Qp,getErrorByCode:()=>Wp,isHttpUrl:()=>fK,isJsonRpcError:()=>Xp,isJsonRpcPayload:()=>jA,isJsonRpcRequest:()=>hK,isJsonRpcResponse:()=>QA,isJsonRpcResult:()=>PR,isJsonRpcValidationInvalid:()=>dK,isLocalhostUrl:()=>kA,isNodeJs:()=>vR,isReservedErrorCode:()=>jp,isServerErrorCode:()=>eK,isValidDefaultRoute:()=>zp,isValidErrorCode:()=>hR,isValidLeadingWildcardRoute:()=>oK,isValidRoute:()=>sK,isValidTrailingWildcardRoute:()=>aK,isValidWildcardRoute:()=>Kp,isWsUrl:()=>Jp,parseConnectionError:()=>RA,payloadId:()=>MA,validateJsonRpcError:()=>tK});var dl=ge(()=>{c();kp();BA();AR();Ht(Zt,Ft);_R();IR();NR();DR();RR()});var BR,Zp,LR,WA=ge(()=>{c();BR=_e(Kn());dl();Zp=class extends hl{constructor(e){super(e),this.events=new BR.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(qA(e.method,e.params||[],e.id||UA().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Xp(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),QA(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},LR=Zp});var FR={};ft(FR,{JsonRpcProvider:()=>Zp,default:()=>pK});var pK,MR=ge(()=>{c();WA();WA();pK=LR});var qR=m((bge,UR)=>{"use strict";c();UR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var VR,HR,$A,GR=ge(()=>{c();VR=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:qR(),HR=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",$A=t=>t.split("?")[0]});var jR,kR,gK,eg,QR,zA=ge(()=>{c();jR=_e(Kn());Qd();dl();GR();kR=10,gK=VR(),eg=class{constructor(e){if(this.url=e,this.events=new jR.EventEmitter,this.registering=!1,!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(qc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Zt.isReactNative)()?void 0:{rejectUnauthorized:!kA(e)},s=new gK(e,[],i);HR()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Uc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=VA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return RA(e,$A(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>kR&&this.events.setMaxListeners(kR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${$A(this.url)}`));return this.events.emit("register_error",r),r}},QR=eg});var WR={};ft(WR,{WsConnection:()=>eg,default:()=>yK});var yK,$R=ge(()=>{c();zA();zA();yK=QR});var x6=m((pl,Wa)=>{c();var mK=200,sb="__lodash_hash_undefined__",ug=1,s6=2,o6=9007199254740991,tg="[object Arguments]",XA="[object Array]",wK="[object AsyncFunction]",a6="[object Boolean]",u6="[object Date]",c6="[object Error]",l6="[object Function]",EK="[object GeneratorFunction]",rg="[object Map]",f6="[object Number]",vK="[object Null]",Qa="[object Object]",zR="[object Promise]",AK="[object Proxy]",h6="[object RegExp]",ng="[object Set]",d6="[object String]",bK="[object Symbol]",_K="[object Undefined]",ZA="[object WeakMap]",p6="[object ArrayBuffer]",ig="[object DataView]",IK="[object Float32Array]",SK="[object Float64Array]",TK="[object Int8Array]",CK="[object Int16Array]",xK="[object Int32Array]",NK="[object Uint8Array]",OK="[object Uint8ClampedArray]",DK="[object Uint16Array]",PK="[object Uint32Array]",RK=/[\\^$.*+?()[\]{}|]/g,BK=/^\[object .+?Constructor\]$/,LK=/^(?:0|[1-9]\d*)$/,rt={};rt[IK]=rt[SK]=rt[TK]=rt[CK]=rt[xK]=rt[NK]=rt[OK]=rt[DK]=rt[PK]=!0;rt[tg]=rt[XA]=rt[p6]=rt[a6]=rt[ig]=rt[u6]=rt[c6]=rt[l6]=rt[rg]=rt[f6]=rt[Qa]=rt[h6]=rt[ng]=rt[d6]=rt[ZA]=!1;var g6=typeof global=="object"&&global&&global.Object===Object&&global,FK=typeof self=="object"&&self&&self.Object===Object&&self,si=g6||FK||Function("return this")(),y6=typeof pl=="object"&&pl&&!pl.nodeType&&pl,KR=y6&&typeof Wa=="object"&&Wa&&!Wa.nodeType&&Wa,m6=KR&&KR.exports===y6,KA=m6&&g6.process,YR=function(){try{return KA&&KA.binding&&KA.binding("util")}catch{}}(),JR=YR&&YR.isTypedArray;function MK(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function dY(t,e){var r=this.__data__,n=lg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}oi.prototype.clear=cY;oi.prototype.delete=lY;oi.prototype.get=fY;oi.prototype.has=hY;oi.prototype.set=dY;function to(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,g=r&s6?new og:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=o6}function T6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ml(t){return t!=null&&typeof t=="object"}var C6=JR?HK(JR):OY;function jY(t){return GY(t)?TY(t):DY(t)}function QY(){return[]}function WY(){return!1}Wa.exports=kY});var P8=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var no=Kn(),$Y=KO(),Al=f2(),Qe=qv(),ui=n1(),N6=(Qd(),ct(S2)),zY=(KD(),ct(zD)),ee=cl(),KY=(uA(),ct(aA)),We=ks(),YY=(MR(),ct(FR)),_r=(dl(),ct(Zt)),JY=($R(),ct(WR)),XY=x6();function Tg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function ZY(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var eJ=Tg(no),tJ=Tg($Y),hg=ZY(zY),rJ=Tg(JY),nJ=Tg(XY);function iJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var sJ=iJ,oJ=sJ,W6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aJ=t=>new TextEncoder().encode(t),uJ=t=>new TextDecoder().decode(t),ub=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},cb=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return $6(this,e)}},lb=class{constructor(e){this.decoders=e}or(e){return $6(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},$6=(t,e)=>new lb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),fb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ub(e,r,n),this.decoder=new cb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Cg=({name:t,prefix:e,encode:r,decode:n})=>new fb(t,e,r,n),bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=oJ(r,e);return Cg({prefix:t,name:e,encode:n,decode:s=>W6(i(s))})},cJ=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},lJ=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Cg({prefix:e,name:t,encode(i){return lJ(i,n,r)},decode(i){return cJ(i,n,r,t)}}),fJ=Cg({prefix:"\0",name:"identity",encode:t=>uJ(t),decode:t=>aJ(t)}),hJ=Object.freeze({__proto__:null,identity:fJ}),dJ=kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),pJ=Object.freeze({__proto__:null,base2:dJ}),gJ=kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),yJ=Object.freeze({__proto__:null,base8:gJ}),mJ=bl({prefix:"9",name:"base10",alphabet:"0123456789"}),wJ=Object.freeze({__proto__:null,base10:mJ}),EJ=kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),vJ=kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),AJ=Object.freeze({__proto__:null,base16:EJ,base16upper:vJ}),bJ=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_J=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),IJ=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SJ=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TJ=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CJ=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xJ=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NJ=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),OJ=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),DJ=Object.freeze({__proto__:null,base32:bJ,base32upper:_J,base32pad:IJ,base32padupper:SJ,base32hex:TJ,base32hexupper:CJ,base32hexpad:xJ,base32hexpadupper:NJ,base32z:OJ}),PJ=bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),RJ=bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),BJ=Object.freeze({__proto__:null,base36:PJ,base36upper:RJ}),LJ=bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),FJ=bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),MJ=Object.freeze({__proto__:null,base58btc:LJ,base58flickr:FJ}),UJ=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qJ=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),VJ=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),HJ=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),GJ=Object.freeze({__proto__:null,base64:UJ,base64pad:qJ,base64url:VJ,base64urlpad:HJ}),z6=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),kJ=z6.reduce((t,e,r)=>(t[r]=e,t),[]),jJ=z6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function QJ(t){return t.reduce((e,r)=>(e+=kJ[r],e),"")}function WJ(t){let e=[];for(let r of t){let n=jJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var $J=Cg({prefix:"\u{1F680}",name:"base256emoji",encode:QJ,decode:WJ}),zJ=Object.freeze({__proto__:null,base256emoji:$J}),KJ=K6,O6=128,YJ=127,JJ=~YJ,XJ=Math.pow(2,31);function K6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=XJ;)e[r++]=t&255|O6,t/=128;for(;t&JJ;)e[r++]=t&255|O6,t>>>=7;return e[r]=t|0,K6.bytes=r-n+1,e}var ZJ=hb,eX=128,D6=127;function hb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&D6)<=eX);return hb.bytes=s-n,r}var tX=Math.pow(2,7),rX=Math.pow(2,14),nX=Math.pow(2,21),iX=Math.pow(2,28),sX=Math.pow(2,35),oX=Math.pow(2,42),aX=Math.pow(2,49),uX=Math.pow(2,56),cX=Math.pow(2,63),lX=function(t){return t(Y6.encode(t,e,r),e),R6=t=>Y6.encodingLength(t),db=(t,e)=>{let r=e.byteLength,n=R6(t),i=n+R6(r),s=new Uint8Array(i+r);return P6(t,s,0),P6(r,s,n),s.set(e,i),new pb(t,r,e,s)},pb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},J6=({name:t,code:e,encode:r})=>new gb(t,e,r),gb=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?db(this.code,r):r.then(n=>db(this.code,n))}else throw Error("Unknown type, must be binary type")}},X6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),hX=J6({name:"sha2-256",code:18,encode:X6("SHA-256")}),dX=J6({name:"sha2-512",code:19,encode:X6("SHA-512")}),pX=Object.freeze({__proto__:null,sha256:hX,sha512:dX}),Z6=0,gX="identity",e8=W6,yX=t=>db(Z6,e8(t)),mX={code:Z6,name:gX,encode:e8,digest:yX},wX=Object.freeze({__proto__:null,identity:mX});new TextEncoder,new TextDecoder;var B6={...hJ,...pJ,...yJ,...wJ,...AJ,...DJ,...BJ,...MJ,...GJ,...zJ};({...pX,...wX});function t8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function EX(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?t8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function r8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var L6=r8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ob=r8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=EX(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},yg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=o8,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=hg.generateKeyPair(i);return hg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=hg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=a8;return await hg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=N6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(g,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return N6.safeJsonParse(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?KY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new gg(this.core,this.logger)}get context(){return Qe.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(yb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(yb,e)}return AX(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},mg=class extends ui.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=l8,this.version=f8,this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Eb=class extends ui.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new no.EventEmitter,this.name=d8,this.queue=new Map,this.publishTimeout=We.toMiliseconds(We.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||h8,u=ee.getRelayProtocolName(s),l=s?.prompt||!1,f=s?.tag||0,d=s?.id||_r.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:f,id:d}},w=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,a,u,l,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(nr.publish,g)}catch(E){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),E;return}finally{clearTimeout(w)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,l,f,d;let g={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return ee.isUndefined((u=g.params)==null?void 0:u.prompt)&&((l=g.params)==null||delete l.prompt),ee.isUndefined((f=g.params)==null?void 0:f.tag)&&((d=g.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(nr.connection_stalled);return}this.checkQueue()}),this.relayer.on(nr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},vb=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},TX=Object.defineProperty,CX=Object.defineProperties,xX=Object.getOwnPropertyDescriptors,F6=Object.getOwnPropertySymbols,NX=Object.prototype.hasOwnProperty,OX=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?TX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,El=(t,e)=>{for(var r in e||(e={}))NX.call(e,r)&&M6(t,r,e[r]);if(F6)for(var r of F6(e))OX.call(e,r)&&M6(t,r,e[r]);return t},ab=(t,e)=>CX(t,xX(e)),wg=class extends ui.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new vb,this.events=new no.EventEmitter,this.name=_8,this.version=I8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ai,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new We.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=S8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(nr.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(nr.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,ab(El({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,El({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,El({},r)),this.topicMap.set(r.topic,e),this.events.emit(Hr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Hr.deleted,ab(El({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Hr.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>ab(El({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(nr.connect,async()=>{await this.onConnect()}),this.relayer.on(nr.disconnect,()=>{this.onDisconnect()}),this.events.on(Hr.created,async e=>{let r=Hr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Hr.deleted,async e=>{let r=Hr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},DX=Object.defineProperty,U6=Object.getOwnPropertySymbols,PX=Object.prototype.hasOwnProperty,RX=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?DX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BX=(t,e)=>{for(var r in e||(e={}))PX.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))RX.call(e,r)&&q6(t,r,e[r]);return t},Eg=class extends ui.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new no.EventEmitter,this.name=y8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(nr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(nr.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Nn.payload,this.onPayloadHandler),this.provider.on(Nn.connect,this.onConnectHandler),this.provider.on(Nn.disconnect,this.onDisconnectHandler),this.provider.on(Nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||g8})),this.messages=new mg(this.logger,e.core),this.subscriber=new wg(this,this.logger),this.publisher=new Eb(this,this.logger),this.relayUrl=e?.relayUrl||bb,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${mb}...`),await this.restartTransport(mb)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},v8)}get context(){return Qe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Hr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Hr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ee.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Hr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await ee.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Nn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ee.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new YY.JsonRpcProvider(new rJ.default(ee.formatRelayRpcUrl({sdkVersion:E8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),_r.isJsonRpcRequest(e)){if(!e.method.endsWith(m8))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(BX({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else _r.isJsonRpcResponse(e)&&this.events.emit(nr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(nr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=_r.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Nn.payload,this.onPayloadHandler),this.provider.off(Nn.connect,this.onConnectHandler),this.provider.off(Nn.disconnect,this.onDisconnectHandler),this.provider.off(Nn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(nr.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await ee.isOnline();ee.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(nr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},We.toMiliseconds(w8)))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},LX=Object.defineProperty,V6=Object.getOwnPropertySymbols,FX=Object.prototype.hasOwnProperty,MX=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?LX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))FX.call(e,r)&&H6(t,r,e[r]);if(V6)for(var r of V6(e))MX.call(e,r)&&H6(t,r,e[r]);return t},vg=class extends ui.IStore{constructor(e,r,n,i=ai,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=A8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>nJ.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ag=class{constructor(e,r){this.core=e,this.logger=r,this.name=T8,this.version=C8,this.events=new eJ.default,this.initialized=!1,this.storagePrefix=ai,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(We.FIVE_MINUTES),o={protocol:p8},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}));let u=ee.calcExpiry(We.FIVE_MINUTES),l={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,l),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(vl.create,l),l},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(We.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=_r.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=za[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=_r.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=_r.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[u.request.method]?za[u.request.method].res:za.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(vl.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{_r.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):_r.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(vl.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new vg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(nr.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{_r.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):_r.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(vl.expire,{topic:r}))})}},bg=class extends ui.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new no.EventEmitter,this.name=x8,this.version=N8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ee.calcExpiry(We.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(Yr.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=_r.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Yr.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Yr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:_r.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Yr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Yr.created,e=>{let r=Yr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.updated,e=>{let r=Yr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.deleted,e=>{let r=Yr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{We.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},_g=class extends ui.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new no.EventEmitter,this.name=O8,this.version=D8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Vr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Vr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Vr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;We.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let r=Vr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let r=Vr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ig=class extends ui.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=dg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||ee.isReactNative()||!ee.isBrowser())return;let n=pg;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i)}if(!this.initialized){this.removeIframe(),this.verifyUrl=wb;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=n?.verifyUrl||pg,s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,wb)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(We.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(dg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=dg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},We.toMiliseconds(We.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=pg,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),We.toMiliseconds(e))}},UX=Object.defineProperty,k6=Object.getOwnPropertySymbols,qX=Object.prototype.hasOwnProperty,VX=Object.prototype.propertyIsEnumerable,j6=(t,e,r)=>e in t?UX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))qX.call(e,r)&&j6(t,r,e[r]);if(k6)for(var r of k6(e))VX.call(e,r)&&j6(t,r,e[r]);return t},Sg=class t extends ui.ICore{constructor(e){super(e),this.protocol=Ab,this.version=n8,this.name=xg,this.events=new no.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||bb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||i8.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Al.HeartBeat,this.crypto=new yg(this,this.logger,e?.keychain),this.history=new bg(this,this.logger),this.expirer=new _g(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tJ.default(Q6(Q6({},s8),e?.storageOptions)),this.relayer=new Eg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Ag(this,this.logger),this.verify=new Ig(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(b8,n),r}get context(){return Qe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},HX=Sg;me.CORE_CONTEXT=xg,me.CORE_DEFAULT=i8,me.CORE_PROTOCOL=Ab,me.CORE_STORAGE_OPTIONS=s8,me.CORE_STORAGE_PREFIX=ai,me.CORE_VERSION=n8,me.CRYPTO_CLIENT_SEED=yb,me.CRYPTO_CONTEXT=o8,me.CRYPTO_JWT_TTL=a8,me.Core=HX,me.Crypto=yg,me.EXPIRER_CONTEXT=O8,me.EXPIRER_DEFAULT_TTL=SX,me.EXPIRER_EVENTS=Vr,me.EXPIRER_STORAGE_VERSION=D8,me.Expirer=_g,me.HISTORY_CONTEXT=x8,me.HISTORY_EVENTS=Yr,me.HISTORY_STORAGE_VERSION=N8,me.JsonRpcHistory=bg,me.KEYCHAIN_CONTEXT=u8,me.KEYCHAIN_STORAGE_VERSION=c8,me.KeyChain=gg,me.MESSAGES_CONTEXT=l8,me.MESSAGES_STORAGE_VERSION=f8,me.MessageTracker=mg,me.PAIRING_CONTEXT=T8,me.PAIRING_DEFAULT_TTL=IX,me.PAIRING_EVENTS=vl,me.PAIRING_RPC_OPTS=za,me.PAIRING_STORAGE_VERSION=C8,me.PENDING_SUB_RESOLUTION_TIMEOUT=S8,me.PUBLISHER_CONTEXT=d8,me.PUBLISHER_DEFAULT_TTL=h8,me.Pairing=Ag,me.RELAYER_CONTEXT=y8,me.RELAYER_DEFAULT_LOGGER=g8,me.RELAYER_DEFAULT_PROTOCOL=p8,me.RELAYER_DEFAULT_RELAY_URL=bb,me.RELAYER_EVENTS=nr,me.RELAYER_FAILOVER_RELAY_URL=mb,me.RELAYER_PROVIDER_EVENTS=Nn,me.RELAYER_RECONNECT_TIMEOUT=w8,me.RELAYER_SDK_VERSION=E8,me.RELAYER_STORAGE_OPTIONS=bX,me.RELAYER_SUBSCRIBER_SUFFIX=m8,me.RELAYER_TRANSPORT_CUTOFF=v8,me.Relayer=Eg,me.STORE_STORAGE_VERSION=A8,me.SUBSCRIBER_CONTEXT=_8,me.SUBSCRIBER_DEFAULT_TTL=_X,me.SUBSCRIBER_EVENTS=Hr,me.SUBSCRIBER_STORAGE_VERSION=I8,me.Store=vg,me.Subscriber=wg,me.VERIFY_CONTEXT=dg,me.VERIFY_FALLBACK_SERVER=wb,me.VERIFY_SERVER=pg,me.Verify=Ig,me.WALLETCONNECT_CLIENT_ID=b8,me.default=Sg});var k8=m(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});var Dn=P8(),Ng=qv(),L8=n1(),j=cl(),F8=Kn(),Xe=ks(),yt=(dl(),ct(Zt));function GX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var kX=GX(F8),xb="wc",Nb=2,Ob="client",Rg=`${xb}@${Nb}:${Ob}:`,Og={name:Ob,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},jX={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},QX={database:":memory:"},_b="WALLETCONNECT_DEEPLINK_CHOICE",WX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},$X="history",zX="0.3",M8="proposal",KX=Xe.THIRTY_DAYS,U8="Proposal expired",q8="session",Il=Xe.SEVEN_DAYS,V8="engine",Ka={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Dg={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},On={idle:"IDLE",active:"ACTIVE"},H8="request",G8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,R8=Object.getOwnPropertySymbols,ZX=Object.prototype.hasOwnProperty,eZ=Object.prototype.propertyIsEnumerable,B8=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gr=(t,e)=>{for(var r in e||(e={}))ZX.call(e,r)&&B8(t,r,e[r]);if(R8)for(var r of R8(e))eZ.call(e,r)&&B8(t,r,e[r]);return t},_l=(t,e)=>JX(t,XX(e)),Ib=class extends L8.IEngine{constructor(e){super(e),this.name=V8,this.events=new kX.default,this.initialized=!1,this.ignoredPayloadTypes=[j.TYPE_1],this.requestQueue={state:On.idle,queue:[]},this.sessionRequestQueue={state:On.idle,queue:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Ka)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=_l(gr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:U,uri:A}=await this.client.core.pairing.create();l=U,f=A}let g=await this.client.core.crypto.generateKeyPair(),w=gr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Dn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:T,done:D}=j.createDelayedPromise(Xe.FIVE_MINUTES,U8);if(this.events.once(j.engineEvent("session_connect"),async({error:U,session:A})=>{if(U)E(U);else if(A){A.self.publicKey=g;let I=_l(gr({},A),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(A.topic,I),await this.setExpiry(A.topic,A.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:A.peer.metadata}),T(I)}}),!l){let{message:U}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}let B=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:w}),W=j.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(B,gr({id:B,expiry:W},w)),{uri:f,approval:D}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",j.isValidObject(f)||(f=j.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(g,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=gr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:j.calcExpiry(Il)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest({topic:E,method:"wc_sessionSettle",params:T,throwOnFailedPublish:!0});let D=_l(gr({},T),{topic:E,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(E,D),await this.setExpiry(E,j.calcExpiry(Il)),{topic:E,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(E)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,j.calcExpiry(Il)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=yt.payloadId(),{done:u,resolve:l,reject:f}=j.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(j.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):l(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await this.client.core.storage.getItem(_b);j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;yt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):yt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(_b).catch(s=>this.client.logger.warn(s))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=On.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Ka.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,j.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l}=r,f=yt.formatJsonRpcRequest(i,s,u);if(j.isBrowser()&&G8.includes(i)){let w=j.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:w})}let d=await this.client.core.crypto.encode(n,f),g=Ka[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),l?(g.internal=_l(gr({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(w=>this.client.logger.error(w)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=yt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),l=await this.client.core.history.get(i,n),f=Ka[l.request.method].res;o?(f.internal=_l(gr({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=yt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Ka[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{j.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===On.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=On.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=On.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(gr({},n.params));let o=j.calcExpiry(Xe.FIVE_MINUTES),a=gr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=j.hashMessage(JSON.stringify(n)),l=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:l})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(yt.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else yt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:w}=n.params,E=gr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(j.engineEvent("session_connect"),{session:E}),this.cleanupDuplicatePairings(E)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):yt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(gr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),j.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,j.calcExpiry(Il)),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Dn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(gr({topic:r},s));let o=j.hashMessage(JSON.stringify(yt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),l={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(l),this.addSessionRequestToSessionRequestQueue(l),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(gr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=On.idle,this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===On.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=On.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,yt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(a,!0)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=j.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=j.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:l}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:l}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=j.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=j.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(j.isExpired(o)){let{message:l}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!j.isValidNamespacesChainId(a,s)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j.isValidRequest(i)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!j.isValidNamespacesRequest(a,s,i.method)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!j.isValidRequestExpiry(o,Dg)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Dg.min} and ${Dg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!j.isValidResponse(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!j.isValidNamespacesChainId(o,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!j.isValidEvent(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Dn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Dn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);try{yt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):yt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Dn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Dn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=j.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Sb=class extends Dn.Store{constructor(e,r){super(e,r,M8,Rg),this.core=e,this.logger=r}},Tb=class extends Dn.Store{constructor(e,r){super(e,r,q8,Rg),this.core=e,this.logger=r}},Cb=class extends Dn.Store{constructor(e,r){super(e,r,H8,Rg,n=>n.id),this.core=e,this.logger=r}},Pg=class t extends L8.ISignClient{constructor(e){super(e),this.protocol=xb,this.version=Nb,this.name=Og.name,this.events=new F8.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||Og.name,this.metadata=e?.metadata||j.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Ng.pino(Ng.getDefaultLoggerOptions({level:e?.logger||Og.logger}));this.core=e?.core||new Dn.Core(e),this.logger=Ng.generateChildLogger(r,this.name),this.session=new Tb(this.core,this.logger),this.proposal=new Sb(this.core,this.logger),this.pendingRequest=new Cb(this.core,this.logger),this.engine=new Ib(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Ng.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},tZ=Pg;Je.ENGINE_CONTEXT=V8,Je.ENGINE_QUEUE_STATES=On,Je.ENGINE_RPC_OPTS=Ka,Je.HISTORY_CONTEXT=$X,Je.HISTORY_EVENTS=WX,Je.HISTORY_STORAGE_VERSION=zX,Je.METHODS_TO_VERIFY=G8,Je.PROPOSAL_CONTEXT=M8,Je.PROPOSAL_EXPIRY=KX,Je.PROPOSAL_EXPIRY_MESSAGE=U8,Je.REQUEST_CONTEXT=H8,Je.SESSION_CONTEXT=q8,Je.SESSION_EXPIRY=Il,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Dg,Je.SIGN_CLIENT_CONTEXT=Ob,Je.SIGN_CLIENT_DEFAULT=Og,Je.SIGN_CLIENT_EVENTS=jX,Je.SIGN_CLIENT_PROTOCOL=xb,Je.SIGN_CLIENT_STORAGE_OPTIONS=QX,Je.SIGN_CLIENT_STORAGE_PREFIX=Rg,Je.SIGN_CLIENT_VERSION=Nb,Je.SignClient=tZ,Je.WALLETCONNECT_DEEPLINK_CHOICE=_b,Je.default=Pg});var Bg=m(Ji=>{"use strict";c();Object.defineProperty(Ji,"__esModule",{value:!0});Ji.OptionalOperation=Ji.Operation=void 0;var rZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(rZ=Ji.Operation||(Ji.Operation={}));var nZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(nZ=Ji.OptionalOperation||(Ji.OptionalOperation={}))});var Db=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Pn.WALLETCONNECT_MULTIVERSX_METHODS=Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var j8=Bg();Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Pn.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(j8.Operation);Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(j8.OptionalOperation);Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var Bb=m(Jr=>{"use strict";c();Object.defineProperty(Jr,"__esModule",{value:!0});Jr.WalletConnectV2ProviderErrorMessagesEnum=Jr.ErrBadAddress=Jr.ErrNotImplemented=Jr.Err=void 0;var Sl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Jr.Err=Sl;var Pb=class extends Sl{constructor(){super("Method not yet implemented")}};Jr.ErrNotImplemented=Pb;var Rb=class extends Sl{constructor(e,r){super(`Bad address: ${e}`,r)}};Jr.ErrBadAddress=Rb;var iZ;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(iZ=Jr.WalletConnectV2ProviderErrorMessagesEnum||(Jr.WalletConnectV2ProviderErrorMessagesEnum={}))});var Fb=m(Lg=>{"use strict";c();Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Logger=void 0;var Lb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Lg.Logger=Lb});var Q8=m(()=>{"use strict";c();global.Buffer||(global.Buffer=Ps().Buffer)});var $8=m(W8=>{"use strict";c();Object.defineProperty(W8,"__esModule",{value:!0})});var K8=m(z8=>{"use strict";c();Object.defineProperty(z8,"__esModule",{value:!0})});var Y8=m(Ya=>{"use strict";c();var sZ=Ya&&Ya.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.RelayedTransactionV1Builder=void 0;var oZ=sZ(Gt()),Mb=ht(),aZ=Be(),uZ=wn(),cZ=jn(),Ub=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new aZ.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new cZ.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new uZ.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new Mb.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Mb.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new oZ.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:h.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new Mb.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?h.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?h.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};Ya.RelayedTransactionV1Builder=Ub});var J8=m(Fg=>{"use strict";c();Object.defineProperty(Fg,"__esModule",{value:!0});Fg.Code=void 0;var qb=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}};Fg.Code=qb});var Z8=m(X8=>{"use strict";c();Object.defineProperty(X8,"__esModule",{value:!0})});var nB=m(Xa=>{"use strict";c();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.bech32m=Xa.bech32=void 0;var Mg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tB={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function eB(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Ja(e)^n>>5}e=Ja(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let l=eB(o);if(typeof l=="string")throw new Error(l);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");l=Ja(l)^g,f+=Mg.charAt(g)}for(let d=0;d<6;++d)l=Ja(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Mg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),l=o.toUpperCase();if(o!==u&&o!==l)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let w=eB(d);if(typeof w=="string")return w;let E=[];for(let T=0;T=g.length)&&E.push(B)}return w!==e?"Invalid checksum for "+o:{prefix:d,words:E}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:lZ,fromWordsUnsafe:fZ,fromWords:hZ}}Xa.bech32=rB("bech32");Xa.bech32m=rB("bech32m")});var sB=m(Gr=>{"use strict";c();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.TokenTransferProperties=Gr.TransactionMetadataTransfer=Gr.TransactionMetadata=Gr.TransactionToDecode=Gr.TransactionDecoder=void 0;var iB=nB(),Hb=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new io;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Ug;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new io;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new io;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return h.Buffer.from(e).toString("base64")}base64Decode(e){return h.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new io;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=h.Buffer.from(e,"hex"),n=iB.bech32.toWords(r);return iB.bech32.encode("erd",n)}isAddressValid(e){return h.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return h.Buffer.from(e,"base64").toString("hex")}hexToString(e){return h.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};Gr.TransactionDecoder=Hb;var Ug=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Gr.TransactionToDecode=Ug;var io=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Gr.TransactionMetadata=io;var Gb=class{constructor(){this.value=BigInt(0)}};Gr.TransactionMetadataTransfer=Gb;var kb=class{};Gr.TokenTransferProperties=kb});var jb=m(qg=>{"use strict";c();Object.defineProperty(qg,"__esModule",{value:!0});qg.ReturnCode=void 0;var Ge=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};qg.ReturnCode=Ge;Ge.None=new Ge("");Ge.Ok=new Ge("ok");Ge.FunctionNotFound=new Ge("function not found");Ge.FunctionWrongSignature=new Ge("wrong signature for function");Ge.ContractNotFound=new Ge("contract not found");Ge.UserError=new Ge("user error");Ge.OutOfGas=new Ge("out of gas");Ge.AccountCollision=new Ge("account collision");Ge.OutOfFunds=new Ge("out of funds");Ge.CallStackOverFlow=new Ge("call stack overflow");Ge.ContractInvalid=new Ge("contract invalid");Ge.ExecutionFailed=new Ge("execution failed");Ge.Unknown=new Ge("unknown")});var uB=m(Vg=>{"use strict";c();Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ResultsParser=void 0;var dZ=sB(),oB=ht(),aB=Be(),Xi=na(),pZ=Wo(),Za=jb(),eu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(eu||(eu={}));var Qb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Qb||(Qb={}));var gZ={argsSerializer:new pZ.ArgSerializer},Wb=class{constructor(e){e=Object.assign(Object.assign({},gZ),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Za.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new Za.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return Xi.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return Xi.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return Xi.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return Xi.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new aB.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new dZ.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:Za.ReturnCode.None,returnMessage:Za.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Za.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(eu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(eu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Qb.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new oB.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(eu.OnWriteLog,u=>u.findFirstOrNoneTopic(l=>l.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new oB.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(eu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),l=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&l});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||h.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new aB.ErrCannotParseContractResults("no return code");return{returnCode:Za.ReturnCode.fromBuffer(i),returnDataParts:s}}};Vg.ResultsParser=Wb});var $b=m(At=>{"use strict";c();var yZ=At&&At.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ir=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yZ(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});ir(Wo(),At);ir(J8(),At);ir(pw(),At);ir(cE(),At);ir(wc(),At);ir(wE(),At);ir(dE(),At);ir(Z8(),At);ir(AE(),At);ir(Ec(),At);ir(uB(),At);ir(jb(),At);ir(fv(),At);ir(xE(),At);ir(St(),At)});var lB=m(Hg=>{"use strict";c();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.RelayedTransactionV2Builder=void 0;var cB=Be(),Tl=$b(),mZ=wn(),wZ=jn(),zb=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new cB.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new cB.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Tl.ArgSerializer().valuesToString([new Tl.AddressValue(this.innerTransaction.getReceiver()),new Tl.U64Value(this.innerTransaction.getNonce().valueOf()),new Tl.BytesValue(this.innerTransaction.getData().valueOf()),new Tl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new wZ.TransactionPayload(r),i=new mZ.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};Hg.RelayedTransactionV2Builder=zb});var fB=m(so=>{"use strict";c();Object.defineProperty(so,"__esModule",{value:!0});so.SignableMessage=so.MESSAGE_PREFIX=void 0;var EZ=ht(),vZ=av();so.MESSAGE_PREFIX=`Elrond Signed Message: -`;var Kb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new EZ.Address,Object.assign(this,e)}serializeForSigning(){let e=h.Buffer.from(this.message.length.toString()),r=h.Buffer.concat([e,this.message]),n=h.Buffer.concat([h.Buffer.from(so.MESSAGE_PREFIX),r]);return vZ("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex")}getMessageSize(){let e=h.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};so.SignableMessage=Kb});var Jb=m(at=>{"use strict";c();var AZ=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bZ=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hB=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AZ(e,t,r);return bZ(e,t),e},_Z=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var IZ=_Z(Gt()),SZ=ht(),Yb=hB(ac()),dB=hB(ph());function TZ(t){return h.Buffer.from(t)}at.stringToBuffer=TZ;function CZ(t){return t.length==0?new IZ.default(0):Yb.bufferToBigInt(t)}at.bufferToBigInt=CZ;function xZ(t){return t==0?h.Buffer.from([]):Yb.bigIntToBuffer(t)}at.bigIntToBuffer=xZ;function NZ(t){return t==0?"":Yb.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=NZ;function OZ(t){let e=h.Buffer.from(t).toString("hex");return dB.zeroPadStringIfOddLength(e)}at.utf8ToHex=OZ;function DZ(t){let e=t.toString("hex");return dB.zeroPadStringIfOddLength(e)}at.bufferToHex=DZ;function PZ(t){return SZ.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=PZ});var gB=m(Gg=>{"use strict";c();Object.defineProperty(Gg,"__esModule",{value:!0});Gg.TokenOperationsFactory=void 0;var Xb=bs(),RZ=na(),pB=cc(),BZ=wn(),LZ=jn(),ne=Jb(),Zb=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){RZ.Logger.info(` + Approved: ${a.toString()}`)),Object.keys(e).forEach(h=>{if(!h.includes(":")||n)return;let g=no(e[h].accounts);g.includes(h)||(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${h} + Required: ${h} + Approved: ${g.toString()}`))}),o.forEach(h=>{n||($i(i[h].methods,s[h].methods)?$i(i[h].events,s[h].events)||(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${h}`)):n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function UK(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function H3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function qK(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:no(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function VK(t,e){return kp(t,!1)&&t<=e.max&&t>=e.min}function HK(){let t=ro();return new Promise(e=>{switch(t){case nr.browser:e(OR());break;case nr.reactNative:e(DR());break;case nr.node:e(PR());break;default:e(!0)}})}function OR(){return Hp()&&navigator?.onLine}async function DR(){return yl()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function PR(){return!0}function GK(t){switch(ro()){case nr.browser:RR(t);break;case nr.reactNative:BR(t);break;case nr.node:break}}function RR(t){!yl()&&Hp()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function BR(t){yl()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var xA={},PA=class{static get(e){return xA[e]}static set(e,r){xA[e]=r}static delete(e){delete xA[e]}};G.BASE10=FA,G.BASE16=ir,G.BASE64=Lp,G.COLON=L$,G.DEFAULT_DEPTH=VA,G.EMPTY_SPACE=Fp,G.ENV_MAP=nr,G.MemoryStore=PA,G.ONE_THOUSAND=F$,G.REACT_NATIVE_PRODUCT=nR,G.RELAYER_DEFAULT_PROTOCOL=dR,G.SDK_TYPE=sR,G.SLASH=iR,G.TYPE_0=MA,G.TYPE_1=Wa,G.UTF8=Vp,G.appendToQueryString=oR,G.assertType=H$,G.buildApprovedNamespaces=EK,G.calcExpiry=Z$,G.capitalize=z$,G.capitalizeWord=hR,G.createDelayedPromise=$$,G.createExpiringPromise=K$,G.decodeTypeByte=gl,G.decrypt=N$,G.deriveSymKey=S$,G.deserialize=qA,G.encodeTypeByte=eR,G.encrypt=x$,G.engineEvent=tK,G.enumify=W$,G.formatAccountId=$3,G.formatAccountWithChain=g$,G.formatChainId=z3,G.formatExpirerTarget=GA,G.formatIdTarget=J$,G.formatMessage=A$,G.formatMessageContext=G$,G.formatRelayParams=yR,G.formatRelayRpcUrl=q$,G.formatTopicTarget=Y$,G.formatUA=cR,G.formatUri=lK,G.generateKeyPair=I$,G.generateRandomBytes32=_$,G.getAccountsChains=no,G.getAccountsFromNamespaces=m$,G.getAddressFromAccount=K3,G.getAddressesFromAccounts=y$,G.getAppMetadata=M$,G.getBrowserOnlineStatus=OR,G.getChainFromAccount=Y3,G.getChainsFromAccounts=J3,G.getChainsFromNamespace=Up,G.getChainsFromNamespaces=w$,G.getChainsFromRequiredNamespaces=E$,G.getDidAddress=Z3,G.getDidAddressSegments=qp,G.getDidChainId=X3,G.getEnvironment=ro,G.getHttpUrl=V$,G.getInternalError=ai,G.getJavascriptID=uR,G.getJavascriptOS=aR,G.getLastItems=fR,G.getNamespacedDidChainId=v$,G.getNamespacesChains=mR,G.getNamespacesEventsForChainId=ER,G.getNamespacesMethodsForChainId=wR,G.getNodeOnlineStatus=PR,G.getReactNativeOnlineStatus=DR,G.getRelayClientMetadata=U$,G.getRelayProtocolApi=iK,G.getRelayProtocolName=nK,G.getRequiredNamespacesFromNamespaces=wK,G.getSdkError=to,G.getUniqueValues=LA,G.handleDeeplinkRedirect=rK,G.hasOverlap=$i,G.hashKey=T$,G.hashMessage=C$,G.isBrowser=Hp,G.isCaipNamespace=kA,G.isConformingNamespaces=NR,G.isExpired=eK,G.isNode=HA,G.isOnline=HK,G.isProposalStruct=_K,G.isReactNative=yl,G.isSessionCompatible=bK,G.isSessionStruct=SK,G.isTypeOneEnvelope=D$,G.isUndefined=Yi,G.isValidAccountId=AR,G.isValidAccounts=_R,G.isValidActions=TR,G.isValidArray=ml,G.isValidChainId=pl,G.isValidChains=bR,G.isValidController=TK,G.isValidErrorReason=DK,G.isValidEvent=BK,G.isValidId=NK,G.isValidNamespaceAccounts=SR,G.isValidNamespaceActions=jA,G.isValidNamespaceChains=IR,G.isValidNamespaceMethodsOrEvents=DA,G.isValidNamespaces=CR,G.isValidNamespacesChainId=LK,G.isValidNamespacesEvent=MK,G.isValidNamespacesRequest=FK,G.isValidNumber=kp,G.isValidObject=Gp,G.isValidParams=OK,G.isValidRelay=xR,G.isValidRelays=xK,G.isValidRequest=PK,G.isValidRequestExpiry=VK,G.isValidRequiredNamespaces=CK,G.isValidResponse=RK,G.isValidString=br,G.isValidUrl=IK,G.mapEntries=Q$,G.mapToObj=k$,G.mergeArrays=Ki,G.normalizeNamespaces=OA,G.objToMap=j$,G.parseAccountId=BA,G.parseChainId=W3,G.parseContextNames=lR,G.parseExpirerTarget=X$,G.parseNamespaceKey=vR,G.parseRelayParams=pR,G.parseTopic=gR,G.parseUri=cK,G.serialize=tR,G.subscribeToBrowserNetworkChange=RR,G.subscribeToNetworkChange=GK,G.subscribeToReactNativeNetworkChange=BR,G.validateDecoding=O$,G.validateEncoding=rR});var LR,FR,MR,UR,jp,El,QA,Qp,Ji,vl,Wp=fe(()=>{l();LR="PARSE_ERROR",FR="INVALID_REQUEST",MR="METHOD_NOT_FOUND",UR="INVALID_PARAMS",jp="INTERNAL_ERROR",El="SERVER_ERROR",QA=[-32700,-32600,-32601,-32602,-32603],Qp=[-32e3,-32099],Ji={[LR]:{code:-32700,message:"Parse error"},[FR]:{code:-32600,message:"Invalid Request"},[MR]:{code:-32601,message:"Method not found"},[UR]:{code:-32602,message:"Invalid params"},[jp]:{code:-32603,message:"Internal error"},[El]:{code:-32e3,message:"Server error"}},vl=El});function kK(t){return t<=Qp[0]&&t>=Qp[1]}function zp(t){return QA.includes(t)}function qR(t){return typeof t=="number"}function $p(t){return Object.keys(Ji).includes(t)?Ji[t]:Ji[vl]}function Kp(t){let e=Object.values(Ji).find(r=>r.code===t);return e||Ji[vl]}function jK(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!qR(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(zp(t.error.code)){let e=Kp(t.error.code);if(e.message!==Ji[vl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function WA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var zA=fe(()=>{l();Wp()});var HR=E(Xi=>{"use strict";l();Object.defineProperty(Xi,"__esModule",{value:!0});Xi.isBrowserCryptoAvailable=Xi.getSubtleCrypto=Xi.getBrowerCrypto=void 0;function $A(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Xi.getBrowerCrypto=$A;function VR(){let t=$A();return t.subtle||t.webkitSubtle}Xi.getSubtleCrypto=VR;function QK(){return!!$A()&&!!VR()}Xi.isBrowserCryptoAvailable=QK});var jR=E(Zi=>{"use strict";l();Object.defineProperty(Zi,"__esModule",{value:!0});Zi.isBrowser=Zi.isNode=Zi.isReactNative=void 0;function GR(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Zi.isReactNative=GR;function kR(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}Zi.isNode=kR;function WK(){return!GR()&&!kR()}Zi.isBrowser=WK});var KA=E(Yp=>{"use strict";l();Object.defineProperty(Yp,"__esModule",{value:!0});var QR=(Xr(),ft(Jr));QR.__exportStar(HR(),Yp);QR.__exportStar(jR(),Yp)});var Ut={};ct(Ut,{isNodeJs:()=>zR});var WR,zR,$R=fe(()=>{l();WR=be(KA());Gt(Ut,be(KA()));zR=WR.isNode});function YA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function JA(t=6){return BigInt(YA(t))}function XA(t,e,r){return{id:r||YA(),jsonrpc:"2.0",method:t,params:e}}function zK(t,e){return{id:t,jsonrpc:"2.0",result:e}}function ZA(t,e,r){return{id:t,jsonrpc:"2.0",error:KR(e,r)}}function KR(t,e){return typeof t>"u"?$p(jp):(typeof t=="string"&&(t=Object.assign(Object.assign({},$p(El)),{message:t})),typeof e<"u"&&(t.data=e),zp(t.code)&&(t=Kp(t.code)),t)}var YR=fe(()=>{l();zA();Wp()});function $K(t){return t.includes("*")?Xp(t):!/\W/g.test(t)}function Jp(t){return t==="*"}function Xp(t){return Jp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function KK(t){return!Jp(t)&&Xp(t)&&!t.split("*")[0].trim()}function YK(t){return!Jp(t)&&Xp(t)&&!t.split("*")[1].trim()}var JR=fe(()=>{l()});var XR=fe(()=>{l()});var za,eb=fe(()=>{l();za=class{}});var tb,Zp,Al,ZR=fe(()=>{l();eb();tb=class extends za{constructor(e){super()}},Zp=class extends za{constructor(){super()}},Al=class extends Zp{constructor(e){super()}}});var e6=fe(()=>{l()});var t6=fe(()=>{l();XR();eb();ZR();e6()});var r6=fe(()=>{l();t6()});function ZK(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function n6(t,e){let r=ZK(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function eY(t){return n6(t,JK)}function eg(t){return n6(t,XK)}function rb(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var JK,XK,i6=fe(()=>{l();JK="^https?:",XK="^wss?:"});function nb(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function tY(t){return nb(t)&&"method"in t}function ib(t){return nb(t)&&(s6(t)||tg(t))}function s6(t){return"result"in t}function tg(t){return"error"in t}function rY(t){return"error"in t&&t.valid===!1}var o6=fe(()=>{l()});var er={};ct(er,{DEFAULT_ERROR:()=>vl,IBaseJsonRpcProvider:()=>Zp,IEvents:()=>za,IJsonRpcConnection:()=>tb,IJsonRpcProvider:()=>Al,INTERNAL_ERROR:()=>jp,INVALID_PARAMS:()=>UR,INVALID_REQUEST:()=>FR,METHOD_NOT_FOUND:()=>MR,PARSE_ERROR:()=>LR,RESERVED_ERROR_CODES:()=>QA,SERVER_ERROR:()=>El,SERVER_ERROR_CODE_RANGE:()=>Qp,STANDARD_ERROR_MAP:()=>Ji,formatErrorMessage:()=>KR,formatJsonRpcError:()=>ZA,formatJsonRpcRequest:()=>XA,formatJsonRpcResult:()=>zK,getBigIntRpcId:()=>JA,getError:()=>$p,getErrorByCode:()=>Kp,isHttpUrl:()=>eY,isJsonRpcError:()=>tg,isJsonRpcPayload:()=>nb,isJsonRpcRequest:()=>tY,isJsonRpcResponse:()=>ib,isJsonRpcResult:()=>s6,isJsonRpcValidationInvalid:()=>rY,isLocalhostUrl:()=>rb,isNodeJs:()=>zR,isReservedErrorCode:()=>zp,isServerErrorCode:()=>kK,isValidDefaultRoute:()=>Jp,isValidErrorCode:()=>qR,isValidLeadingWildcardRoute:()=>KK,isValidRoute:()=>$K,isValidTrailingWildcardRoute:()=>YK,isValidWildcardRoute:()=>Xp,isWsUrl:()=>eg,parseConnectionError:()=>WA,payloadId:()=>YA,validateJsonRpcError:()=>jK});var bl=fe(()=>{l();Wp();zA();$R();Gt(er,Ut);YR();JR();r6();i6();o6()});var a6,rg,u6,sb=fe(()=>{l();a6=be(Xn());bl();rg=class extends Al{constructor(e){super(e),this.events=new a6.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(XA(e.method,e.params||[],e.id||JA().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{tg(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ib(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},u6=rg});var c6={};ct(c6,{JsonRpcProvider:()=>rg,default:()=>nY});var nY,l6=fe(()=>{l();sb();sb();nY=u6});var h6=E((pye,f6)=>{"use strict";l();f6.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var d6,p6,ob,g6=fe(()=>{l();d6=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:h6(),p6=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",ob=t=>t.split("?")[0]});var m6,y6,iY,ng,w6,ab=fe(()=>{l();m6=be(Xn());kc();bl();g6();y6=10,iY=d6(),ng=class{constructor(e){if(this.url=e,this.events=new m6.EventEmitter,this.registering=!1,!eg(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Hi(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!eg(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,er.isReactNative)()?void 0:{rejectUnauthorized:!rb(e)},s=new iY(e,[],i);p6()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Vi(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=ZA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return WA(e,ob(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>y6&&this.events.setMaxListeners(y6)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${ob(this.url)}`));return this.events.emit("register_error",r),r}},w6=ng});var E6={};ct(E6,{WsConnection:()=>ng,default:()=>sY});var sY,v6=fe(()=>{l();ab();ab();sY=w6});var tB=E((Il,Ka)=>{l();var oY=200,wb="__lodash_hash_undefined__",fg=1,P6=2,R6=9007199254740991,ig="[object Arguments]",fb="[object Array]",aY="[object AsyncFunction]",B6="[object Boolean]",L6="[object Date]",F6="[object Error]",M6="[object Function]",uY="[object GeneratorFunction]",sg="[object Map]",U6="[object Number]",cY="[object Null]",$a="[object Object]",A6="[object Promise]",lY="[object Proxy]",q6="[object RegExp]",og="[object Set]",V6="[object String]",fY="[object Symbol]",hY="[object Undefined]",hb="[object WeakMap]",H6="[object ArrayBuffer]",ag="[object DataView]",dY="[object Float32Array]",pY="[object Float64Array]",gY="[object Int8Array]",yY="[object Int16Array]",mY="[object Int32Array]",wY="[object Uint8Array]",EY="[object Uint8ClampedArray]",vY="[object Uint16Array]",AY="[object Uint32Array]",bY=/[\\^$.*+?()[\]{}|]/g,IY=/^\[object .+?Constructor\]$/,_Y=/^(?:0|[1-9]\d*)$/,rt={};rt[dY]=rt[pY]=rt[gY]=rt[yY]=rt[mY]=rt[wY]=rt[EY]=rt[vY]=rt[AY]=!0;rt[ig]=rt[fb]=rt[H6]=rt[B6]=rt[ag]=rt[L6]=rt[F6]=rt[M6]=rt[sg]=rt[U6]=rt[$a]=rt[q6]=rt[og]=rt[V6]=rt[hb]=!1;var G6=typeof global=="object"&&global&&global.Object===Object&&global,SY=typeof self=="object"&&self&&self.Object===Object&&self,ui=G6||SY||Function("return this")(),k6=typeof Il=="object"&&Il&&!Il.nodeType&&Il,b6=k6&&typeof Ka=="object"&&Ka&&!Ka.nodeType&&Ka,j6=b6&&b6.exports===k6,ub=j6&&G6.process,I6=function(){try{return ub&&ub.binding&&ub.binding("util")}catch{}}(),_6=I6&&I6.isTypedArray;function TY(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function rJ(t,e){var r=this.__data__,n=dg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ci.prototype.clear=XY;ci.prototype.delete=ZY;ci.prototype.get=eJ;ci.prototype.has=tJ;ci.prototype.set=rJ;function oo(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,h=!0,g=r&P6?new cg:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=R6}function Z6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Tl(t){return t!=null&&typeof t=="object"}var eB=_6?OY(_6):EJ;function RJ(t){return DJ(t)?gJ(t):vJ(t)}function BJ(){return[]}function LJ(){return!1}Ka.exports=PJ});var s8=E(me=>{"use strict";l();Object.defineProperty(me,"__esModule",{value:!0});var uo=Xn(),FJ=(b2(),ft(A2)),Ol=q2(),Qe=Xv(),fi=y1(),rB=(kc(),ft(E2)),MJ=(bP(),ft(AP)),ee=wl(),UJ=(AA(),ft(vA)),We=$s(),qJ=(l6(),ft(c6)),Ir=(bl(),ft(er)),VJ=(v6(),ft(E6)),HJ=tB();function Ng(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function GJ(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var kJ=Ng(uo),jJ=Ng(FJ),gg=GJ(MJ),QJ=Ng(VJ),WJ=Ng(HJ);function zJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var _=m[B],N=0,I=U-1;(_!==0||N>>0,A[I]=_%a>>>0,_=_/a>>>0;if(_!==0)throw new Error("Non-zero carry");O=N,B++}for(var S=U-O;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);m[T];){var A=r[m.charCodeAt(T)];if(A===255)return;for(var _=0,N=W-1;(A!==0||_>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=_,T++}if(m[T]!==" "){for(var I=W-B;I!==W&&U[I]===0;)I++;for(var S=new Uint8Array(O+(W-I)),R=O;I!==W;)S[R++]=U[I++];return S}}}function y(m){var T=g(m);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:g,decode:y}}var $J=zJ,KJ=$J,EB=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},YJ=t=>new TextEncoder().encode(t),JJ=t=>new TextDecoder().decode(t),Ab=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},bb=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return vB(this,e)}},Ib=class{constructor(e){this.decoders=e}or(e){return vB(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},vB=(t,e)=>new Ib({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),_b=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ab(e,r,n),this.decoder=new bb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Og=({name:t,prefix:e,encode:r,decode:n})=>new _b(t,e,r,n),Dl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=KJ(r,e);return Og({prefix:t,name:e,encode:n,decode:s=>EB(i(s))})},XJ=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},ZJ=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Og({prefix:e,name:t,encode(i){return ZJ(i,n,r)},decode(i){return XJ(i,n,r,t)}}),eX=Og({prefix:"\0",name:"identity",encode:t=>JJ(t),decode:t=>YJ(t)}),tX=Object.freeze({__proto__:null,identity:eX}),rX=jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),nX=Object.freeze({__proto__:null,base2:rX}),iX=jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),sX=Object.freeze({__proto__:null,base8:iX}),oX=Dl({prefix:"9",name:"base10",alphabet:"0123456789"}),aX=Object.freeze({__proto__:null,base10:oX}),uX=jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),cX=jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),lX=Object.freeze({__proto__:null,base16:uX,base16upper:cX}),fX=jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),hX=jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dX=jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),pX=jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),gX=jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yX=jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mX=jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),wX=jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EX=jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),vX=Object.freeze({__proto__:null,base32:fX,base32upper:hX,base32pad:dX,base32padupper:pX,base32hex:gX,base32hexupper:yX,base32hexpad:mX,base32hexpadupper:wX,base32z:EX}),AX=Dl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bX=Dl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),IX=Object.freeze({__proto__:null,base36:AX,base36upper:bX}),_X=Dl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),SX=Dl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),TX=Object.freeze({__proto__:null,base58btc:_X,base58flickr:SX}),CX=jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xX=jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),NX=jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),OX=jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),DX=Object.freeze({__proto__:null,base64:CX,base64pad:xX,base64url:NX,base64urlpad:OX}),AB=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),PX=AB.reduce((t,e,r)=>(t[r]=e,t),[]),RX=AB.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function BX(t){return t.reduce((e,r)=>(e+=PX[r],e),"")}function LX(t){let e=[];for(let r of t){let n=RX[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var FX=Og({prefix:"\u{1F680}",name:"base256emoji",encode:BX,decode:LX}),MX=Object.freeze({__proto__:null,base256emoji:FX}),UX=bB,nB=128,qX=127,VX=~qX,HX=Math.pow(2,31);function bB(t,e,r){e=e||[],r=r||0;for(var n=r;t>=HX;)e[r++]=t&255|nB,t/=128;for(;t&VX;)e[r++]=t&255|nB,t>>>=7;return e[r]=t|0,bB.bytes=r-n+1,e}var GX=Sb,kX=128,iB=127;function Sb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Sb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&iB)<=kX);return Sb.bytes=s-n,r}var jX=Math.pow(2,7),QX=Math.pow(2,14),WX=Math.pow(2,21),zX=Math.pow(2,28),$X=Math.pow(2,35),KX=Math.pow(2,42),YX=Math.pow(2,49),JX=Math.pow(2,56),XX=Math.pow(2,63),ZX=function(t){return t(IB.encode(t,e,r),e),oB=t=>IB.encodingLength(t),Tb=(t,e)=>{let r=e.byteLength,n=oB(t),i=n+oB(r),s=new Uint8Array(i+r);return sB(t,s,0),sB(r,s,n),s.set(e,i),new Cb(t,r,e,s)},Cb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},_B=({name:t,code:e,encode:r})=>new xb(t,e,r),xb=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Tb(this.code,r):r.then(n=>Tb(this.code,n))}else throw Error("Unknown type, must be binary type")}},SB=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),tZ=_B({name:"sha2-256",code:18,encode:SB("SHA-256")}),rZ=_B({name:"sha2-512",code:19,encode:SB("SHA-512")}),nZ=Object.freeze({__proto__:null,sha256:tZ,sha512:rZ}),TB=0,iZ="identity",CB=EB,sZ=t=>Tb(TB,CB(t)),oZ={code:TB,name:iZ,encode:CB,digest:sZ},aZ=Object.freeze({__proto__:null,identity:oZ});new TextEncoder,new TextDecoder;var aB={...tX,...nX,...sX,...aX,...lX,...vX,...IX,...TX,...DX,...MX};({...nZ,...aZ});function xB(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function uZ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?xB(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function NB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var uB=NB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Eb=NB("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=uZ(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Eg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=RB,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=gg.generateKeyPair(i);return gg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=gg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=BB;return await gg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=rB.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,y=a.receiverPublicKey;i=await this.generateSharedKey(g,y)}let c=this.getSymKey(i),{type:f,senderPublicKey:h}=a;return ee.encrypt({type:f,symKey:c,message:u,senderPublicKey:h})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,c=a.senderPublicKey;i=await this.generateSharedKey(u,c)}try{let u=this.getSymKey(i),c=ee.decrypt({symKey:u,encoded:s});return rB.safeJsonParse(c)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?UJ.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new wg(this.core,this.logger)}get context(){return Qe.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Nb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(Nb,e)}return lZ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},vg=class extends fi.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=MB,this.version=UB,this.initialized=!1,this.storagePrefix=li,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Pb=class extends fi.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new uo.EventEmitter,this.name=VB,this.queue=new Map,this.publishTimeout=We.toMiliseconds(We.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||qB,u=ee.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,h=s?.id||Ir.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:c,tag:f,id:h}},y=setTimeout(()=>this.queue.set(h,g),this.publishTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,a,u,c,f,h),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(h),this.relayer.events.emit(sr.publish,g)}catch(m){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(h),m;return}finally{clearTimeout(y)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,c,f,h;let g={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return ee.isUndefined((u=g.params)==null?void 0:u.prompt)&&((c=g.params)==null||delete c.prompt),ee.isUndefined((f=g.params)==null?void 0:f.tag)&&((h=g.params)==null||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(sr.connection_stalled);return}this.checkQueue()}),this.relayer.on(sr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},Rb=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},gZ=Object.defineProperty,yZ=Object.defineProperties,mZ=Object.getOwnPropertyDescriptors,cB=Object.getOwnPropertySymbols,wZ=Object.prototype.hasOwnProperty,EZ=Object.prototype.propertyIsEnumerable,lB=(t,e,r)=>e in t?gZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xl=(t,e)=>{for(var r in e||(e={}))wZ.call(e,r)&&lB(t,r,e[r]);if(cB)for(var r of cB(e))EZ.call(e,r)&&lB(t,r,e[r]);return t},vb=(t,e)=>yZ(t,mZ(e)),Ag=class extends fi.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new Rb,this.events=new uo.EventEmitter,this.name=YB,this.version=JB,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=li,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new We.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=XB&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(sr.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(sr.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,vb(xl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,xl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,xl({},r)),this.topicMap.set(r.topic,e),this.events.emit(kr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(kr.deleted,vb(xl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(kr.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>vb(xl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(sr.connect,async()=>{await this.onConnect()}),this.relayer.on(sr.disconnect,()=>{this.onDisconnect()}),this.events.on(kr.created,async e=>{let r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(kr.deleted,async e=>{let r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},vZ=Object.defineProperty,fB=Object.getOwnPropertySymbols,AZ=Object.prototype.hasOwnProperty,bZ=Object.prototype.propertyIsEnumerable,hB=(t,e,r)=>e in t?vZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,IZ=(t,e)=>{for(var r in e||(e={}))AZ.call(e,r)&&hB(t,r,e[r]);if(fB)for(var r of fB(e))bZ.call(e,r)&&hB(t,r,e[r]);return t},bg=class extends fi.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new uo.EventEmitter,this.name=kB,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(sr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(sr.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Rn.payload,this.onPayloadHandler),this.provider.on(Rn.connect,this.onConnectHandler),this.provider.on(Rn.disconnect,this.onDisconnectHandler),this.provider.on(Rn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||GB})),this.messages=new vg(this.logger,e.core),this.subscriber=new Ag(this,this.logger),this.publisher=new Pb(this,this.logger),this.relayUrl=e?.relayUrl||Lb,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Ob}...`),await this.restartTransport(Ob)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},zB)}get context(){return Qe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(kr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(kr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ee.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(kr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await ee.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Rn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ee.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new qJ.JsonRpcProvider(new QJ.default(ee.formatRelayRpcUrl({sdkVersion:WB,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Ir.isJsonRpcRequest(e)){if(!e.method.endsWith(jB))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(IZ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else Ir.isJsonRpcResponse(e)&&this.events.emit(sr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(sr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Ir.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Rn.payload,this.onPayloadHandler),this.provider.off(Rn.connect,this.onConnectHandler),this.provider.off(Rn.disconnect,this.onDisconnectHandler),this.provider.off(Rn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(sr.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await ee.isOnline();ee.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(sr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},We.toMiliseconds(QB)))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},_Z=Object.defineProperty,dB=Object.getOwnPropertySymbols,SZ=Object.prototype.hasOwnProperty,TZ=Object.prototype.propertyIsEnumerable,pB=(t,e,r)=>e in t?_Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gB=(t,e)=>{for(var r in e||(e={}))SZ.call(e,r)&&pB(t,r,e[r]);if(dB)for(var r of dB(e))TZ.call(e,r)&&pB(t,r,e[r]);return t},Ig=class extends fi.IStore{constructor(e,r,n,i=li,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=$B,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>WJ.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=gB(gB({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},_g=class{constructor(e,r){this.core=e,this.logger=r,this.name=ZB,this.version=e8,this.events=new kJ.default,this.initialized=!1,this.storagePrefix=li,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(We.FIVE_MINUTES),o={protocol:HB},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}));let u=ee.calcExpiry(We.FIVE_MINUTES),c={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,c),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(Nl.create,c),c},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(We.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:c})=>{c?u(c):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Ir.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ja[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Ir.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=Ja[u.request.method].res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Ir.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=Ja[u.request.method]?Ja[u.request.method].res:Ja.unregistered_method.res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Nl.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{Ir.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):Ir.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Nl.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new Ig(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(sr.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{Ir.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Ir.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Gr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(Nl.expire,{topic:r}))})}},Sg=class extends fi.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new uo.EventEmitter,this.name=t8,this.version=r8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ee.calcExpiry(We.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(en.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ir.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(en.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(en.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:Ir.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(en.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(en.created,e=>{let r=en.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(en.updated,e=>{let r=en.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(en.deleted,e=>{let r=en.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{We.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Tg=class extends fi.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new uo.EventEmitter,this.name=n8,this.version=i8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Gr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Gr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Gr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;We.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Gr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Gr.created,e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Gr.expired,e=>{let r=Gr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Gr.deleted,e=>{let r=Gr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Cg=class extends fi.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=yg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||ee.isReactNative()||!ee.isBrowser())return;let n=mg;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Db;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=n?.verifyUrl||mg,s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,Db)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(We.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(yg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=yg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},We.toMiliseconds(We.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=mg,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),We.toMiliseconds(e))}},CZ=Object.defineProperty,yB=Object.getOwnPropertySymbols,xZ=Object.prototype.hasOwnProperty,NZ=Object.prototype.propertyIsEnumerable,mB=(t,e,r)=>e in t?CZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wB=(t,e)=>{for(var r in e||(e={}))xZ.call(e,r)&&mB(t,r,e[r]);if(yB)for(var r of yB(e))NZ.call(e,r)&&mB(t,r,e[r]);return t},xg=class t extends fi.ICore{constructor(e){super(e),this.protocol=Bb,this.version=OB,this.name=Dg,this.events=new uo.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Lb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||DB.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Ol.HeartBeat,this.crypto=new Eg(this,this.logger,e?.keychain),this.history=new Sg(this,this.logger),this.expirer=new Tg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new jJ.default(wB(wB({},PB),e?.storageOptions)),this.relayer=new bg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new _g(this,this.logger),this.verify=new Cg(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(KB,n),r}get context(){return Qe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},OZ=xg;me.CORE_CONTEXT=Dg,me.CORE_DEFAULT=DB,me.CORE_PROTOCOL=Bb,me.CORE_STORAGE_OPTIONS=PB,me.CORE_STORAGE_PREFIX=li,me.CORE_VERSION=OB,me.CRYPTO_CLIENT_SEED=Nb,me.CRYPTO_CONTEXT=RB,me.CRYPTO_JWT_TTL=BB,me.Core=OZ,me.Crypto=Eg,me.EXPIRER_CONTEXT=n8,me.EXPIRER_DEFAULT_TTL=pZ,me.EXPIRER_EVENTS=Gr,me.EXPIRER_STORAGE_VERSION=i8,me.Expirer=Tg,me.HISTORY_CONTEXT=t8,me.HISTORY_EVENTS=en,me.HISTORY_STORAGE_VERSION=r8,me.JsonRpcHistory=Sg,me.KEYCHAIN_CONTEXT=LB,me.KEYCHAIN_STORAGE_VERSION=FB,me.KeyChain=wg,me.MESSAGES_CONTEXT=MB,me.MESSAGES_STORAGE_VERSION=UB,me.MessageTracker=vg,me.PAIRING_CONTEXT=ZB,me.PAIRING_DEFAULT_TTL=dZ,me.PAIRING_EVENTS=Nl,me.PAIRING_RPC_OPTS=Ja,me.PAIRING_STORAGE_VERSION=e8,me.PENDING_SUB_RESOLUTION_TIMEOUT=XB,me.PUBLISHER_CONTEXT=VB,me.PUBLISHER_DEFAULT_TTL=qB,me.Pairing=_g,me.RELAYER_CONTEXT=kB,me.RELAYER_DEFAULT_LOGGER=GB,me.RELAYER_DEFAULT_PROTOCOL=HB,me.RELAYER_DEFAULT_RELAY_URL=Lb,me.RELAYER_EVENTS=sr,me.RELAYER_FAILOVER_RELAY_URL=Ob,me.RELAYER_PROVIDER_EVENTS=Rn,me.RELAYER_RECONNECT_TIMEOUT=QB,me.RELAYER_SDK_VERSION=WB,me.RELAYER_STORAGE_OPTIONS=fZ,me.RELAYER_SUBSCRIBER_SUFFIX=jB,me.RELAYER_TRANSPORT_CUTOFF=zB,me.Relayer=bg,me.STORE_STORAGE_VERSION=$B,me.SUBSCRIBER_CONTEXT=YB,me.SUBSCRIBER_DEFAULT_TTL=hZ,me.SUBSCRIBER_EVENTS=kr,me.SUBSCRIBER_STORAGE_VERSION=JB,me.Store=Ig,me.Subscriber=Ag,me.VERIFY_CONTEXT=yg,me.VERIFY_FALLBACK_SERVER=Db,me.VERIFY_SERVER=mg,me.Verify=Cg,me.WALLETCONNECT_CLIENT_ID=KB,me.default=xg});var y8=E(Je=>{"use strict";l();Object.defineProperty(Je,"__esModule",{value:!0});var Ln=s8(),Pg=Xv(),u8=y1(),j=wl(),c8=Xn(),Xe=$s(),yt=(bl(),ft(er));function DZ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var PZ=DZ(c8),Hb="wc",Gb=2,kb="client",Fg=`${Hb}@${Gb}:${kb}:`,Rg={name:kb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},RZ={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},BZ={database:":memory:"},Fb="WALLETCONNECT_DEEPLINK_CHOICE",LZ={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},FZ="history",MZ="0.3",l8="proposal",UZ=Xe.THIRTY_DAYS,f8="Proposal expired",h8="session",Rl=Xe.SEVEN_DAYS,d8="engine",Xa={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Bg={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},Bn={idle:"IDLE",active:"ACTIVE"},p8="request",g8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],qZ=Object.defineProperty,VZ=Object.defineProperties,HZ=Object.getOwnPropertyDescriptors,o8=Object.getOwnPropertySymbols,GZ=Object.prototype.hasOwnProperty,kZ=Object.prototype.propertyIsEnumerable,a8=(t,e,r)=>e in t?qZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mr=(t,e)=>{for(var r in e||(e={}))GZ.call(e,r)&&a8(t,r,e[r]);if(o8)for(var r of o8(e))kZ.call(e,r)&&a8(t,r,e[r]);return t},Pl=(t,e)=>VZ(t,HZ(e)),Mb=class extends u8.IEngine{constructor(e){super(e),this.name=d8,this.events=new PZ.default,this.initialized=!1,this.ignoredPayloadTypes=[j.TYPE_1],this.requestQueue={state:Bn.idle,queue:[]},this.sessionRequestQueue={state:Bn.idle,queue:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Xa)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=Pl(mr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,c=i,f,h=!1;if(c&&(h=this.client.core.pairing.pairings.get(c).active),!c||!h){let{topic:U,uri:A}=await this.client.core.pairing.create();c=U,f=A}let g=await this.client.core.crypto.generateKeyPair(),y=mr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Ln.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:m,resolve:T,done:O}=j.createDelayedPromise(Xe.FIVE_MINUTES,f8);if(this.events.once(j.engineEvent("session_connect"),async({error:U,session:A})=>{if(U)m(U);else if(A){A.self.publicKey=g;let _=Pl(mr({},A),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(A.topic,_),await this.setExpiry(A.topic,A.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:A.peer.metadata}),T(_)}}),!c){let{message:U}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(U)}let B=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:y}),W=j.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(B,mr({id:B,expiry:W},y)),{uri:f,approval:O}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:c,requiredNamespaces:f,optionalNamespaces:h}=a;u=u||"",j.isValidObject(f)||(f=j.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),y=c.publicKey,m=await this.client.core.crypto.generateSharedKey(g,y);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=mr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:h,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:j.calcExpiry(Rl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(m),await this.sendRequest({topic:m,method:"wc_sessionSettle",params:T,throwOnFailedPublish:!0});let O=Pl(mr({},T),{topic:m,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:g});return await this.client.session.set(m,O),await this.setExpiry(m,j.calcExpiry(Rl)),{topic:m,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(m)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_update",s),({error:c})=>{c?u(c):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,j.calcExpiry(Rl)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=yt.payloadId(),{done:u,resolve:c,reject:f}=j.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(j.engineEvent("session_request",a),({error:h,result:g})=>{h?f(h):c(g)}),await Promise.all([new Promise(async h=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),h()}),new Promise(async h=>{let g=await this.client.core.storage.getItem(Fb);j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),h()}),u()]).then(h=>h[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;yt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):yt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(Fb).catch(s=>this.client.logger.warn(s))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Bn.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Xa.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,j.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:c}=r,f=yt.formatJsonRpcRequest(i,s,u);if(j.isBrowser()&&g8.includes(i)){let y=j.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:y})}let h=await this.client.core.crypto.encode(n,f),g=Xa[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),c?(g.internal=Pl(mr({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,g)):this.client.core.relayer.publish(n,h,g).catch(y=>this.client.logger.error(y)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=yt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),c=await this.client.core.history.get(i,n),f=Xa[c.request.method].res;o?(f.internal=Pl(mr({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(h=>this.client.logger.error(h)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=yt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Xa[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{j.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Bn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Bn.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Bn.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(mr({},n.params));let o=j.calcExpiry(Xe.FIVE_MINUTES),a=mr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=j.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:c})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(yt.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let c=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else yt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:c,requiredNamespaces:f,optionalNamespaces:h,sessionProperties:g,pairingTopic:y}=n.params,m=mr({topic:r,relay:o,expiry:u,namespaces:c,acknowledged:!0,pairingTopic:y,requiredNamespaces:f,optionalNamespaces:h,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(j.engineEvent("session_connect"),{session:m}),this.cleanupDuplicatePairings(m)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):yt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(mr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),j.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,j.calcExpiry(Rl)),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Ln.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(mr({topic:r},s));let o=j.hashMessage(JSON.stringify(yt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),c={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(mr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Bn.idle,this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Bn.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Bn.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,yt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(a,!0)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=j.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let c=j.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:c}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let a=j.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=j.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(j.isExpired(o)){let{message:c}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!j.isValidNamespacesChainId(a,s)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j.isValidRequest(i)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!j.isValidNamespacesRequest(a,s,i.method)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!j.isValidRequestExpiry(o,Bg)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Bg.min} and ${Bg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!j.isValidResponse(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!j.isValidNamespacesChainId(o,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!j.isValidEvent(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Ln.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ln.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);try{yt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):yt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Ln.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Ln.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=j.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Ub=class extends Ln.Store{constructor(e,r){super(e,r,l8,Fg),this.core=e,this.logger=r}},qb=class extends Ln.Store{constructor(e,r){super(e,r,h8,Fg),this.core=e,this.logger=r}},Vb=class extends Ln.Store{constructor(e,r){super(e,r,p8,Fg,n=>n.id),this.core=e,this.logger=r}},Lg=class t extends u8.ISignClient{constructor(e){super(e),this.protocol=Hb,this.version=Gb,this.name=Rg.name,this.events=new c8.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||Rg.name,this.metadata=e?.metadata||j.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Pg.pino(Pg.getDefaultLoggerOptions({level:e?.logger||Rg.logger}));this.core=e?.core||new Ln.Core(e),this.logger=Pg.generateChildLogger(r,this.name),this.session=new qb(this.core,this.logger),this.proposal=new Ub(this.core,this.logger),this.pendingRequest=new Vb(this.core,this.logger),this.engine=new Mb(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Pg.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},jZ=Lg;Je.ENGINE_CONTEXT=d8,Je.ENGINE_QUEUE_STATES=Bn,Je.ENGINE_RPC_OPTS=Xa,Je.HISTORY_CONTEXT=FZ,Je.HISTORY_EVENTS=LZ,Je.HISTORY_STORAGE_VERSION=MZ,Je.METHODS_TO_VERIFY=g8,Je.PROPOSAL_CONTEXT=l8,Je.PROPOSAL_EXPIRY=UZ,Je.PROPOSAL_EXPIRY_MESSAGE=f8,Je.REQUEST_CONTEXT=p8,Je.SESSION_CONTEXT=h8,Je.SESSION_EXPIRY=Rl,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Bg,Je.SIGN_CLIENT_CONTEXT=kb,Je.SIGN_CLIENT_DEFAULT=Rg,Je.SIGN_CLIENT_EVENTS=RZ,Je.SIGN_CLIENT_PROTOCOL=Hb,Je.SIGN_CLIENT_STORAGE_OPTIONS=BZ,Je.SIGN_CLIENT_STORAGE_PREFIX=Fg,Je.SIGN_CLIENT_VERSION=Gb,Je.SignClient=jZ,Je.WALLETCONNECT_DEEPLINK_CHOICE=Fb,Je.default=Lg});var Mg=E(rs=>{"use strict";l();Object.defineProperty(rs,"__esModule",{value:!0});rs.OptionalOperation=rs.Operation=void 0;var QZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(QZ=rs.Operation||(rs.Operation={}));var WZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(WZ=rs.OptionalOperation||(rs.OptionalOperation={}))});var jb=E(Fn=>{"use strict";l();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.WALLETCONNECT_SIGN_LOGIN_DELAY=Fn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Fn.WALLETCONNECT_MULTIVERSX_METHODS=Fn.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var m8=Mg();Fn.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Fn.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(m8.Operation);Fn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(m8.OptionalOperation);Fn.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var zb=E(tn=>{"use strict";l();Object.defineProperty(tn,"__esModule",{value:!0});tn.WalletConnectV2ProviderErrorMessagesEnum=tn.ErrBadAddress=tn.ErrNotImplemented=tn.Err=void 0;var Bl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};tn.Err=Bl;var Qb=class extends Bl{constructor(){super("Method not yet implemented")}};tn.ErrNotImplemented=Qb;var Wb=class extends Bl{constructor(e,r){super(`Bad address: ${e}`,r)}};tn.ErrBadAddress=Wb;var zZ;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(zZ=tn.WalletConnectV2ProviderErrorMessagesEnum||(tn.WalletConnectV2ProviderErrorMessagesEnum={}))});var Kb=E(Ug=>{"use strict";l();Object.defineProperty(Ug,"__esModule",{value:!0});Ug.Logger=void 0;var $b=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Ug.Logger=$b});var w8=E(()=>{"use strict";l();global.Buffer||(global.Buffer=Ls().Buffer)});var v8=E(E8=>{"use strict";l();Object.defineProperty(E8,"__esModule",{value:!0})});var b8=E(A8=>{"use strict";l();Object.defineProperty(A8,"__esModule",{value:!0})});var I8=E(Za=>{"use strict";l();var $Z=Za&&Za.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Za,"__esModule",{value:!0});Za.RelayedTransactionV1Builder=void 0;var KZ=$Z(kt()),Yb=ht(),YZ=Be(),JZ=bn(),XZ=zn(),Jb=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new YZ.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${d.Buffer.from(e).toString("hex")}`,n=new XZ.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new JZ.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new Yb.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Yb.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new KZ.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:d.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new Yb.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?d.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?d.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};Za.RelayedTransactionV1Builder=Jb});var _8=E(qg=>{"use strict";l();Object.defineProperty(qg,"__esModule",{value:!0});qg.Code=void 0;var Xb=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}toString(){return this.hex}valueOf(){return d.Buffer.from(this.hex,"hex")}};qg.Code=Xb});var T8=E(S8=>{"use strict";l();Object.defineProperty(S8,"__esModule",{value:!0})});var O8=E(tu=>{"use strict";l();Object.defineProperty(tu,"__esModule",{value:!0});tu.bech32m=tu.bech32=void 0;var Vg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",x8={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function C8(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=eu(e)^n>>5}e=eu(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=C8(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let h=0;h>5)throw new Error("Non 5-bit word");c=eu(c)^g,f+=Vg.charAt(g)}for(let h=0;h<6;++h)c=eu(c);c^=e;for(let h=0;h<6;++h){let g=c>>(5-h)*5&31;f+=Vg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),c=o.toUpperCase();if(o!==u&&o!==c)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let h=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let y=C8(h);if(typeof y=="string")return y;let m=[];for(let T=0;T=g.length)&&m.push(B)}return y!==e?"Invalid checksum for "+o:{prefix:h,words:m}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:ZZ,fromWordsUnsafe:eee,fromWords:tee}}tu.bech32=N8("bech32");tu.bech32m=N8("bech32m")});var P8=E(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.TokenTransferProperties=jr.TransactionMetadataTransfer=jr.TransactionMetadata=jr.TransactionToDecode=jr.TransactionDecoder=void 0;var D8=O8(),eI=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new co;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Hg;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new co;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new co;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return d.Buffer.from(e).toString("base64")}base64Decode(e){return d.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new co;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=d.Buffer.from(e,"hex"),n=D8.bech32.toWords(r);return D8.bech32.encode("erd",n)}isAddressValid(e){return d.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return d.Buffer.from(e,"base64").toString("hex")}hexToString(e){return d.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};jr.TransactionDecoder=eI;var Hg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};jr.TransactionToDecode=Hg;var co=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};jr.TransactionMetadata=co;var tI=class{constructor(){this.value=BigInt(0)}};jr.TransactionMetadataTransfer=tI;var rI=class{};jr.TokenTransferProperties=rI});var nI=E(Gg=>{"use strict";l();Object.defineProperty(Gg,"__esModule",{value:!0});Gg.ReturnCode=void 0;var Ge=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};Gg.ReturnCode=Ge;Ge.None=new Ge("");Ge.Ok=new Ge("ok");Ge.FunctionNotFound=new Ge("function not found");Ge.FunctionWrongSignature=new Ge("wrong signature for function");Ge.ContractNotFound=new Ge("contract not found");Ge.UserError=new Ge("user error");Ge.OutOfGas=new Ge("out of gas");Ge.AccountCollision=new Ge("account collision");Ge.OutOfFunds=new Ge("out of funds");Ge.CallStackOverFlow=new Ge("call stack overflow");Ge.ContractInvalid=new Ge("contract invalid");Ge.ExecutionFailed=new Ge("execution failed");Ge.Unknown=new Ge("unknown")});var L8=E(kg=>{"use strict";l();Object.defineProperty(kg,"__esModule",{value:!0});kg.ResultsParser=void 0;var ree=P8(),R8=ht(),B8=Be(),ns=aa(),nee=Yo(),ru=nI(),nu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(nu||(nu={}));var iI;(function(t){t.TooMuchGas="@too much gas provided for processing"})(iI||(iI={}));var iee={argsSerializer:new nee.ArgSerializer},sI=class{constructor(e){e=Object.assign(Object.assign({},iee),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new ru.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new ru.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return ns.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return ns.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return ns.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return ns.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return ns.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return ns.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return ns.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return ns.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new B8.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new ree.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:ru.ReturnCode.None,returnMessage:ru.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:ru.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(nu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(nu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(iI.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new R8.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(nu.OnWriteLog,u=>u.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new R8.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(nu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),c=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&c});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||d.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new B8.ErrCannotParseContractResults("no return code");return{returnCode:ru.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){var n,i;let s={},o=e.topics.map(y=>d.Buffer.from(y.valueOf())).slice(1),a=((n=e.dataPayload)===null||n===void 0?void 0:n.valueOf())||d.Buffer.from([]),u=((i=e.additionalData)===null||i===void 0?void 0:i.map(y=>d.Buffer.from(y.valueOf())))||[];u.length==0&&a.length>0&&u.push(d.Buffer.from(a));let c=r.inputs.filter(y=>y.indexed),f=this.argsSerializer.buffersToValues(o,c);for(let y=0;y!y.indexed),g=this.argsSerializer.buffersToValues(u,h);for(let y=0;y{"use strict";l();var see=At&&At.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),or=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&see(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});or(Yo(),At);or(_8(),At);or(vw(),At);or(gE(),At);or(Sc(),At);or(_E(),At);or(EE(),At);or(T8(),At);or(CE(),At);or(Tc(),At);or(L8(),At);or(nI(),At);or(mv(),At);or(BE(),At);or(St(),At)});var M8=E(jg=>{"use strict";l();Object.defineProperty(jg,"__esModule",{value:!0});jg.RelayedTransactionV2Builder=void 0;var F8=Be(),Ll=oI(),oee=bn(),aee=zn(),aI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new F8.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new F8.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Ll.ArgSerializer().valuesToString([new Ll.AddressValue(this.innerTransaction.getReceiver()),new Ll.U64Value(this.innerTransaction.getNonce().valueOf()),new Ll.BytesValue(this.innerTransaction.getData().valueOf()),new Ll.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new aee.TransactionPayload(r),i=new oee.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};jg.RelayedTransactionV2Builder=aI});var cI=E(at=>{"use strict";l();var uee=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cee=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U8=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uee(e,t,r);return cee(e,t),e},lee=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var fee=lee(kt()),hee=ht(),uI=U8(dc()),q8=U8(bh());function dee(t){return d.Buffer.from(t)}at.stringToBuffer=dee;function pee(t){return t.length==0?new fee.default(0):uI.bufferToBigInt(t)}at.bufferToBigInt=pee;function gee(t){return t==0?d.Buffer.from([]):uI.bigIntToBuffer(t)}at.bigIntToBuffer=gee;function yee(t){return t==0?"":uI.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=yee;function mee(t){let e=d.Buffer.from(t).toString("hex");return q8.zeroPadStringIfOddLength(e)}at.utf8ToHex=mee;function wee(t){let e=t.toString("hex");return q8.zeroPadStringIfOddLength(e)}at.bufferToHex=wee;function Eee(t){return hee.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=Eee});var H8=E(Qg=>{"use strict";l();Object.defineProperty(Qg,"__esModule",{value:!0});Qg.TokenOperationsFactory=void 0;var lI=Ss(),vee=aa(),V8=gc(),Aee=bn(),bee=zn(),ne=cI(),fI=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){vee.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex(e.tokenType),ne.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleLocalMint?[ne.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ne.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ne.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ne.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ne.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.initialQuantity),ne.utf8ToHex(e.name),ne.bigIntToHex(e.royalties),ne.utf8ToHex(e.hash),ne.bufferToHex(e.attributes),...e.uris.map(ne.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:a,dataParts:u}){let l=this.buildTransactionPayload(u),f=o||this.computeGasLimit(l,a),d=new pB.TransactionVersion(Xb.TRANSACTION_VERSION_DEFAULT),g=new pB.TransactionOptions(Xb.TRANSACTION_OPTIONS_DEFAULT);return new BZ.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:l,version:d,options:g})}buildTransactionPayload(e){let r=e.join(Xb.ARGUMENTS_SEPARATOR);return new LZ.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};Gg.TokenOperationsFactory=Zb});var yB=m(kg=>{"use strict";c();Object.defineProperty(kg,"__esModule",{value:!0});kg.TokenOperationsFactoryConfig=void 0;var FZ=ht(),e_=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=FZ.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};kg.TokenOperationsFactoryConfig=e_});var wB=m(jg=>{"use strict";c();Object.defineProperty(jg,"__esModule",{value:!0});jg.TokenOperationsOutcomeParser=void 0;var MZ=ht(),t_=Be(),mB=Jb(),r_=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=h.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new t_.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new t_.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new t_.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return mB.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return mB.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return MZ.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};jg.TokenOperationsOutcomeParser=r_});var EB=m(ci=>{"use strict";c();var UZ=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n_=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UZ(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});n_(gB(),ci);n_(yB(),ci);n_(wB(),ci)});var vB=m(Ze=>{"use strict";c();var qZ=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ct=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qZ(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});Q8();Ct(ra(),Ze);Ct(ht(),Ze);Ct(sE(),Ze);Ct(Be(),Ze);Ct(tE(),Ze);Ct($8(),Ze);Ct(K8(),Ze);Ct(na(),Ze);Ct(cc(),Ze);Ct(Y8(),Ze);Ct(lB(),Ze);Ct(fB(),Ze);Ct($b(),Ze);Ct(EB(),Ze);Ct(Em(),Ze);Ct(wn(),Ze);Ct(jn(),Ze);Ct(ed(),Ze);Ct(Zw(),Ze);Ct(wr(),Ze)});var TB=m(xt=>{"use strict";c();var VZ=xt&&xt.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(xt,"__esModule",{value:!0});xt.sleep=xt.getMetadata=xt.applyTransactionSignature=xt.getAddressFromSession=xt.addressIsValid=xt.getConnectionParams=xt.getCurrentTopic=xt.getCurrentSession=void 0;var _B=vB(),AB=jh(),HZ=cl(),Qg=Db(),li=Bb(),i_=Fb(),bB=Bg();function IB(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(SB(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}xt.getCurrentSession=IB;function GZ(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=IB(t,e);if(!r?.topic)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}xt.getCurrentTopic=GZ;function SB(t,e){var r,n,i;let s=[...Qg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(bB.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(bB.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}xt.getConnectionParams=SB;function kZ(t){try{return!_B.Address.fromBech32(t).isEmpty()}catch{return!1}}xt.addressIsValid=kZ;function jZ(t){let e=t.namespaces[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}xt.getAddressFromSession=jZ;function QZ({transaction:t,response:e}){if(!e)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(_B.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new AB.Signature(r)),n&&t.applyGuardianSignature(new AB.Signature(n)),t}xt.applyTransactionSignature=QZ;function WZ(t){if(t)return Object.assign(Object.assign({},t),{url:HZ.getAppMetadata().url})}xt.getMetadata=WZ;function $Z(t){return VZ(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}xt.sleep=$Z});var Cl=m(yr=>{"use strict";c();var bt=yr&&yr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},zZ=yr&&yr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yr,"__esModule",{value:!0});yr.WalletConnectV2Provider=yr.OptionalOperation=yr.Operation=yr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var KZ=jh(),YZ=zZ(k8()),s_=cl(),oo=Db(),ye=Bb();Object.defineProperty(yr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=Fb(),Zi=Bg();Object.defineProperty(yr,"Operation",{enumerable:!0,get:function(){return Zi.Operation}});Object.defineProperty(yr,"OptionalOperation",{enumerable:!0,get:function(){return Zi.OptionalOperation}});var jt=TB(),o_=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return bt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:jt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield YZ.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=jt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Le.Logger.error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return bt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield jt.sleep(oo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=jt.getAddressFromSession(n),o=n.namespaces[oo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:Zi.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||jt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:s_.getSdkError("USER_DISCONNECTED")});else{let r=jt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:s_.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new KZ.Signature(n))}catch{throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return jt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];jt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=jt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return bt(this,void 0,void 0,function*(){return e?jt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Le.Logger.error(`${ye.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return bt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=jt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&jt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>bt(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>bt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=jt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return bt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!s_.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};yr.WalletConnectV2Provider=o_});var xB=m((Fye,CB)=>{"use strict";c();CB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var DB=m((Uye,OB)=>{"use strict";c();var NB=typeof Symbol<"u"&&Symbol,JZ=xB();OB.exports=function(){return typeof NB!="function"||typeof Symbol!="function"||typeof NB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:JZ()}});var BB=m((Vye,RB)=>{"use strict";c();var PB={foo:{}},XZ=Object;RB.exports=function(){return{__proto__:PB}.foo===PB.foo&&!({__proto__:null}instanceof XZ)}});var MB=m((Gye,FB)=>{"use strict";c();var ZZ="Function.prototype.bind called on incompatible ",eee=Object.prototype.toString,tee=Math.max,ree="[object Function]",LB=function(e,r){for(var n=[],i=0;i{"use strict";c();var see=MB();UB.exports=Function.prototype.bind||see});var VB=m((Wye,qB)=>{"use strict";c();var oee=Function.prototype.call,aee=Object.prototype.hasOwnProperty,uee=Wg();qB.exports=uee.call(oee,aee)});var es=m((zye,QB)=>{"use strict";c();var Pe,iu=SyntaxError,jB=Function,nu=TypeError,a_=function(t){try{return jB('"use strict"; return ('+t+").constructor;")()}catch{}},ao=Object.getOwnPropertyDescriptor;if(ao)try{ao({},"")}catch{ao=null}var u_=function(){throw new nu},cee=ao?function(){try{return arguments.callee,u_}catch{try{return ao(arguments,"callee").get}catch{return u_}}}():u_,tu=DB()(),lee=BB()(),Mt=Object.getPrototypeOf||(lee?function(t){return t.__proto__}:null),ru={},fee=typeof Uint8Array>"u"||!Mt?Pe:Mt(Uint8Array),uo={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":tu&&Mt?Mt([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":ru,"%AsyncGenerator%":ru,"%AsyncGeneratorFunction%":ru,"%AsyncIteratorPrototype%":ru,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Pe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pe:FinalizationRegistry,"%Function%":jB,"%GeneratorFunction%":ru,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tu&&Mt?Mt(Mt([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tu||!Mt?Pe:Mt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pe:Promise,"%Proxy%":typeof Proxy>"u"?Pe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tu||!Mt?Pe:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tu&&Mt?Mt(""[Symbol.iterator]()):Pe,"%Symbol%":tu?Symbol:Pe,"%SyntaxError%":iu,"%ThrowTypeError%":cee,"%TypedArray%":fee,"%TypeError%":nu,"%Uint8Array%":typeof Uint8Array>"u"?Pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Pe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pe:WeakSet};if(Mt)try{null.error}catch(t){HB=Mt(Mt(t)),uo["%Error.prototype%"]=HB}var HB,hee=function t(e){var r;if(e==="%AsyncFunction%")r=a_("async function () {}");else if(e==="%GeneratorFunction%")r=a_("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=a_("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Mt&&(r=Mt(i.prototype))}return uo[e]=r,r},GB={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xl=Wg(),$g=VB(),dee=xl.call(Function.call,Array.prototype.concat),pee=xl.call(Function.apply,Array.prototype.splice),kB=xl.call(Function.call,String.prototype.replace),zg=xl.call(Function.call,String.prototype.slice),gee=xl.call(Function.call,RegExp.prototype.exec),yee=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,mee=/\\(\\)?/g,wee=function(e){var r=zg(e,0,1),n=zg(e,-1);if(r==="%"&&n!=="%")throw new iu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new iu("invalid intrinsic syntax, expected opening `%`");var i=[];return kB(e,yee,function(s,o,a,u){i[i.length]=a?kB(u,mee,"$1"):o||s}),i},Eee=function(e,r){var n=e,i;if($g(GB,n)&&(i=GB[n],n="%"+i[0]+"%"),$g(uo,n)){var s=uo[n];if(s===ru&&(s=hee(n)),typeof s>"u"&&!r)throw new nu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new iu("intrinsic "+e+" does not exist!")};QB.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new nu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new nu('"allowMissing" argument must be a boolean');if(gee(/^%?[^%]*%?$/,e)===null)throw new iu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=wee(e),i=n.length>0?n[0]:"",s=Eee("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],pee(n,dee([0,1],l)));for(var f=1,d=!0;f=n.length){var T=ao(a,g);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[g]}else d=$g(a,g),a=a[g];d&&!u&&(uo[o]=a)}}return a}});var f_=m((Yye,WB)=>{"use strict";c();var vee=es(),c_=vee("%Object.defineProperty%",!0),l_=function(){if(c_)try{return c_({},"a",{value:1}),!0}catch{return!1}return!1};l_.hasArrayLengthDefineBug=function(){if(!l_())return null;try{return c_([],"length",{value:1}).length!==1}catch{return!0}};WB.exports=l_});var h_=m((Xye,$B)=>{"use strict";c();var Aee=es(),Kg=Aee("%Object.getOwnPropertyDescriptor%",!0);if(Kg)try{Kg([],"length")}catch{Kg=null}$B.exports=Kg});var YB=m((e0e,KB)=>{"use strict";c();var bee=f_()(),d_=es(),Nl=bee&&d_("%Object.defineProperty%",!0);if(Nl)try{Nl({},"a",{value:1})}catch{Nl=!1}var _ee=d_("%SyntaxError%"),su=d_("%TypeError%"),zB=h_();KB.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new su("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new su("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new su("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new su("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new su("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new su("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!zB&&zB(e,r);if(Nl)Nl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new _ee("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var rL=m((r0e,tL)=>{"use strict";c();var eL=es(),JB=YB(),Iee=f_()(),XB=h_(),ZB=eL("%TypeError%"),See=eL("%Math.floor%");tL.exports=function(e,r){if(typeof e!="function")throw new ZB("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||See(r)!==r)throw new ZB("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&XB){var o=XB(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Iee?JB(e,"length",r,!0,!0):JB(e,"length",r)),e}});var aL=m((i0e,Yg)=>{"use strict";c();var p_=Wg(),ou=es(),Tee=rL(),Cee=ou("%TypeError%"),iL=ou("%Function.prototype.apply%"),sL=ou("%Function.prototype.call%"),oL=ou("%Reflect.apply%",!0)||p_.call(sL,iL),Ol=ou("%Object.defineProperty%",!0),xee=ou("%Math.max%");if(Ol)try{Ol({},"a",{value:1})}catch{Ol=null}Yg.exports=function(e){if(typeof e!="function")throw new Cee("a function is required");var r=oL(p_,sL,arguments);return Tee(r,1+xee(0,e.length-(arguments.length-1)),!0)};var nL=function(){return oL(p_,iL,arguments)};Ol?Ol(Yg.exports,"apply",{value:nL}):Yg.exports.apply=nL});var fL=m((o0e,lL)=>{"use strict";c();var uL=es(),cL=aL(),Nee=cL(uL("String.prototype.indexOf"));lL.exports=function(e,r){var n=uL(e,!!r);return typeof n=="function"&&Nee(e,".prototype.")>-1?cL(n):n}});var hL=m(()=>{c()});var PL=m((f0e,DL)=>{c();var I_=typeof Map=="function"&&Map.prototype,g_=Object.getOwnPropertyDescriptor&&I_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Xg=I_&&g_&&typeof g_.get=="function"?g_.get:null,dL=I_&&Map.prototype.forEach,S_=typeof Set=="function"&&Set.prototype,y_=Object.getOwnPropertyDescriptor&&S_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zg=S_&&y_&&typeof y_.get=="function"?y_.get:null,pL=S_&&Set.prototype.forEach,Oee=typeof WeakMap=="function"&&WeakMap.prototype,Pl=Oee?WeakMap.prototype.has:null,Dee=typeof WeakSet=="function"&&WeakSet.prototype,Rl=Dee?WeakSet.prototype.has:null,Pee=typeof WeakRef=="function"&&WeakRef.prototype,gL=Pee?WeakRef.prototype.deref:null,Ree=Boolean.prototype.valueOf,Bee=Object.prototype.toString,Lee=Function.prototype.toString,Fee=String.prototype.match,T_=String.prototype.slice,rs=String.prototype.replace,Mee=String.prototype.toUpperCase,yL=String.prototype.toLowerCase,SL=RegExp.prototype.test,mL=Array.prototype.concat,Rn=Array.prototype.join,Uee=Array.prototype.slice,wL=Math.floor,E_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,m_=Object.getOwnPropertySymbols,v_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,au=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===au||"symbol")?Symbol.toStringTag:null,TL=Object.prototype.propertyIsEnumerable,EL=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function vL(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||SL.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-wL(-t):wL(t);if(n!==t){var i=String(n),s=T_.call(e,i.length+1);return rs.call(i,r,"$&_")+"."+rs.call(rs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rs.call(e,r,"$&_")}var A_=hL(),AL=A_.custom,bL=xL(AL)?AL:null;DL.exports=function t(e,r,n,i){var s=r||{};if(ts(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ts(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=ts(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ts(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ts(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return OL(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?vL(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?vL(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return b_(e)?"[Array]":"[Object]";var d=rte(s,n);if(typeof i>"u")i=[];else if(NL(i,e)>=0)return"[Circular]";function g(k,K,pe){if(K&&(i=Uee.call(i),i.push(K)),pe){var ue={depth:s.depth};return ts(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(k,ue,n+1,i)}return t(k,s,n+1,i)}if(typeof e=="function"&&!_L(e)){var w=$ee(e),E=Jg(e,g);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Rn.call(E,", ")+" }":"")}if(xL(e)){var T=au?rs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):v_.call(e);return typeof e=="object"&&!au?Dl(T):T}if(Zee(e)){for(var D="<"+yL.call(String(e.nodeName)),B=e.attributes||[],W=0;W",D}if(b_(e)){if(e.length===0)return"[]";var U=Jg(e,g);return d&&!tte(U)?"["+__(U,d)+"]":"[ "+Rn.call(U,", ")+" ]"}if(Hee(e)){var A=Jg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!TL.call(e,"cause")?"{ ["+String(e)+"] "+Rn.call(mL.call("[cause]: "+g(e.cause),A),", ")+" }":A.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Rn.call(A,", ")+" }"}if(typeof e=="object"&&o){if(bL&&typeof e[bL]=="function"&&A_)return A_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(zee(e)){var I=[];return dL&&dL.call(e,function(k,K){I.push(g(K,e,!0)+" => "+g(k,e))}),IL("Map",Xg.call(e),I,d)}if(Jee(e)){var N=[];return pL&&pL.call(e,function(k){N.push(g(k,e))}),IL("Set",Zg.call(e),N,d)}if(Kee(e))return w_("WeakMap");if(Xee(e))return w_("WeakSet");if(Yee(e))return w_("WeakRef");if(kee(e))return Dl(g(Number(e)));if(Qee(e))return Dl(g(E_.call(e)));if(jee(e))return Dl(Ree.call(e));if(Gee(e))return Dl(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Vee(e)&&!_L(e)){var _=Jg(e,g),S=EL?EL(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",J=!S&&er&&Object(e)===e&&er in e?T_.call(ns(e),8,-1):R?"Object":"",Q=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",V=Q+(J||R?"["+Rn.call(mL.call([],J||[],R||[]),": ")+"] ":"");return _.length===0?V+"{}":d?V+"{"+__(_,d)+"}":V+"{ "+Rn.call(_,", ")+" }"}return String(e)};function CL(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function qee(t){return rs.call(String(t),/"/g,""")}function b_(t){return ns(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function Vee(t){return ns(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function _L(t){return ns(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function Hee(t){return ns(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function Gee(t){return ns(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function kee(t){return ns(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function jee(t){return ns(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function xL(t){if(au)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!v_)return!1;try{return v_.call(t),!0}catch{}return!1}function Qee(t){if(!t||typeof t!="object"||!E_)return!1;try{return E_.call(t),!0}catch{}return!1}var Wee=Object.prototype.hasOwnProperty||function(t){return t in this};function ts(t,e){return Wee.call(t,e)}function ns(t){return Bee.call(t)}function $ee(t){if(t.name)return t.name;var e=Fee.call(Lee.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function NL(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return OL(T_.call(t,0,e.maxStringLength),e)+n}var i=rs.call(rs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ete);return CL(i,"single",e)}function ete(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Mee.call(e.toString(16))}function Dl(t){return"Object("+t+")"}function w_(t){return t+" { ? }"}function IL(t,e,r,n){var i=n?__(r,n):Rn.call(r,", ");return t+" ("+e+") {"+i+"}"}function tte(t){for(var e=0;e=0)return!1;return!0}function rte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Rn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Rn.call(Array(e+1),r)}}function __(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+Rn.call(t,","+r)+` -`+e.prev}function Jg(t,e){var r=b_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var C_=es(),uu=fL(),nte=PL(),ite=C_("%TypeError%"),ey=C_("%WeakMap%",!0),ty=C_("%Map%",!0),ste=uu("WeakMap.prototype.get",!0),ote=uu("WeakMap.prototype.set",!0),ate=uu("WeakMap.prototype.has",!0),ute=uu("Map.prototype.get",!0),cte=uu("Map.prototype.set",!0),lte=uu("Map.prototype.has",!0),x_=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},fte=function(t,e){var r=x_(t,e);return r&&r.value},hte=function(t,e,r){var n=x_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},dte=function(t,e){return!!x_(t,e)};RL.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new ite("Side channel does not contain "+nte(s))},get:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ste(e,s)}else if(ty){if(r)return ute(r,s)}else if(n)return fte(n,s)},has:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ate(e,s)}else if(ty){if(r)return lte(r,s)}else if(n)return dte(n,s);return!1},set:function(s,o){ey&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ey),ote(e,s,o)):ty?(r||(r=new ty),cte(r,s,o)):(n||(n={key:{},next:null}),hte(n,s,o))}};return i}});var ry=m((g0e,LL)=>{"use strict";c();var pte=String.prototype.replace,gte=/%20/g,N_={RFC1738:"RFC1738",RFC3986:"RFC3986"};LL.exports={default:N_.RFC3986,formatters:{RFC1738:function(t){return pte.call(t,gte,"+")},RFC3986:function(t){return String(t)}},RFC1738:N_.RFC1738,RFC3986:N_.RFC3986}});var D_=m((m0e,ML)=>{"use strict";c();var yte=ry(),O_=Object.prototype.hasOwnProperty,co=Array.isArray,Bn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mte=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(co(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===yte.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Bn[l];continue}if(l<2048){a=a+(Bn[192|l>>6]+Bn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Bn[224|l>>12]+Bn[128|l>>6&63]+Bn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Bn[240|l>>18]+Bn[128|l>>12&63]+Bn[128|l>>6&63]+Bn[128|l&63]}return a},bte=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var VL=BL(),R_=D_(),Bl=ry(),Cte=Object.prototype.hasOwnProperty,UL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},lo=Array.isArray,xte=String.prototype.split,Nte=Array.prototype.push,HL=function(t,e){Nte.apply(t,lo(e)?e:[e])},Ote=Date.prototype.toISOString,qL=Bl.default,Qt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:R_.encode,encodeValuesOnly:!1,format:qL,formatter:Bl.formatters[qL],indices:!1,serializeDate:function(e){return Ote.call(e)},skipNulls:!1,strictNullHandling:!1},Dte=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},P_={},Pte=function t(e,r,n,i,s,o,a,u,l,f,d,g,w,E,T){for(var D=e,B=T,W=0,U=!1;(B=B.get(P_))!==void 0&&!U;){var A=B.get(e);if(W+=1,typeof A<"u"){if(A===W)throw new RangeError("Cyclic object value");U=!0}typeof B.get(P_)>"u"&&(W=0)}if(typeof a=="function"?D=a(r,D):D instanceof Date?D=f(D):n==="comma"&&lo(D)&&(D=R_.maybeMap(D,function(re){return re instanceof Date?f(re):re})),D===null){if(i)return o&&!w?o(r,Qt.encoder,E,"key",d):r;D=""}if(Dte(D)||R_.isBuffer(D)){if(o){var I=w?r:o(r,Qt.encoder,E,"key",d);if(n==="comma"&&w){for(var N=xte.call(String(D),","),_="",S=0;S"u")return R;var J;if(n==="comma"&&lo(D))J=[{value:D.length>0?D.join(",")||null:void 0}];else if(lo(a))J=a;else{var Q=Object.keys(D);J=u?Q.sort(u):Q}for(var V=0;V"u"?Qt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Qt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Qt.encode,encoder:typeof e.encoder=="function"?e.encoder:Qt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Qt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Qt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Qt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qt.strictNullHandling}};GL.exports=function(t,e){var r=t,n=Rte(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):lo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in UL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=UL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=VL(),f=0;f0?w+g:""}});var WL=m((A0e,QL)=>{"use strict";c();var cu=D_(),B_=Object.prototype.hasOwnProperty,Bte=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:cu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lte=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},jL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Fte="utf8=%26%2310003%3B",Mte="utf8=%E2%9C%93",Ute=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=Bte(E)?[E]:E),B_.call(n,w)?n[w]=cu.combine(n[w],E):n[w]=E}return n},qte=function(t,e,r,n){for(var i=n?e:jL(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Vte=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&B_.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Ut.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Ut.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ut.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ut.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ut.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ut.comma,decoder:typeof e.decoder=="function"?e.decoder:Ut.decoder,delimiter:typeof e.delimiter=="string"||cu.isRegExp(e.delimiter)?e.delimiter:Ut.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ut.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ut.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ut.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ut.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};QL.exports=function(t,e){var r=Hte(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Ute(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var Gte=kL(),kte=WL(),jte=ry();$L.exports={formats:jte,parse:kte,stringify:Gte}});var L_=m(ut=>{"use strict";c();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var KL=m(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.ErrCannotSignedMessage=lu.ErrCannotGetSignedTransactions=void 0;var F_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};lu.ErrCannotGetSignedTransactions=F_;var M_=class extends Error{constructor(){super("Cannot get signed message")}};lu.ErrCannotSignedMessage=M_});var YL=m(ny=>{"use strict";c();Object.defineProperty(ny,"__esModule",{value:!0});ny.PlainSignedTransaction=void 0;var U_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};ny.PlainSignedTransaction=U_});var Ll=m(os=>{"use strict";c();var is=os&&os.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},Qte=os&&os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var q_=Qte(zL()),ss=L_(),V_=KL(),Wte=YL(),H_=class t{constructor(e){this.walletUrl=e}login(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return is(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return is(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return is(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=q_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new V_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return is(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=q_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ss.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ss.WALLET_PROVIDER_CALLBACK_PARAM]===ss.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new V_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new V_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=t.prepareWalletTransaction(o);for(let u in a)a.hasOwnProperty(u)&&!i.hasOwnProperty(u)&&(i[u]=[]),i[u].push(a[u])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};os.WalletProvider=H_});var G_=m((R0e,JL)=>{"use strict";c();JL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var $te=G_(),fo=Object.prototype.toString;function Q_(t){return fo.call(t)==="[object Array]"}function k_(t){return typeof t>"u"}function zte(t){return t!==null&&!k_(t)&&t.constructor!==null&&!k_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Kte(t){return fo.call(t)==="[object ArrayBuffer]"}function Yte(t){return typeof FormData<"u"&&t instanceof FormData}function Jte(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Xte(t){return typeof t=="string"}function Zte(t){return typeof t=="number"}function XL(t){return t!==null&&typeof t=="object"}function iy(t){if(fo.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ere(t){return fo.call(t)==="[object Date]"}function tre(t){return fo.call(t)==="[object File]"}function rre(t){return fo.call(t)==="[object Blob]"}function ZL(t){return fo.call(t)==="[object Function]"}function nre(t){return XL(t)&&ZL(t.pipe)}function ire(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function sre(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ore(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function W_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Q_(t))for(var r=0,n=t.length;r{"use strict";c();var fu=mr();function tF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}rF.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(fu.isURLSearchParams(r))i=r.toString();else{var s=[];fu.forEach(r,function(u,l){u===null||typeof u>"u"||(fu.isArray(u)?l=l+"[]":u=[u],fu.forEach(u,function(d){fu.isDate(d)?d=d.toISOString():fu.isObject(d)&&(d=JSON.stringify(d)),s.push(tF(l)+"="+tF(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var iF=m((q0e,nF)=>{"use strict";c();var cre=mr();function sy(){this.handlers=[]}sy.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};sy.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};sy.prototype.forEach=function(e){cre.forEach(this.handlers,function(n){n!==null&&e(n)})};nF.exports=sy});var oF=m((H0e,sF)=>{"use strict";c();var lre=mr();sF.exports=function(e,r){lre.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var z_=m((k0e,aF)=>{"use strict";c();aF.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,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}});var K_=m((Q0e,uF)=>{"use strict";c();var fre=z_();uF.exports=function(e,r,n,i,s){var o=new Error(e);return fre(o,r,n,i,s)}});var lF=m(($0e,cF)=>{"use strict";c();var hre=K_();cF.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(hre("Request failed with status code "+n.status,n.config,null,n.request,n))}});var hF=m((K0e,fF)=>{"use strict";c();var oy=mr();fF.exports=oy.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),oy.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),oy.isString(s)&&u.push("path="+s),oy.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var pF=m((J0e,dF)=>{"use strict";c();dF.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var yF=m((Z0e,gF)=>{"use strict";c();gF.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var wF=m((tme,mF)=>{"use strict";c();var dre=pF(),pre=yF();mF.exports=function(e,r){return e&&!dre(r)?pre(e,r):r}});var vF=m((nme,EF)=>{"use strict";c();var Y_=mr(),gre=["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"];EF.exports=function(e){var r={},n,i,s;return e&&Y_.forEach(e.split(` -`),function(a){if(s=a.indexOf(":"),n=Y_.trim(a.substr(0,s)).toLowerCase(),i=Y_.trim(a.substr(s+1)),n){if(r[n]&&gre.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var _F=m((sme,bF)=>{"use strict";c();var AF=mr();bF.exports=AF.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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 n=i(window.location.href),function(o){var a=AF.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Fl=m((ame,IF)=>{"use strict";c();function J_(t){this.message=t}J_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};J_.prototype.__CANCEL__=!0;IF.exports=J_});var Z_=m((cme,SF)=>{"use strict";c();var ay=mr(),yre=lF(),mre=hF(),wre=$_(),Ere=wF(),vre=vF(),Are=_F(),X_=K_(),bre=Ml(),_re=Fl();SF.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}ay.isFormData(s)&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+g)}var w=Ere(e.baseURL,e.url);f.open(e.method.toUpperCase(),wre(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function E(){if(f){var D="getAllResponseHeaders"in f?vre(f.getAllResponseHeaders()):null,B=!a||a==="text"||a==="json"?f.responseText:f.response,W={data:B,status:f.status,statusText:f.statusText,headers:D,config:e,request:f};yre(function(A){n(A),l()},function(A){i(A),l()},W),f=null}}if("onloadend"in f?f.onloadend=E:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(E)},f.onabort=function(){f&&(i(X_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(X_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",W=e.transitional||bre.transitional;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),i(X_(B,e,W.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},ay.isStandardBrowserEnv()){var T=(e.withCredentials||Are(w))&&e.xsrfCookieName?mre.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&ay.forEach(o,function(B,W){typeof s>"u"&&W.toLowerCase()==="content-type"?delete o[W]:f.setRequestHeader(W,B)}),ay.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(D){f&&(i(!D||D&&D.type?new _re("canceled"):D),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),f.send(s)})}});var Ml=m((fme,xF)=>{"use strict";c();var Wt=mr(),TF=oF(),Ire=z_(),Sre={"Content-Type":"application/x-www-form-urlencoded"};function CF(t,e){!Wt.isUndefined(t)&&Wt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Tre(){var t;return typeof XMLHttpRequest<"u"?t=Z_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=Z_()),t}function Cre(t,e,r){if(Wt.isString(t))try{return(e||JSON.parse)(t),Wt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var uy={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Tre(),transformRequest:[function(e,r){return TF(r,"Accept"),TF(r,"Content-Type"),Wt.isFormData(e)||Wt.isArrayBuffer(e)||Wt.isBuffer(e)||Wt.isStream(e)||Wt.isFile(e)||Wt.isBlob(e)?e:Wt.isArrayBufferView(e)?e.buffer:Wt.isURLSearchParams(e)?(CF(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Wt.isObject(e)||r&&r["Content-Type"]==="application/json"?(CF(r,"application/json"),Cre(e)):e}],transformResponse:[function(e){var r=this.transitional||uy.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Wt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ire(o,this,"E_JSON_PARSE"):o}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, */*"}}};Wt.forEach(["delete","get","head"],function(e){uy.headers[e]={}});Wt.forEach(["post","put","patch"],function(e){uy.headers[e]=Wt.merge(Sre)});xF.exports=uy});var OF=m((dme,NF)=>{"use strict";c();var xre=mr(),Nre=Ml();NF.exports=function(e,r,n){var i=this||Nre;return xre.forEach(n,function(o){e=o.call(i,e,r)}),e}});var eI=m((gme,DF)=>{"use strict";c();DF.exports=function(e){return!!(e&&e.__CANCEL__)}});var BF=m((mme,RF)=>{"use strict";c();var PF=mr(),tI=OF(),Ore=eI(),Dre=Ml(),Pre=Fl();function rI(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pre("canceled")}RF.exports=function(e){rI(e),e.headers=e.headers||{},e.data=tI.call(e,e.data,e.headers,e.transformRequest),e.headers=PF.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),PF.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Dre.adapter;return r(e).then(function(i){return rI(e),i.data=tI.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ore(i)||(rI(e),i&&i.response&&(i.response.data=tI.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nI=m((Eme,LF)=>{"use strict";c();var Ir=mr();LF.exports=function(e,r){r=r||{};var n={};function i(f,d){return Ir.isPlainObject(f)&&Ir.isPlainObject(d)?Ir.merge(f,d):Ir.isPlainObject(d)?Ir.merge({},d):Ir.isArray(d)?d.slice():d}function s(f){if(Ir.isUndefined(r[f])){if(!Ir.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!Ir.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(Ir.isUndefined(r[f])){if(!Ir.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,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:u};return Ir.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var g=l[d]||s,w=g(d);Ir.isUndefined(w)&&g!==u||(n[d]=w)}),n}});var iI=m((Ame,FF)=>{c();FF.exports={version:"0.24.0"}});var qF=m((_me,UF)=>{"use strict";c();var Rre=iI().version,sI={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){sI[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var MF={};sI.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Rre+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!MF[o]&&(MF[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Bre(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}UF.exports={assertOptions:Bre,validators:sI}});var QF=m((Sme,jF)=>{"use strict";c();var GF=mr(),Lre=$_(),VF=iF(),HF=BF(),cy=nI(),kF=qF(),hu=kF.validators;function Ul(t){this.defaults=t,this.interceptors={request:new VF,response:new VF}}Ul.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=cy(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&kF.assertOptions(r,{silentJSONParsing:hu.transitional(hu.boolean),forcedJSONParsing:hu.transitional(hu.boolean),clarifyTimeoutError:hu.transitional(hu.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var o;if(!i){var a=[HF,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var l=n.shift(),f=n.shift();try{u=l(u)}catch(d){f(d);break}}try{o=HF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Ul.prototype.getUri=function(e){return e=cy(this.defaults,e),Lre(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};GF.forEach(["delete","get","head","options"],function(e){Ul.prototype[e]=function(r,n){return this.request(cy(n||{},{method:e,url:r,data:(n||{}).data}))}});GF.forEach(["post","put","patch"],function(e){Ul.prototype[e]=function(r,n,i){return this.request(cy(i||{},{method:e,url:r,data:n}))}});jF.exports=Ul});var $F=m((Cme,WF)=>{"use strict";c();var Fre=Fl();function du(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";c();zF.exports=function(e){return function(n){return e.apply(null,n)}}});var JF=m((Dme,YF)=>{"use strict";c();YF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var eM=m((Rme,oI)=>{"use strict";c();var XF=mr(),Mre=G_(),ly=QF(),Ure=nI(),qre=Ml();function ZF(t){var e=new ly(t),r=Mre(ly.prototype.request,e);return XF.extend(r,ly.prototype,e),XF.extend(r,e),r.create=function(i){return ZF(Ure(t,i))},r}var Ln=ZF(qre);Ln.Axios=ly;Ln.Cancel=Fl();Ln.CancelToken=$F();Ln.isCancel=eI();Ln.VERSION=iI().version;Ln.all=function(e){return Promise.all(e)};Ln.spread=KF();Ln.isAxiosError=JF();oI.exports=Ln;oI.exports.default=Ln});var rM=m((Lme,tM)=>{c();tM.exports=eM()});var nM=m(fy=>{"use strict";c();Object.defineProperty(fy,"__esModule",{value:!0});fy.NativeAuthClientConfig=void 0;var aI=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};fy.NativeAuthClientConfig=aI});var cI=m(pu=>{"use strict";c();var ho=pu&&pu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(pu,"__esModule",{value:!0});pu.NativeAuthClient=void 0;var Vre=rM(),Hre=nM(),uI=class{constructor(e){this.config=Object.assign(new Hre.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return ho(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return ho(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return ho(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return ho(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return ho(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return ho(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(h.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return ho(this,void 0,void 0,function*(){return yield Vre.default.get(e,{headers:this.config.extraRequestHeaders})})}};pu.NativeAuthClient=uI});var uM=m(py=>{"use strict";c();Object.defineProperty(py,"__esModule",{value:!0});py.TransactionStatus=void 0;var lI=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};py.TransactionStatus=lI});var mu=m(Vt=>{"use strict";c();var Gre=Vt&&Vt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kre=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jre=Vt&&Vt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gre(e,t,r);return kre(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var cM=jre(Rm()),Qre="erd",fI=class t{constructor(e){this.value=e}static fromPubkey(e){let r=cM.toWords(e),n=cM.encode(Qre,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=fI;var hI=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return lM(this.value)}};Vt.Nonce=hI;function lM(t){let e=t.toString(16);return fM(e)}Vt.numberToPaddedHex=lM;function Wre(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Wre;function fM(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=fM});var dM=m(gy=>{"use strict";c();Object.defineProperty(gy,"__esModule",{value:!0});gy.TransactionReceipt=void 0;var hM=mu(),dI=class t{constructor(){this.value="",this.sender=new hM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new hM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};gy.TransactionReceipt=dI});var pM=m(Fn=>{"use strict";c();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ErrContractQuery=Fn.ErrNetworkProvider=Fn.ErrUnexpectedCondition=Fn.Err=void 0;var wu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Fn.Err=wu;var pI=class extends wu{constructor(e){super(`Unexpected condition: [${e}]`)}};Fn.ErrUnexpectedCondition=pI;var gI=class extends wu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Fn.ErrNetworkProvider=gI;var yI=class extends wu{constructor(e){super(e.message.replace("executeQuery:",""))}};Fn.ErrContractQuery=yI});var yM=m(cs=>{"use strict";c();Object.defineProperty(cs,"__esModule",{value:!0});cs.TransactionEventTopic=cs.TransactionEventData=cs.TransactionEvent=void 0;var gM=mu(),mI=class t{constructor(e){this.address=new gM.Address(""),this.identifier="",this.topics=[],this.dataPayload=new ql(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new gM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new yy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new ql(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};cs.TransactionEvent=mI;var ql=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};cs.TransactionEventData=ql;var yy=class{constructor(e){this.raw=h.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};cs.TransactionEventTopic=yy});var EI=m(my=>{"use strict";c();Object.defineProperty(my,"__esModule",{value:!0});my.TransactionLogs=void 0;var $re=pM(),mM=mu(),zre=yM(),wI=class t{constructor(e){this.address=new mM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new mM.Address(e.address),r.events=(e.events||[]).map(n=>zre.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new $re.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};my.TransactionLogs=wI});var EM=m(Eu=>{"use strict";c();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.ContractResultItem=Eu.ContractResults=void 0;var wM=EI(),wy=mu(),vI=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>Vl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Vl.fromApiHttpResponse(n));return new t(r)}};Eu.ContractResults=vI;var Vl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new wy.Address(""),this.sender=new wy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new wM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new wy.Address(e.receiver),r.sender=new wy.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=wM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Eu.ContractResultItem=Vl});var vM=m(ls=>{"use strict";c();var Kre=ls&&ls.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ls,"__esModule",{value:!0});ls.EsdtContractAddress=ls.MaxUint64AsBigNumber=void 0;var Yre=Kre(Gt()),Jre=mu();ls.MaxUint64AsBigNumber=new Yre.default("18446744073709551615");ls.EsdtContractAddress=new Jre.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var AM=m(vu=>{"use strict";c();var Xre=vu&&vu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vu,"__esModule",{value:!0});vu.ContractQueryResponse=void 0;var Zre=Xre(Gt()),ene=vM(),AI=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new Zre.default(e.gasRemaining||e.GasRemaining||0),o=ene.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>h.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};vu.ContractQueryResponse=AI});var bM=m(Ey=>{"use strict";c();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.ContractQueryRequest=void 0;var bI=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Ey.ContractQueryRequest=bI});var RM=m((zwe,PM)=>{c();PM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var fs=m(go=>{c();var _I,tne=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];go.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};go.getSymbolTotalCodewords=function(e){return tne[e]};go.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};go.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');_I=e};go.isKanjiModeEnabled=function(){return typeof _I<"u"};go.toSJIS=function(e){return _I(e)}});var by=m(kr=>{c();kr.L={bit:1};kr.M={bit:0};kr.Q={bit:3};kr.H={bit:2};function rne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return kr.L;case"m":case"medium":return kr.M;case"q":case"quartile":return kr.Q;case"h":case"high":return kr.H;default:throw new Error("Unknown EC Level: "+t)}}kr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};kr.from=function(e,r){if(kr.isValid(e))return e;try{return rne(e)}catch{return r}}});var FM=m((eEe,LM)=>{c();function BM(){this.buffer=[],this.length=0}BM.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};LM.exports=BM});var UM=m((rEe,MM)=>{c();function Hl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Hl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Hl.prototype.get=function(t,e){return this.data[t*this.size+e]};Hl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};MM.exports=Hl});var qM=m(_y=>{c();var nne=fs().getSymbolSize;_y.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=nne(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var ine=fs().getSymbolSize,VM=7;HM.getPositions=function(e){let r=ine(e);return[[0,0],[r-VM,0],[0,r-VM]]}});var kM=m(et=>{c();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var yo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=yo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=yo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=yo.N1+(i-5)),s>=5&&(n+=yo.N1+(s-5))}return n};et.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*yo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var hs=by(),Iy=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Sy=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];II.getBlocksCount=function(e,r){switch(r){case hs.L:return Iy[(e-1)*4+0];case hs.M:return Iy[(e-1)*4+1];case hs.Q:return Iy[(e-1)*4+2];case hs.H:return Iy[(e-1)*4+3];default:return}};II.getTotalCodewordsCount=function(e,r){switch(r){case hs.L:return Sy[(e-1)*4+0];case hs.M:return Sy[(e-1)*4+1];case hs.Q:return Sy[(e-1)*4+2];case hs.H:return Sy[(e-1)*4+3];default:return}}});var jM=m(Cy=>{c();var Gl=new Uint8Array(512),Ty=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Gl[r]=e,Ty[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Gl[r]=Gl[r-255]})();Cy.log=function(e){if(e<1)throw new Error("log("+e+")");return Ty[e]};Cy.exp=function(e){return Gl[e]};Cy.mul=function(e,r){return e===0||r===0?0:Gl[Ty[e]+Ty[r]]}});var QM=m(kl=>{c();var TI=jM();kl.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var WM=QM();function CI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}CI.prototype.initialize=function(e){this.degree=e,this.genPoly=WM.generateECPolynomial(this.degree)};CI.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=WM.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};$M.exports=CI});var xI=m(KM=>{c();KM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var NI=m(fi=>{c();var YM="[0-9]+",one="[A-Z $%*+\\-./:]+",jl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";jl=jl.replace(/u/g,"\\u");var ane="(?:(?![A-Z0-9 $%*+\\-./:]|"+jl+`)(?:.|[\r -]))+`;fi.KANJI=new RegExp(jl,"g");fi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");fi.BYTE=new RegExp(ane,"g");fi.NUMERIC=new RegExp(YM,"g");fi.ALPHANUMERIC=new RegExp(one,"g");var une=new RegExp("^"+jl+"$"),cne=new RegExp("^"+YM+"$"),lne=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");fi.testKanji=function(e){return une.test(e)};fi.testNumeric=function(e){return cne.test(e)};fi.testAlphanumeric=function(e){return lne.test(e)}});var ds=m(Nt=>{c();var fne=xI(),OI=NI();Nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Nt.MIXED={bit:-1};Nt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!fne.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Nt.getBestModeForData=function(e){return OI.testNumeric(e)?Nt.NUMERIC:OI.testAlphanumeric(e)?Nt.ALPHANUMERIC:OI.testKanji(e)?Nt.KANJI:Nt.BYTE};Nt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Nt.isValid=function(e){return e&&e.bit&&e.ccBits};function hne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Nt.NUMERIC;case"alphanumeric":return Nt.ALPHANUMERIC;case"kanji":return Nt.KANJI;case"byte":return Nt.BYTE;default:throw new Error("Unknown mode: "+t)}}Nt.from=function(e,r){if(Nt.isValid(e))return e;try{return hne(e)}catch{return r}}});var tU=m(mo=>{c();var xy=fs(),dne=SI(),JM=by(),ps=ds(),DI=xI(),ZM=7973,XM=xy.getBCHDigit(ZM);function pne(t,e,r){for(let n=1;n<=40;n++)if(e<=mo.getCapacity(n,r,t))return n}function eU(t,e){return ps.getCharCountIndicator(t,e)+4}function gne(t,e){let r=0;return t.forEach(function(n){let i=eU(n.mode,e);r+=i+n.getBitsLength()}),r}function yne(t,e){for(let r=1;r<=40;r++)if(gne(t,r)<=mo.getCapacity(r,e,ps.MIXED))return r}mo.from=function(e,r){return DI.isValid(e)?parseInt(e,10):r};mo.getCapacity=function(e,r,n){if(!DI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ps.BYTE);let i=xy.getSymbolTotalCodewords(e),s=dne.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ps.MIXED)return o;let a=o-eU(n,e);switch(n){case ps.NUMERIC:return Math.floor(a/10*3);case ps.ALPHANUMERIC:return Math.floor(a/11*2);case ps.KANJI:return Math.floor(a/13);case ps.BYTE:default:return Math.floor(a/8)}};mo.getBestVersionForData=function(e,r){let n,i=JM.from(r,JM.M);if(Array.isArray(e)){if(e.length>1)return yne(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return pne(n.mode,n.getLength(),i)};mo.getEncodedBits=function(e){if(!DI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;xy.getBCHDigit(r)-XM>=0;)r^=ZM<{c();var PI=fs(),nU=1335,mne=21522,rU=PI.getBCHDigit(nU);iU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;PI.getBCHDigit(i)-rU>=0;)i^=nU<{c();var wne=ds();function Au(t){this.mode=wne.NUMERIC,this.data=t.toString()}Au.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Au.prototype.getLength=function(){return this.data.length};Au.prototype.getBitsLength=function(){return Au.getBitsLength(this.data.length)};Au.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};oU.exports=Au});var cU=m((OEe,uU)=>{c();var Ene=ds(),RI=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function bu(t){this.mode=Ene.ALPHANUMERIC,this.data=t}bu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};bu.prototype.getLength=function(){return this.data.length};bu.prototype.getBitsLength=function(){return bu.getBitsLength(this.data.length)};bu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=RI.indexOf(this.data[r])*45;n+=RI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(RI.indexOf(this.data[r]),6)};uU.exports=bu});var fU=m((PEe,lU)=>{"use strict";c();lU.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var dU=m((BEe,hU)=>{c();var vne=fU(),Ane=ds();function _u(t){this.mode=Ane.BYTE,typeof t=="string"&&(t=vne(t)),this.data=new Uint8Array(t)}_u.getBitsLength=function(e){return e*8};_u.prototype.getLength=function(){return this.data.length};_u.prototype.getBitsLength=function(){return _u.getBitsLength(this.data.length)};_u.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var bne=ds(),_ne=fs();function Iu(t){this.mode=bne.KANJI,this.data=t}Iu.getBitsLength=function(e){return e*13};Iu.prototype.getLength=function(){return this.data.length};Iu.prototype.getBitsLength=function(){return Iu.getBitsLength(this.data.length)};Iu.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};pU.exports=Iu});var yU=m((UEe,BI)=>{"use strict";c();var Ql={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Ql.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,w=i[u],E=typeof i[u]>"u",(E||w>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Ql.single_source_shortest_paths(t,e,r);return Ql.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Ql.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof BI<"u"&&(BI.exports=Ql)});var IU=m(Su=>{c();var He=ds(),EU=aU(),vU=cU(),AU=dU(),bU=gU(),Wl=NI(),Ny=fs(),Ine=yU();function mU(t){return unescape(encodeURIComponent(t)).length}function $l(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function _U(t){let e=$l(Wl.NUMERIC,He.NUMERIC,t),r=$l(Wl.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ny.isKanjiModeEnabled()?(n=$l(Wl.BYTE,He.BYTE,t),i=$l(Wl.KANJI,He.KANJI,t)):(n=$l(Wl.BYTE_KANJI,He.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function LI(t,e){switch(e){case He.NUMERIC:return EU.getBitsLength(t);case He.ALPHANUMERIC:return vU.getBitsLength(t);case He.KANJI:return bU.getBitsLength(t);case He.BYTE:return AU.getBitsLength(t)}}function Sne(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function Tne(t){let e=[];for(let r=0;r{c();var Dy=fs(),FI=by(),xne=FM(),Nne=UM(),One=qM(),Dne=GM(),qI=kM(),VI=SI(),Pne=zM(),Oy=tU(),Rne=sU(),Bne=ds(),MI=IU();function Lne(t,e){let r=t.size,n=Dne.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function Fne(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function UI(t,e,r){let n=t.size,i=Rne.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function qne(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Vne(t,e,r){let n=new xne;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Bne.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Dy.getSymbolTotalCodewords(t),s=VI.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{"use strict";l();Object.defineProperty(Wg,"__esModule",{value:!0});Wg.TokenOperationsFactoryConfig=void 0;var Iee=ht(),hI=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=Iee.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};Wg.TokenOperationsFactoryConfig=hI});var j8=E(zg=>{"use strict";l();Object.defineProperty(zg,"__esModule",{value:!0});zg.TokenOperationsOutcomeParser=void 0;var _ee=ht(),dI=Be(),k8=cI(),pI=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=d.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new dI.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new dI.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new dI.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return k8.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return k8.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return _ee.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};zg.TokenOperationsOutcomeParser=pI});var Q8=E(hi=>{"use strict";l();var See=hi&&hi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gI=hi&&hi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&See(e,t,r)};Object.defineProperty(hi,"__esModule",{value:!0});gI(H8(),hi);gI(G8(),hi);gI(j8(),hi)});var W8=E(Ze=>{"use strict";l();var Tee=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ct=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Tee(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});w8();Ct(oa(),Ze);Ct(ht(),Ze);Ct(fE(),Ze);Ct(Be(),Ze);Ct(aE(),Ze);Ct(v8(),Ze);Ct(b8(),Ze);Ct(aa(),Ze);Ct(gc(),Ze);Ct(I8(),Ze);Ct(M8(),Ze);Ct(Bd(),Ze);Ct(oI(),Ze);Ct(Q8(),Ze);Ct(_m(),Ze);Ct(bn(),Ze);Ct(zn(),Ze);Ct(ud(),Ze);Ct(sE(),Ze);Ct(vr(),Ze)});var X8=E(xt=>{"use strict";l();var Cee=xt&&xt.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(xt,"__esModule",{value:!0});xt.sleep=xt.getMetadata=xt.applyTransactionSignature=xt.getAddressFromSession=xt.addressIsValid=xt.getConnectionParams=xt.getCurrentTopic=xt.getCurrentSession=void 0;var K8=W8(),z8=vc(),xee=wl(),$g=jb(),di=zb(),yI=Kb(),$8=Mg();function Y8(t,e){if(!e)throw new Error(di.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(J8(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw yI.Logger.error(di.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(di.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}xt.getCurrentSession=Y8;function Nee(t,e){if(!e)throw new Error(di.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Y8(t,e);if(!r?.topic)throw new Error(di.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}xt.getCurrentTopic=Nee;function J8(t,e){var r,n,i;let s=[...$g.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes($8.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push($8.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${$g.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[$g.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}xt.getConnectionParams=J8;function Oee(t){try{return!K8.Address.fromBech32(t).isEmpty()}catch{return!1}}xt.addressIsValid=Oee;function Dee(t){let e=t.namespaces[$g.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}xt.getAddressFromSession=Dee;function Pee({transaction:t,response:e}){if(!e)throw yI.Logger.error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw yI.Logger.error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(K8.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new z8.Signature(r)),n&&t.applyGuardianSignature(new z8.Signature(n)),t}xt.applyTransactionSignature=Pee;function Ree(t){if(t)return Object.assign(Object.assign({},t),{url:xee.getAppMetadata().url})}xt.getMetadata=Ree;function Bee(t){return Cee(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}xt.sleep=Bee});var Fl=E(wr=>{"use strict";l();var bt=wr&&wr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},Lee=wr&&wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wr,"__esModule",{value:!0});wr.WalletConnectV2Provider=wr.OptionalOperation=wr.Operation=wr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var Fee=vc(),Mee=Lee(y8()),mI=wl(),lo=jb(),ye=zb();Object.defineProperty(wr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=Kb(),is=Mg();Object.defineProperty(wr,"Operation",{enumerable:!0,get:function(){return is.Operation}});Object.defineProperty(wr,"OptionalOperation",{enumerable:!0,get:function(){return is.OptionalOperation}});var Qt=X8(),wI=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return bt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Qt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield Mee.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Qt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Le.Logger.error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return bt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield Qt.sleep(lo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Qt.getAddressFromSession(n),o=n.namespaces[lo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(is.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?is.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:is.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Qt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:mI.getSdkError("USER_DISCONNECTED")});else{let r=Qt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:mI.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:is.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new Fee.Signature(n))}catch{throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:is.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Qt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:is.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Qt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Qt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return bt(this,void 0,void 0,function*(){return e?Qt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Le.Logger.error(`${ye.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return bt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Qt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&Qt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:c}=a,f=e.session.get(o),h=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:h})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>bt(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>bt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Qt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,c;return bt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!mI.isValidArray(f))return;for(let h of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(h.topic,0);else try{yield(c=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||c===void 0?void 0:c.unsubscribe(h.topic)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};wr.WalletConnectV2Provider=wI});var eL=E((T0e,Z8)=>{"use strict";l();Z8.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var nL=E((x0e,rL)=>{"use strict";l();var tL=typeof Symbol<"u"&&Symbol,Uee=eL();rL.exports=function(){return typeof tL!="function"||typeof Symbol!="function"||typeof tL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Uee()}});var oL=E((O0e,sL)=>{"use strict";l();var iL={foo:{}},qee=Object;sL.exports=function(){return{__proto__:iL}.foo===iL.foo&&!({__proto__:null}instanceof qee)}});var cL=E((P0e,uL)=>{"use strict";l();var Vee="Function.prototype.bind called on incompatible ",Hee=Object.prototype.toString,Gee=Math.max,kee="[object Function]",aL=function(e,r){for(var n=[],i=0;i{"use strict";l();var Wee=cL();lL.exports=Function.prototype.bind||Wee});var hL=E((F0e,fL)=>{"use strict";l();var zee=Function.prototype.call,$ee=Object.prototype.hasOwnProperty,Kee=Kg();fL.exports=Kee.call(zee,$ee)});var ss=E((U0e,mL)=>{"use strict";l();var Pe,au=SyntaxError,yL=Function,ou=TypeError,EI=function(t){try{return yL('"use strict"; return ('+t+").constructor;")()}catch{}},fo=Object.getOwnPropertyDescriptor;if(fo)try{fo({},"")}catch{fo=null}var vI=function(){throw new ou},Yee=fo?function(){try{return arguments.callee,vI}catch{try{return fo(arguments,"callee").get}catch{return vI}}}():vI,iu=nL()(),Jee=oL()(),qt=Object.getPrototypeOf||(Jee?function(t){return t.__proto__}:null),su={},Xee=typeof Uint8Array>"u"||!qt?Pe:qt(Uint8Array),ho={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&qt?qt([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":su,"%AsyncGenerator%":su,"%AsyncGeneratorFunction%":su,"%AsyncIteratorPrototype%":su,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Pe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pe:FinalizationRegistry,"%Function%":yL,"%GeneratorFunction%":su,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&qt?qt(qt([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!iu||!qt?Pe:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pe:Promise,"%Proxy%":typeof Proxy>"u"?Pe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!iu||!qt?Pe:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&qt?qt(""[Symbol.iterator]()):Pe,"%Symbol%":iu?Symbol:Pe,"%SyntaxError%":au,"%ThrowTypeError%":Yee,"%TypedArray%":Xee,"%TypeError%":ou,"%Uint8Array%":typeof Uint8Array>"u"?Pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Pe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pe:WeakSet};if(qt)try{null.error}catch(t){dL=qt(qt(t)),ho["%Error.prototype%"]=dL}var dL,Zee=function t(e){var r;if(e==="%AsyncFunction%")r=EI("async function () {}");else if(e==="%GeneratorFunction%")r=EI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=EI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&qt&&(r=qt(i.prototype))}return ho[e]=r,r},pL={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ml=Kg(),Yg=hL(),ete=Ml.call(Function.call,Array.prototype.concat),tte=Ml.call(Function.apply,Array.prototype.splice),gL=Ml.call(Function.call,String.prototype.replace),Jg=Ml.call(Function.call,String.prototype.slice),rte=Ml.call(Function.call,RegExp.prototype.exec),nte=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ite=/\\(\\)?/g,ste=function(e){var r=Jg(e,0,1),n=Jg(e,-1);if(r==="%"&&n!=="%")throw new au("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new au("invalid intrinsic syntax, expected opening `%`");var i=[];return gL(e,nte,function(s,o,a,u){i[i.length]=a?gL(u,ite,"$1"):o||s}),i},ote=function(e,r){var n=e,i;if(Yg(pL,n)&&(i=pL[n],n="%"+i[0]+"%"),Yg(ho,n)){var s=ho[n];if(s===su&&(s=Zee(n)),typeof s>"u"&&!r)throw new ou("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new au("intrinsic "+e+" does not exist!")};mL.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new ou("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ou('"allowMissing" argument must be a boolean');if(rte(/^%?[^%]*%?$/,e)===null)throw new au("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ste(e),i=n.length>0?n[0]:"",s=ote("%"+i+"%",r),o=s.name,a=s.value,u=!1,c=s.alias;c&&(i=c[0],tte(n,ete([0,1],c)));for(var f=1,h=!0;f=n.length){var T=fo(a,g);h=!!T,h&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[g]}else h=Yg(a,g),a=a[g];h&&!u&&(ho[o]=a)}}return a}});var II=E((V0e,wL)=>{"use strict";l();var ate=ss(),AI=ate("%Object.defineProperty%",!0),bI=function(){if(AI)try{return AI({},"a",{value:1}),!0}catch{return!1}return!1};bI.hasArrayLengthDefineBug=function(){if(!bI())return null;try{return AI([],"length",{value:1}).length!==1}catch{return!0}};wL.exports=bI});var _I=E((G0e,EL)=>{"use strict";l();var ute=ss(),Xg=ute("%Object.getOwnPropertyDescriptor%",!0);if(Xg)try{Xg([],"length")}catch{Xg=null}EL.exports=Xg});var bL=E((j0e,AL)=>{"use strict";l();var cte=II()(),SI=ss(),Ul=cte&&SI("%Object.defineProperty%",!0);if(Ul)try{Ul({},"a",{value:1})}catch{Ul=!1}var lte=SI("%SyntaxError%"),uu=SI("%TypeError%"),vL=_I();AL.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new uu("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new uu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new uu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new uu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new uu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new uu("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!vL&&vL(e,r);if(Ul)Ul(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new lte("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var xL=E((W0e,CL)=>{"use strict";l();var TL=ss(),IL=bL(),fte=II()(),_L=_I(),SL=TL("%TypeError%"),hte=TL("%Math.floor%");CL.exports=function(e,r){if(typeof e!="function")throw new SL("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||hte(r)!==r)throw new SL("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&_L){var o=_L(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(fte?IL(e,"length",r,!0,!0):IL(e,"length",r)),e}});var RL=E(($0e,Zg)=>{"use strict";l();var TI=Kg(),cu=ss(),dte=xL(),pte=cu("%TypeError%"),OL=cu("%Function.prototype.apply%"),DL=cu("%Function.prototype.call%"),PL=cu("%Reflect.apply%",!0)||TI.call(DL,OL),ql=cu("%Object.defineProperty%",!0),gte=cu("%Math.max%");if(ql)try{ql({},"a",{value:1})}catch{ql=null}Zg.exports=function(e){if(typeof e!="function")throw new pte("a function is required");var r=PL(TI,DL,arguments);return dte(r,1+gte(0,e.length-(arguments.length-1)),!0)};var NL=function(){return PL(TI,OL,arguments)};ql?ql(Zg.exports,"apply",{value:NL}):Zg.exports.apply=NL});var ML=E((Y0e,FL)=>{"use strict";l();var BL=ss(),LL=RL(),yte=LL(BL("String.prototype.indexOf"));FL.exports=function(e,r){var n=BL(e,!!r);return typeof n=="function"&&yte(e,".prototype.")>-1?LL(n):n}});var UL=E(()=>{l()});var iF=E((tme,nF)=>{l();var FI=typeof Map=="function"&&Map.prototype,CI=Object.getOwnPropertyDescriptor&&FI?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ty=FI&&CI&&typeof CI.get=="function"?CI.get:null,qL=FI&&Map.prototype.forEach,MI=typeof Set=="function"&&Set.prototype,xI=Object.getOwnPropertyDescriptor&&MI?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ry=MI&&xI&&typeof xI.get=="function"?xI.get:null,VL=MI&&Set.prototype.forEach,mte=typeof WeakMap=="function"&&WeakMap.prototype,Hl=mte?WeakMap.prototype.has:null,wte=typeof WeakSet=="function"&&WeakSet.prototype,Gl=wte?WeakSet.prototype.has:null,Ete=typeof WeakRef=="function"&&WeakRef.prototype,HL=Ete?WeakRef.prototype.deref:null,vte=Boolean.prototype.valueOf,Ate=Object.prototype.toString,bte=Function.prototype.toString,Ite=String.prototype.match,UI=String.prototype.slice,as=String.prototype.replace,_te=String.prototype.toUpperCase,GL=String.prototype.toLowerCase,JL=RegExp.prototype.test,kL=Array.prototype.concat,Mn=Array.prototype.join,Ste=Array.prototype.slice,jL=Math.floor,DI=typeof BigInt=="function"?BigInt.prototype.valueOf:null,NI=Object.getOwnPropertySymbols,PI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,lu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",tr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===lu||!0)?Symbol.toStringTag:null,XL=Object.prototype.propertyIsEnumerable,QL=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function WL(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||JL.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-jL(-t):jL(t);if(n!==t){var i=String(n),s=UI.call(e,i.length+1);return as.call(i,r,"$&_")+"."+as.call(as.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return as.call(e,r,"$&_")}var RI=UL(),zL=RI.custom,$L=eF(zL)?zL:null;nF.exports=function t(e,r,n,i){var s=r||{};if(os(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(os(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=os(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(os(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(os(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return rF(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?WL(e,u):u}if(typeof e=="bigint"){var c=String(e)+"n";return a?WL(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return BI(e)?"[Array]":"[Object]";var h=kte(s,n);if(typeof i>"u")i=[];else if(tF(i,e)>=0)return"[Circular]";function g(k,K,ge){if(K&&(i=Ste.call(i),i.push(K)),ge){var ue={depth:s.depth};return os(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(k,ue,n+1,i)}return t(k,s,n+1,i)}if(typeof e=="function"&&!KL(e)){var y=Bte(e),m=ey(e,g);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(m.length>0?" { "+Mn.call(m,", ")+" }":"")}if(eF(e)){var T=lu?as.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):PI.call(e);return typeof e=="object"&&!lu?Vl(T):T}if(Vte(e)){for(var O="<"+GL.call(String(e.nodeName)),B=e.attributes||[],W=0;W",O}if(BI(e)){if(e.length===0)return"[]";var U=ey(e,g);return h&&!Gte(U)?"["+LI(U,h)+"]":"[ "+Mn.call(U,", ")+" ]"}if(xte(e)){var A=ey(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!XL.call(e,"cause")?"{ ["+String(e)+"] "+Mn.call(kL.call("[cause]: "+g(e.cause),A),", ")+" }":A.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Mn.call(A,", ")+" }"}if(typeof e=="object"&&o){if($L&&typeof e[$L]=="function"&&RI)return RI(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Lte(e)){var _=[];return qL&&qL.call(e,function(k,K){_.push(g(K,e,!0)+" => "+g(k,e))}),YL("Map",ty.call(e),_,h)}if(Ute(e)){var N=[];return VL&&VL.call(e,function(k){N.push(g(k,e))}),YL("Set",ry.call(e),N,h)}if(Fte(e))return OI("WeakMap");if(qte(e))return OI("WeakSet");if(Mte(e))return OI("WeakRef");if(Ote(e))return Vl(g(Number(e)));if(Pte(e))return Vl(g(DI.call(e)));if(Dte(e))return Vl(vte.call(e));if(Nte(e))return Vl(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Cte(e)&&!KL(e)){var I=ey(e,g),S=QL?QL(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",J=!S&&tr&&Object(e)===e&&tr in e?UI.call(us(e),8,-1):R?"Object":"",Q=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",V=Q+(J||R?"["+Mn.call(kL.call([],J||[],R||[]),": ")+"] ":"");return I.length===0?V+"{}":h?V+"{"+LI(I,h)+"}":V+"{ "+Mn.call(I,", ")+" }"}return String(e)};function ZL(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Tte(t){return as.call(String(t),/"/g,""")}function BI(t){return us(t)==="[object Array]"&&(!tr||!(typeof t=="object"&&tr in t))}function Cte(t){return us(t)==="[object Date]"&&(!tr||!(typeof t=="object"&&tr in t))}function KL(t){return us(t)==="[object RegExp]"&&(!tr||!(typeof t=="object"&&tr in t))}function xte(t){return us(t)==="[object Error]"&&(!tr||!(typeof t=="object"&&tr in t))}function Nte(t){return us(t)==="[object String]"&&(!tr||!(typeof t=="object"&&tr in t))}function Ote(t){return us(t)==="[object Number]"&&(!tr||!(typeof t=="object"&&tr in t))}function Dte(t){return us(t)==="[object Boolean]"&&(!tr||!(typeof t=="object"&&tr in t))}function eF(t){if(lu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!PI)return!1;try{return PI.call(t),!0}catch{}return!1}function Pte(t){if(!t||typeof t!="object"||!DI)return!1;try{return DI.call(t),!0}catch{}return!1}var Rte=Object.prototype.hasOwnProperty||function(t){return t in this};function os(t,e){return Rte.call(t,e)}function us(t){return Ate.call(t)}function Bte(t){if(t.name)return t.name;var e=Ite.call(bte.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function tF(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return rF(UI.call(t,0,e.maxStringLength),e)+n}var i=as.call(as.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Hte);return ZL(i,"single",e)}function Hte(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+_te.call(e.toString(16))}function Vl(t){return"Object("+t+")"}function OI(t){return t+" { ? }"}function YL(t,e,r,n){var i=n?LI(r,n):Mn.call(r,", ");return t+" ("+e+") {"+i+"}"}function Gte(t){for(var e=0;e=0)return!1;return!0}function kte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Mn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Mn.call(Array(e+1),r)}}function LI(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Mn.call(t,","+r)+` +`+e.prev}function ey(t,e){var r=BI(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";l();var qI=ss(),fu=ML(),jte=iF(),Qte=qI("%TypeError%"),ny=qI("%WeakMap%",!0),iy=qI("%Map%",!0),Wte=fu("WeakMap.prototype.get",!0),zte=fu("WeakMap.prototype.set",!0),$te=fu("WeakMap.prototype.has",!0),Kte=fu("Map.prototype.get",!0),Yte=fu("Map.prototype.set",!0),Jte=fu("Map.prototype.has",!0),VI=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Xte=function(t,e){var r=VI(t,e);return r&&r.value},Zte=function(t,e,r){var n=VI(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},ere=function(t,e){return!!VI(t,e)};sF.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Qte("Side channel does not contain "+jte(s))},get:function(s){if(ny&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Wte(e,s)}else if(iy){if(r)return Kte(r,s)}else if(n)return Xte(n,s)},has:function(s){if(ny&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $te(e,s)}else if(iy){if(r)return Jte(r,s)}else if(n)return ere(n,s);return!1},set:function(s,o){ny&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ny),zte(e,s,o)):iy?(r||(r=new iy),Yte(r,s,o)):(n||(n={key:{},next:null}),Zte(n,s,o))}};return i}});var sy=E((sme,aF)=>{"use strict";l();var tre=String.prototype.replace,rre=/%20/g,HI={RFC1738:"RFC1738",RFC3986:"RFC3986"};aF.exports={default:HI.RFC3986,formatters:{RFC1738:function(t){return tre.call(t,rre,"+")},RFC3986:function(t){return String(t)}},RFC1738:HI.RFC1738,RFC3986:HI.RFC3986}});var kI=E((ame,cF)=>{"use strict";l();var nre=sy(),GI=Object.prototype.hasOwnProperty,po=Array.isArray,Un=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),ire=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(po(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===nre.RFC1738&&(c===40||c===41)){a+=o.charAt(u);continue}if(c<128){a=a+Un[c];continue}if(c<2048){a=a+(Un[192|c>>6]+Un[128|c&63]);continue}if(c<55296||c>=57344){a=a+(Un[224|c>>12]+Un[128|c>>6&63]+Un[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),a+=Un[240|c>>18]+Un[128|c>>12&63]+Un[128|c>>6&63]+Un[128|c&63]}return a},cre=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";l();var hF=oF(),QI=kI(),kl=sy(),pre=Object.prototype.hasOwnProperty,lF={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},go=Array.isArray,gre=String.prototype.split,yre=Array.prototype.push,dF=function(t,e){yre.apply(t,go(e)?e:[e])},mre=Date.prototype.toISOString,fF=kl.default,Wt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:QI.encode,encodeValuesOnly:!1,format:fF,formatter:kl.formatters[fF],indices:!1,serializeDate:function(e){return mre.call(e)},skipNulls:!1,strictNullHandling:!1},wre=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},jI={},Ere=function t(e,r,n,i,s,o,a,u,c,f,h,g,y,m,T){for(var O=e,B=T,W=0,U=!1;(B=B.get(jI))!==void 0&&!U;){var A=B.get(e);if(W+=1,typeof A<"u"){if(A===W)throw new RangeError("Cyclic object value");U=!0}typeof B.get(jI)>"u"&&(W=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&go(O)&&(O=QI.maybeMap(O,function(re){return re instanceof Date?f(re):re})),O===null){if(i)return o&&!y?o(r,Wt.encoder,m,"key",h):r;O=""}if(wre(O)||QI.isBuffer(O)){if(o){var _=y?r:o(r,Wt.encoder,m,"key",h);if(n==="comma"&&y){for(var N=gre.call(String(O),","),I="",S=0;S"u")return R;var J;if(n==="comma"&&go(O))J=[{value:O.length>0?O.join(",")||null:void 0}];else if(go(a))J=a;else{var Q=Object.keys(O);J=u?Q.sort(u):Q}for(var V=0;V"u"?Wt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Wt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Wt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Wt.encode,encoder:typeof e.encoder=="function"?e.encoder:Wt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Wt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Wt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Wt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Wt.strictNullHandling}};pF.exports=function(t,e){var r=t,n=vre(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):go(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in lF?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=lF[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=hF(),f=0;f0?y+g:""}});var wF=E((fme,mF)=>{"use strict";l();var hu=kI(),WI=Object.prototype.hasOwnProperty,Are=Array.isArray,Vt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:hu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},bre=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},yF=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Ire="utf8=%26%2310003%3B",_re="utf8=%E2%9C%93",Sre=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,c=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(m=Are(m)?[m]:m),WI.call(n,y)?n[y]=hu.combine(n[y],m):n[y]=m}return n},Tre=function(t,e,r,n){for(var i=n?e:yF(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Cre=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),c=u?s.slice(0,u.index):s,f=[];if(c){if(!n.plainObjects&&WI.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var h=0;n.depth>0&&(u=a.exec(s))!==null&&h"u"?Vt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Vt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Vt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Vt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Vt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Vt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Vt.comma,decoder:typeof e.decoder=="function"?e.decoder:Vt.decoder,delimiter:typeof e.delimiter=="string"||hu.isRegExp(e.delimiter)?e.delimiter:Vt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Vt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Vt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Vt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Vt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Vt.strictNullHandling}};mF.exports=function(t,e){var r=xre(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Sre(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";l();var Nre=gF(),Ore=wF(),Dre=sy();EF.exports={formats:Dre,parse:Ore,stringify:Nre}});var zI=E(ut=>{"use strict";l();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var AF=E(du=>{"use strict";l();Object.defineProperty(du,"__esModule",{value:!0});du.ErrCannotSignedMessage=du.ErrCannotGetSignedTransactions=void 0;var $I=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};du.ErrCannotGetSignedTransactions=$I;var KI=class extends Error{constructor(){super("Cannot get signed message")}};du.ErrCannotSignedMessage=KI});var bF=E(oy=>{"use strict";l();Object.defineProperty(oy,"__esModule",{value:!0});oy.PlainSignedTransaction=void 0;var YI=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};oy.PlainSignedTransaction=YI});var jl=E(fs=>{"use strict";l();var cs=fs&&fs.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},Pre=fs&&fs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fs,"__esModule",{value:!0});fs.WalletProvider=void 0;var JI=Pre(vF()),ls=zI(),XI=AF(),Rre=bF(),ZI=class t{constructor(e){this.walletUrl=e}login(e){return cs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ls.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return cs(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return cs(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return cs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ls.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return cs(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ls.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=JI.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new XI.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return cs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ls.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return cs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ls.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return cs(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=JI.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ls.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ls.WALLET_PROVIDER_CALLBACK_PARAM]===ls.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new XI.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new XI.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=t.prepareWalletTransaction(o);for(let u in a)a.hasOwnProperty(u)&&!i.hasOwnProperty(u)&&(i[u]=[]),i[u].push(a[u])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};fs.WalletProvider=ZI});var e_=E((Ime,IF)=>{"use strict";l();IF.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";l();var Bre=e_(),yo=Object.prototype.toString;function n_(t){return yo.call(t)==="[object Array]"}function t_(t){return typeof t>"u"}function Lre(t){return t!==null&&!t_(t)&&t.constructor!==null&&!t_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Fre(t){return yo.call(t)==="[object ArrayBuffer]"}function Mre(t){return typeof FormData<"u"&&t instanceof FormData}function Ure(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function qre(t){return typeof t=="string"}function Vre(t){return typeof t=="number"}function _F(t){return t!==null&&typeof t=="object"}function ay(t){if(yo.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Hre(t){return yo.call(t)==="[object Date]"}function Gre(t){return yo.call(t)==="[object File]"}function kre(t){return yo.call(t)==="[object Blob]"}function SF(t){return yo.call(t)==="[object Function]"}function jre(t){return _F(t)&&SF(t.pipe)}function Qre(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function Wre(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function zre(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function i_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),n_(t))for(var r=0,n=t.length;r{"use strict";l();var pu=Er();function CF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}xF.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(pu.isURLSearchParams(r))i=r.toString();else{var s=[];pu.forEach(r,function(u,c){u===null||typeof u>"u"||(pu.isArray(u)?c=c+"[]":u=[u],pu.forEach(u,function(h){pu.isDate(h)?h=h.toISOString():pu.isObject(h)&&(h=JSON.stringify(h)),s.push(CF(c)+"="+CF(h))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var OF=E((Nme,NF)=>{"use strict";l();var Yre=Er();function uy(){this.handlers=[]}uy.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};uy.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};uy.prototype.forEach=function(e){Yre.forEach(this.handlers,function(n){n!==null&&e(n)})};NF.exports=uy});var PF=E((Dme,DF)=>{"use strict";l();var Jre=Er();DF.exports=function(e,r){Jre.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var o_=E((Rme,RF)=>{"use strict";l();RF.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,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}});var a_=E((Lme,BF)=>{"use strict";l();var Xre=o_();BF.exports=function(e,r,n,i,s){var o=new Error(e);return Xre(o,r,n,i,s)}});var FF=E((Mme,LF)=>{"use strict";l();var Zre=a_();LF.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Zre("Request failed with status code "+n.status,n.config,null,n.request,n))}});var UF=E((qme,MF)=>{"use strict";l();var cy=Er();MF.exports=cy.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),cy.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),cy.isString(s)&&u.push("path="+s),cy.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var VF=E((Hme,qF)=>{"use strict";l();qF.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var GF=E((kme,HF)=>{"use strict";l();HF.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var jF=E((Qme,kF)=>{"use strict";l();var ene=VF(),tne=GF();kF.exports=function(e,r){return e&&!ene(r)?tne(e,r):r}});var WF=E((zme,QF)=>{"use strict";l();var u_=Er(),rne=["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"];QF.exports=function(e){var r={},n,i,s;return e&&u_.forEach(e.split(` +`),function(a){if(s=a.indexOf(":"),n=u_.trim(a.substr(0,s)).toLowerCase(),i=u_.trim(a.substr(s+1)),n){if(r[n]&&rne.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var KF=E((Kme,$F)=>{"use strict";l();var zF=Er();$F.exports=zF.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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 n=i(window.location.href),function(o){var a=zF.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Ql=E((Jme,YF)=>{"use strict";l();function c_(t){this.message=t}c_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};c_.prototype.__CANCEL__=!0;YF.exports=c_});var f_=E((Zme,JF)=>{"use strict";l();var ly=Er(),nne=FF(),ine=UF(),sne=s_(),one=jF(),ane=WF(),une=KF(),l_=a_(),cne=Wl(),lne=Ql();JF.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function c(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}ly.isFormData(s)&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(h+":"+g)}var y=one(e.baseURL,e.url);f.open(e.method.toUpperCase(),sne(y,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function m(){if(f){var O="getAllResponseHeaders"in f?ane(f.getAllResponseHeaders()):null,B=!a||a==="text"||a==="json"?f.responseText:f.response,W={data:B,status:f.status,statusText:f.statusText,headers:O,config:e,request:f};nne(function(A){n(A),c()},function(A){i(A),c()},W),f=null}}if("onloadend"in f?f.onloadend=m:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(m)},f.onabort=function(){f&&(i(l_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(l_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",W=e.transitional||cne.transitional;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),i(l_(B,e,W.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},ly.isStandardBrowserEnv()){var T=(e.withCredentials||une(y))&&e.xsrfCookieName?ine.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&ly.forEach(o,function(B,W){typeof s>"u"&&W.toLowerCase()==="content-type"?delete o[W]:f.setRequestHeader(W,B)}),ly.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(O){f&&(i(!O||O&&O.type?new lne("canceled"):O),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),f.send(s)})}});var Wl=E((twe,eM)=>{"use strict";l();var zt=Er(),XF=PF(),fne=o_(),hne={"Content-Type":"application/x-www-form-urlencoded"};function ZF(t,e){!zt.isUndefined(t)&&zt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function dne(){var t;return typeof XMLHttpRequest<"u"?t=f_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=f_()),t}function pne(t,e,r){if(zt.isString(t))try{return(e||JSON.parse)(t),zt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var fy={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:dne(),transformRequest:[function(e,r){return XF(r,"Accept"),XF(r,"Content-Type"),zt.isFormData(e)||zt.isArrayBuffer(e)||zt.isBuffer(e)||zt.isStream(e)||zt.isFile(e)||zt.isBlob(e)?e:zt.isArrayBufferView(e)?e.buffer:zt.isURLSearchParams(e)?(ZF(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):zt.isObject(e)||r&&r["Content-Type"]==="application/json"?(ZF(r,"application/json"),pne(e)):e}],transformResponse:[function(e){var r=this.transitional||fy.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&zt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?fne(o,this,"E_JSON_PARSE"):o}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, */*"}}};zt.forEach(["delete","get","head"],function(e){fy.headers[e]={}});zt.forEach(["post","put","patch"],function(e){fy.headers[e]=zt.merge(hne)});eM.exports=fy});var rM=E((nwe,tM)=>{"use strict";l();var gne=Er(),yne=Wl();tM.exports=function(e,r,n){var i=this||yne;return gne.forEach(n,function(o){e=o.call(i,e,r)}),e}});var h_=E((swe,nM)=>{"use strict";l();nM.exports=function(e){return!!(e&&e.__CANCEL__)}});var oM=E((awe,sM)=>{"use strict";l();var iM=Er(),d_=rM(),mne=h_(),wne=Wl(),Ene=Ql();function p_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ene("canceled")}sM.exports=function(e){p_(e),e.headers=e.headers||{},e.data=d_.call(e,e.data,e.headers,e.transformRequest),e.headers=iM.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),iM.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||wne.adapter;return r(e).then(function(i){return p_(e),i.data=d_.call(e,i.data,i.headers,e.transformResponse),i},function(i){return mne(i)||(p_(e),i&&i.response&&(i.response.data=d_.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var g_=E((cwe,aM)=>{"use strict";l();var _r=Er();aM.exports=function(e,r){r=r||{};var n={};function i(f,h){return _r.isPlainObject(f)&&_r.isPlainObject(h)?_r.merge(f,h):_r.isPlainObject(h)?_r.merge({},h):_r.isArray(h)?h.slice():h}function s(f){if(_r.isUndefined(r[f])){if(!_r.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!_r.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(_r.isUndefined(r[f])){if(!_r.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var c={url:o,method:o,data:o,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:u};return _r.forEach(Object.keys(e).concat(Object.keys(r)),function(h){var g=c[h]||s,y=g(h);_r.isUndefined(y)&&g!==u||(n[h]=y)}),n}});var y_=E((fwe,uM)=>{l();uM.exports={version:"0.24.0"}});var fM=E((dwe,lM)=>{"use strict";l();var vne=y_().version,m_={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){m_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var cM={};m_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+vne+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!cM[o]&&(cM[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Ane(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}lM.exports={assertOptions:Ane,validators:m_}});var mM=E((gwe,yM)=>{"use strict";l();var pM=Er(),bne=s_(),hM=OF(),dM=oM(),hy=g_(),gM=fM(),gu=gM.validators;function zl(t){this.defaults=t,this.interceptors={request:new hM,response:new hM}}zl.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=hy(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&gM.assertOptions(r,{silentJSONParsing:gu.transitional(gu.boolean),forcedJSONParsing:gu.transitional(gu.boolean),clarifyTimeoutError:gu.transitional(gu.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var o;if(!i){var a=[dM,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var c=n.shift(),f=n.shift();try{u=c(u)}catch(h){f(h);break}}try{o=dM(u)}catch(h){return Promise.reject(h)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};zl.prototype.getUri=function(e){return e=hy(this.defaults,e),bne(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};pM.forEach(["delete","get","head","options"],function(e){zl.prototype[e]=function(r,n){return this.request(hy(n||{},{method:e,url:r,data:(n||{}).data}))}});pM.forEach(["post","put","patch"],function(e){zl.prototype[e]=function(r,n,i){return this.request(hy(i||{},{method:e,url:r,data:n}))}});yM.exports=zl});var EM=E((mwe,wM)=>{"use strict";l();var Ine=Ql();function yu(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";l();vM.exports=function(e){return function(n){return e.apply(null,n)}}});var IM=E((Awe,bM)=>{"use strict";l();bM.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var TM=E((Iwe,w_)=>{"use strict";l();var _M=Er(),_ne=e_(),dy=mM(),Sne=g_(),Tne=Wl();function SM(t){var e=new dy(t),r=_ne(dy.prototype.request,e);return _M.extend(r,dy.prototype,e),_M.extend(r,e),r.create=function(i){return SM(Sne(t,i))},r}var qn=SM(Tne);qn.Axios=dy;qn.Cancel=Ql();qn.CancelToken=EM();qn.isCancel=h_();qn.VERSION=y_().version;qn.all=function(e){return Promise.all(e)};qn.spread=AM();qn.isAxiosError=IM();w_.exports=qn;w_.exports.default=qn});var xM=E((Swe,CM)=>{l();CM.exports=TM()});var NM=E(py=>{"use strict";l();Object.defineProperty(py,"__esModule",{value:!0});py.NativeAuthClientConfig=void 0;var E_=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};py.NativeAuthClientConfig=E_});var A_=E(mu=>{"use strict";l();var mo=mu&&mu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(mu,"__esModule",{value:!0});mu.NativeAuthClient=void 0;var Cne=xM(),xne=NM(),v_=class{constructor(e){this.config=Object.assign(new xne.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return mo(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return mo(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return mo(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return mo(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return mo(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return mo(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(d.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return mo(this,void 0,void 0,function*(){return yield Cne.default.get(e,{headers:this.config.extraRequestHeaders})})}};mu.NativeAuthClient=v_});var BM=E(wy=>{"use strict";l();Object.defineProperty(wy,"__esModule",{value:!0});wy.TransactionStatus=void 0;var b_=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};wy.TransactionStatus=b_});var vu=E(Ht=>{"use strict";l();var Nne=Ht&&Ht.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),One=Ht&&Ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dne=Ht&&Ht.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Nne(e,t,r);return One(e,t),e};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.zeroPadStringIfOddLength=Ht.isPaddedHex=Ht.numberToPaddedHex=Ht.Nonce=Ht.Address=void 0;var LM=Dne(qm()),Pne="erd",I_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=LM.toWords(e),n=LM.encode(Pne,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Ht.Address=I_;var __=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return FM(this.value)}};Ht.Nonce=__;function FM(t){let e=t.toString(16);return MM(e)}Ht.numberToPaddedHex=FM;function Rne(t){t=t||"";let e=d.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ht.isPaddedHex=Rne;function MM(t){return t=t||"",t.length%2==1?"0"+t:t}Ht.zeroPadStringIfOddLength=MM});var qM=E(Ey=>{"use strict";l();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.TransactionReceipt=void 0;var UM=vu(),S_=class t{constructor(){this.value="",this.sender=new UM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new UM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Ey.TransactionReceipt=S_});var VM=E(Vn=>{"use strict";l();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.ErrContractQuery=Vn.ErrNetworkProvider=Vn.ErrUnexpectedCondition=Vn.Err=void 0;var Au=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Vn.Err=Au;var T_=class extends Au{constructor(e){super(`Unexpected condition: [${e}]`)}};Vn.ErrUnexpectedCondition=T_;var C_=class extends Au{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Vn.ErrNetworkProvider=C_;var x_=class extends Au{constructor(e){super(e.message.replace("executeQuery:",""))}};Vn.ErrContractQuery=x_});var GM=E(ds=>{"use strict";l();Object.defineProperty(ds,"__esModule",{value:!0});ds.TransactionEventTopic=ds.TransactionEventData=ds.TransactionEvent=void 0;var HM=vu(),N_=class t{constructor(e){this.address=new HM.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new bu(d.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new HM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new vy(n)),r.dataPayload=bu.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(bu.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};ds.TransactionEvent=N_;var bu=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(d.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ds.TransactionEventData=bu;var vy=class{constructor(e){this.raw=d.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ds.TransactionEventTopic=vy});var D_=E(Ay=>{"use strict";l();Object.defineProperty(Ay,"__esModule",{value:!0});Ay.TransactionLogs=void 0;var Bne=VM(),kM=vu(),Lne=GM(),O_=class t{constructor(e){this.address=new kM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new kM.Address(e.address),r.events=(e.events||[]).map(n=>Lne.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new Bne.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};Ay.TransactionLogs=O_});var QM=E(Iu=>{"use strict";l();Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ContractResultItem=Iu.ContractResults=void 0;var jM=D_(),by=vu(),P_=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>$l.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>$l.fromApiHttpResponse(n));return new t(r)}};Iu.ContractResults=P_;var $l=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new by.Address(""),this.sender=new by.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new jM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=d.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new by.Address(e.receiver),r.sender=new by.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=jM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Iu.ContractResultItem=$l});var WM=E(ps=>{"use strict";l();var Fne=ps&&ps.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ps,"__esModule",{value:!0});ps.EsdtContractAddress=ps.MaxUint64AsBigNumber=void 0;var Mne=Fne(kt()),Une=vu();ps.MaxUint64AsBigNumber=new Mne.default("18446744073709551615");ps.EsdtContractAddress=new Une.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var zM=E(_u=>{"use strict";l();var qne=_u&&_u.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_u,"__esModule",{value:!0});_u.ContractQueryResponse=void 0;var Vne=qne(kt()),Hne=WM(),R_=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new Vne.default(e.gasRemaining||e.GasRemaining||0),o=Hne.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>d.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};_u.ContractQueryResponse=R_});var $M=E(Iy=>{"use strict";l();Object.defineProperty(Iy,"__esModule",{value:!0});Iy.ContractQueryRequest=void 0;var B_=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Iy.ContractQueryRequest=B_});var sU=E((LEe,iU)=>{l();iU.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var gs=E(wo=>{l();var L_,Gne=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];wo.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};wo.getSymbolTotalCodewords=function(e){return Gne[e]};wo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};wo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');L_=e};wo.isKanjiModeEnabled=function(){return typeof L_<"u"};wo.toSJIS=function(e){return L_(e)}});var Ty=E(Qr=>{l();Qr.L={bit:1};Qr.M={bit:0};Qr.Q={bit:3};Qr.H={bit:2};function kne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Qr.L;case"m":case"medium":return Qr.M;case"q":case"quartile":return Qr.Q;case"h":case"high":return Qr.H;default:throw new Error("Unknown EC Level: "+t)}}Qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Qr.from=function(e,r){if(Qr.isValid(e))return e;try{return kne(e)}catch{return r}}});var uU=E((HEe,aU)=>{l();function oU(){this.buffer=[],this.length=0}oU.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};aU.exports=oU});var lU=E((kEe,cU)=>{l();function Kl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Kl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Kl.prototype.get=function(t,e){return this.data[t*this.size+e]};Kl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Kl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};cU.exports=Kl});var fU=E(Cy=>{l();var jne=gs().getSymbolSize;Cy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=jne(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{l();var Qne=gs().getSymbolSize,hU=7;dU.getPositions=function(e){let r=Qne(e);return[[0,0],[r-hU,0],[0,r-hU]]}});var gU=E(et=>{l();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Eo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Eo.N1+(i-5)),o=f,i=1),f=e.get(c,u),f===a?s++:(s>=5&&(n+=Eo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Eo.N1+(i-5)),s>=5&&(n+=Eo.N1+(s-5))}return n};et.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*Eo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{l();var ys=Ty(),xy=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ny=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];F_.getBlocksCount=function(e,r){switch(r){case ys.L:return xy[(e-1)*4+0];case ys.M:return xy[(e-1)*4+1];case ys.Q:return xy[(e-1)*4+2];case ys.H:return xy[(e-1)*4+3];default:return}};F_.getTotalCodewordsCount=function(e,r){switch(r){case ys.L:return Ny[(e-1)*4+0];case ys.M:return Ny[(e-1)*4+1];case ys.Q:return Ny[(e-1)*4+2];case ys.H:return Ny[(e-1)*4+3];default:return}}});var yU=E(Dy=>{l();var Yl=new Uint8Array(512),Oy=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Yl[r]=e,Oy[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Yl[r]=Yl[r-255]})();Dy.log=function(e){if(e<1)throw new Error("log("+e+")");return Oy[e]};Dy.exp=function(e){return Yl[e]};Dy.mul=function(e,r){return e===0||r===0?0:Yl[Oy[e]+Oy[r]]}});var mU=E(Jl=>{l();var U_=yU();Jl.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{l();var wU=mU();function q_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}q_.prototype.initialize=function(e){this.degree=e,this.genPoly=wU.generateECPolynomial(this.degree)};q_.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=wU.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};EU.exports=q_});var V_=E(AU=>{l();AU.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var H_=E(pi=>{l();var bU="[0-9]+",zne="[A-Z $%*+\\-./:]+",Xl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Xl=Xl.replace(/u/g,"\\u");var $ne="(?:(?![A-Z0-9 $%*+\\-./:]|"+Xl+`)(?:.|[\r +]))+`;pi.KANJI=new RegExp(Xl,"g");pi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");pi.BYTE=new RegExp($ne,"g");pi.NUMERIC=new RegExp(bU,"g");pi.ALPHANUMERIC=new RegExp(zne,"g");var Kne=new RegExp("^"+Xl+"$"),Yne=new RegExp("^"+bU+"$"),Jne=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");pi.testKanji=function(e){return Kne.test(e)};pi.testNumeric=function(e){return Yne.test(e)};pi.testAlphanumeric=function(e){return Jne.test(e)}});var ms=E(Nt=>{l();var Xne=V_(),G_=H_();Nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Nt.MIXED={bit:-1};Nt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Xne.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Nt.getBestModeForData=function(e){return G_.testNumeric(e)?Nt.NUMERIC:G_.testAlphanumeric(e)?Nt.ALPHANUMERIC:G_.testKanji(e)?Nt.KANJI:Nt.BYTE};Nt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Nt.isValid=function(e){return e&&e.bit&&e.ccBits};function Zne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Nt.NUMERIC;case"alphanumeric":return Nt.ALPHANUMERIC;case"kanji":return Nt.KANJI;case"byte":return Nt.BYTE;default:throw new Error("Unknown mode: "+t)}}Nt.from=function(e,r){if(Nt.isValid(e))return e;try{return Zne(e)}catch{return r}}});var CU=E(vo=>{l();var Py=gs(),eie=M_(),IU=Ty(),ws=ms(),k_=V_(),SU=7973,_U=Py.getBCHDigit(SU);function tie(t,e,r){for(let n=1;n<=40;n++)if(e<=vo.getCapacity(n,r,t))return n}function TU(t,e){return ws.getCharCountIndicator(t,e)+4}function rie(t,e){let r=0;return t.forEach(function(n){let i=TU(n.mode,e);r+=i+n.getBitsLength()}),r}function nie(t,e){for(let r=1;r<=40;r++)if(rie(t,r)<=vo.getCapacity(r,e,ws.MIXED))return r}vo.from=function(e,r){return k_.isValid(e)?parseInt(e,10):r};vo.getCapacity=function(e,r,n){if(!k_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ws.BYTE);let i=Py.getSymbolTotalCodewords(e),s=eie.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ws.MIXED)return o;let a=o-TU(n,e);switch(n){case ws.NUMERIC:return Math.floor(a/10*3);case ws.ALPHANUMERIC:return Math.floor(a/11*2);case ws.KANJI:return Math.floor(a/13);case ws.BYTE:default:return Math.floor(a/8)}};vo.getBestVersionForData=function(e,r){let n,i=IU.from(r,IU.M);if(Array.isArray(e)){if(e.length>1)return nie(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return tie(n.mode,n.getLength(),i)};vo.getEncodedBits=function(e){if(!k_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Py.getBCHDigit(r)-_U>=0;)r^=SU<{l();var j_=gs(),NU=1335,iie=21522,xU=j_.getBCHDigit(NU);OU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;j_.getBCHDigit(i)-xU>=0;)i^=NU<{l();var sie=ms();function Su(t){this.mode=sie.NUMERIC,this.data=t.toString()}Su.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Su.prototype.getLength=function(){return this.data.length};Su.prototype.getBitsLength=function(){return Su.getBitsLength(this.data.length)};Su.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};PU.exports=Su});var LU=E((mve,BU)=>{l();var oie=ms(),Q_=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Tu(t){this.mode=oie.ALPHANUMERIC,this.data=t}Tu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Tu.prototype.getLength=function(){return this.data.length};Tu.prototype.getBitsLength=function(){return Tu.getBitsLength(this.data.length)};Tu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=Q_.indexOf(this.data[r])*45;n+=Q_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(Q_.indexOf(this.data[r]),6)};BU.exports=Tu});var MU=E((Eve,FU)=>{"use strict";l();FU.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var qU=E((Ave,UU)=>{l();var aie=MU(),uie=ms();function Cu(t){this.mode=uie.BYTE,typeof t=="string"&&(t=aie(t)),this.data=new Uint8Array(t)}Cu.getBitsLength=function(e){return e*8};Cu.prototype.getLength=function(){return this.data.length};Cu.prototype.getBitsLength=function(){return Cu.getBitsLength(this.data.length)};Cu.prototype.write=function(t){for(let e=0,r=this.data.length;e{l();var cie=ms(),lie=gs();function xu(t){this.mode=cie.KANJI,this.data=t}xu.getBitsLength=function(e){return e*13};xu.prototype.getLength=function(){return this.data.length};xu.prototype.getBitsLength=function(){return xu.getBitsLength(this.data.length)};xu.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};VU.exports=xu});var GU=E((Sve,W_)=>{"use strict";l();var Zl={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Zl.PriorityQueue.make();s.push(e,0);for(var o,a,u,c,f,h,g,y,m;!s.empty();){o=s.pop(),a=o.value,c=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(h=f[u],g=c+h,y=i[u],m=typeof i[u]>"u",(m||y>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Zl.single_source_shortest_paths(t,e,r);return Zl.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Zl.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof W_<"u"&&(W_.exports=Zl)});var YU=E(Nu=>{l();var He=ms(),QU=RU(),WU=LU(),zU=qU(),$U=HU(),ef=H_(),Ry=gs(),fie=GU();function kU(t){return unescape(encodeURIComponent(t)).length}function tf(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function KU(t){let e=tf(ef.NUMERIC,He.NUMERIC,t),r=tf(ef.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ry.isKanjiModeEnabled()?(n=tf(ef.BYTE,He.BYTE,t),i=tf(ef.KANJI,He.KANJI,t)):(n=tf(ef.BYTE_KANJI,He.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function z_(t,e){switch(e){case He.NUMERIC:return QU.getBitsLength(t);case He.ALPHANUMERIC:return WU.getBitsLength(t);case He.KANJI:return $U.getBitsLength(t);case He.BYTE:return zU.getBitsLength(t)}}function hie(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function die(t){let e=[];for(let r=0;r{l();var Ly=gs(),$_=Ty(),gie=uU(),yie=lU(),mie=fU(),wie=pU(),J_=gU(),X_=M_(),Eie=vU(),By=CU(),vie=DU(),Aie=ms(),K_=YU();function bie(t,e){let r=t.size,n=wie.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function Iie(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function Y_(t,e,r){let n=t.size,i=vie.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function Tie(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let c=!1;o>>s&1)===1),t.set(i,a-u,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Cie(t,e,r){let n=new gie;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Aie.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Ly.getSymbolTotalCodewords(t),s=X_.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u=7&&Une(u,e),qne(u,o),isNaN(n)&&(n=qI.getBestMask(u,UI.bind(null,u,r))),qI.applyMask(n,u),UI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}SU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=FI.M,i,s;return typeof r<"u"&&(n=FI.from(r.errorCorrectionLevel,FI.M),i=Oy.from(r.version),s=qI.from(r.maskPattern),r.toSJISFunc&&Dy.setToSJISFunction(r.toSJISFunc)),Gne(e,i,n,s)}});var HI=m(wo=>{c();function CU(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}wo.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:CU(e.color.dark||"#000000ff"),light:CU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};wo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};wo.getImageWidth=function(e,r){let n=wo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};wo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=wo.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var GI=HI();function kne(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function jne(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Py.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=jne()),i=GI.getOptions(i);let o=GI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return GI.qrToImageData(u.data,e,i),kne(a,s,o),a.putImageData(u,0,0),s};Py.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Py.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var DU=m(OU=>{c();var Qne=HI();function NU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function kI(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Wne(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?kI("M",u+r,.5+l+r):kI("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+l+` -`;return typeof n=="function"&&n(null,g),g}});var RU=m(zl=>{c();var $ne=RM(),jI=TU(),PU=xU(),zne=DU();function QI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!$ne())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=jI.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=jI.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}zl.create=jI.create;zl.toCanvas=QI.bind(null,PU.render);zl.toDataURL=QI.bind(null,PU.renderToDataURL);zl.toString=QI.bind(null,function(t,e,r){return zne.render(t,r)})});var KI=m(ys=>{"use strict";c();var oie=ys&&ys.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kU=ys&&ys.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oie(e,t,r)};Object.defineProperty(ys,"__esModule",{value:!0});kU(Ll(),ys);kU(L_(),ys)});c();var uie=_e(Em(),1),cie=_e(Zw(),1),lie=_e(tE(),1),fie=_e(ht(),1),hie=_e(ra(),1),die=_e(wn(),1),pie=_e(jn(),1),gie=_e(ed(),1),yie=_e(fv(),1),mie=_e(wc(),1),r5=_e(mi(),1),Mn=_e(tc(),1),n5=_e(Mu(),1),i5=_e(Do(),1);c();c();var HO=_e(pv(),1);c();c();var Td="elvenjs_state",UO="https://devnet-api.multiversx.com";var Fi="/dapp/init",Cd="devnet",qO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",VO=["wss://relay.walletconnect.com"],Yt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(Td);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(Td,JSON.stringify(r))},clear(){localStorage.removeItem(Td)}};var xd=async()=>{let t=HO.ExtensionProvider.getInstance();try{let e=await t.init(),r=Se.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var XU=_e(pv(),1),ZU=_e(Cl(),1),e5=_e(Ll(),1),t5=_e(cI(),1);c();var oM=_e(Cl(),1);c();c();var Te=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};c();var as=(s=>(s.ledger="ledger",s.mobile="mobile",s.webWallet="web-wallet",s.browserExtension="browser-extension",s.xAlias="x-alias",s))(as||{});var gu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};c();var iM=_e(ht(),1),sM=_e(ra(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var yu=()=>new Date().setHours(new Date().getHours()+24),hy=t=>Date.now()>t;var us=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&hy(r))&&e&&t.networkProvider){let i=new iM.Address(e),s=new sM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),Se.set("nonce",o.nonce.valueOf()),Se.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=qt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};c();function dy(t){return t[Math.floor(Math.random()*t.length)]}var aM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{us(t),Te.run("onLoggedIn")},onClientLogout:()=>gu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=dy(t.initOptions.walletConnectV2RelayAddresses),n=new oM.WalletConnectV2Provider(e,Yt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};c();var _M=_e(Gt(),1),vy=_e(ht(),1),IM=_e(uM(),1),SM=_e(dM(),1),TM=_e(EI(),1),CM=_e(EM(),1),xM=_e(AM(),1),NM=_e(bM(),1),OM=_e(Ec(),1);var Ay=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Cd,this.apiUrl=e||Yt[this.chainType]?.apiAddress,this.apiTimeout=n||Yt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let l=u?.error||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new vy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new _M.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new IM.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new vy.Address(r.sender),receiver:new vy.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:SM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:TM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:CM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new OM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new NM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return xM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var DM=async(t,e,r,n="/")=>{let i=await xd(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.run("onLogout"))}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Se.set("loginToken",e),a&&Se.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");Se.set("address",u),Se.set("loginMethod","browser-extension"),Se.set("expires",yu()),await us(t),Te.run("onLoggedIn");let l=r.getToken(u,e,a);return Se.set("accessToken",l),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u?.message}`),Te.run("onLogout")}};c();c();var BU=_e(RU(),1),LU=_e(Cl(),1);var Yne=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Jne=t=>{let e=`${qO}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},Xne=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Zne=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},WI={},eie=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",WI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:WI[t.topic].signal}),r},Ry={},tie=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=eie(t,e);return n.appendChild(s),Ry[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ry[t.topic].signal}),n},rie=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},nie=t=>{if(!t)return;document.getElementById(t)?.remove()},iie=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sie=async t=>t?await BU.default.toString(t,{type:"svg"}):void 0,FU=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await sie(e),o;if(s&&(o=Yne(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),iie()&&i.appendChild(Jne(e))),i&&r instanceof LU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),nie(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ry[f].abort()}},l=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(rie()),await r.login({approval:d,token:n})}catch(d){let g=qt(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values(Ry))d?.abort();for(let d of Object.values(WI))d?.abort()}};if(a&&a.length>0){let f=Xne();i.appendChild(f);let d=Zne();f.appendChild(d);for(let g of a){let w=tie(g,u,l);f.appendChild(w)}}}return i};var By=_e(Cl(),1);var MU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=dy(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof By.WalletConnectV2Provider){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",yu()),await us(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof By.WalletConnectV2Provider&&(await gu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new By.WalletConnectV2Provider(o,Yt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.run("onQrPending"),await a.init();let{uri:u,approval:l}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await FU(n,f,a,e),Te.run("onQrLoaded")),await a.login({approval:l,token:e}),a}}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`),Te.run("onLogout")}};c();var UU=_e(Ll(),1);var $I=async(t,e,r,n)=>{let i=new UU.WalletProvider(`${t}${Fi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod",Yt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),Se.set("expires",yu()),Se.set("loginToken",e),i}catch(a){let u=qt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.set("loginMethod",""),Te.run("onLogout")}};c();var gs=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var qU=_e(Ll(),1);var VU=_e(cI(),1),zI=async(t,e)=>{let r=gs("signature"),n=gs("address"),i=Se.get("address"),s=Se.get("loginToken");if(r&&Se.set("signature",r),n||i){n&&(Se.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new qU.WalletProvider(`${t}${Fi}`);if(r&&e&&n){let u=new VU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var HU=_e(ra(),1),GU=_e(ed(),1);var Ly=async(t,e)=>{Te.run("onTxSent",t),await new GU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new HU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};c();var Tu=_e(KI(),1),QU=_e(wn(),1);c();var jU=_e(ra(),1);var Fy=t=>{let e=t.getSender(),r=new jU.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var WU=async(t,e,r,n)=>{if(gs(Tu.WALLET_PROVIDER_CALLBACK_PARAM)===Tu.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=gs("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new Tu.WalletProvider(`${r}${Fi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let l=QU.Transaction.fromPlainObject(u);l.setNonce(n),Fy(l);try{Te.run("onTxStarted",l),await e.sendTransaction(l),await Ly(l,e)}catch(f){let d=qt(f);throw Te.run("onTxError",l,d),new Error(`Error: Transaction signing failed! ${d}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};c();var My=_e(cc(),1),$U=_e(ht(),1),zU=_e(KI(),1);var KU=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(My.TransactionVersion.withTxOptions()),t.setOptions(My.TransactionOptions.withOptions(r)),t.setGuardian($U.Address.fromBech32(e))}return t},YU=async(t,e)=>{let r=new zU.WalletProvider(`${e}${Fi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},JU=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};var YI=class{static async init(e){let r=Se.get();if(r.expires&&hy(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Cd,apiUrl:UO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:VO,...e},this.networkProvider=new Ay(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&gs("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await xd()),r.loginMethod==="mobile"&&(this.dappProvider=await aM(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await us(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&await WU(this.dappProvider,this.networkProvider,Yt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce))}static async login(e,r){if(!Object.values(as).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new t5.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await DM(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await MU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=qt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await gu(this);return this.dappProvider=void 0,e}catch(e){let r=qt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");let r=KU(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof XU.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof ZU.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof e5.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=JU(r);if(i||Fy(r),i&&this.initOptions?.chainType){await YU(r,Yt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Ly(r,this.networkProvider)}}catch(n){let i=qt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return await this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(o){let a=qt(o);throw new Error(`Error: Smart contract query failed! ${a}`)}}static{this.storage=Se}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,Te.clear()}}};var export_Account=hie.Account;var export_Address=fie.Address;var export_AddressType=i5.AddressType;var export_AddressValue=i5.AddressValue;var export_BigUIntType=Mn.BigUIntType;var export_BigUIntValue=Mn.BigUIntValue;var export_BooleanType=n5.BooleanType;var export_BooleanValue=n5.BooleanValue;var export_BytesType=r5.BytesType;var export_BytesValue=r5.BytesValue;var export_ContractFunction=mie.ContractFunction;var export_GasEstimator=lie.GasEstimator;var export_SmartContract=yie.SmartContract;var export_TokenTransfer=uie.TokenTransfer;var export_Transaction=die.Transaction;var export_TransactionPayload=pie.TransactionPayload;var export_TransactionWatcher=gie.TransactionWatcher;var export_TransferTransactionsFactory=cie.TransferTransactionsFactory;var export_U16Type=Mn.U16Type;var export_U16Value=Mn.U16Value;var export_U32Type=Mn.U32Type;var export_U32Value=Mn.U32Value;var export_U64Type=Mn.U64Type;var export_U64Value=Mn.U64Value;var export_U8Type=Mn.U8Type;var export_U8Value=Mn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,YI as ElvenJS,export_GasEstimator as GasEstimator,as as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; +`);let o=Cie(e,r,i),a=Ly.getSymbolSize(e),u=new yie(a);return bie(u,e),Iie(u),_ie(u,e),Y_(u,r,0),e>=7&&Sie(u,e),Tie(u,o),isNaN(n)&&(n=J_.getBestMask(u,Y_.bind(null,u,r))),J_.applyMask(n,u),Y_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}JU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=$_.M,i,s;return typeof r<"u"&&(n=$_.from(r.errorCorrectionLevel,$_.M),i=By.from(r.version),s=J_.from(r.maskPattern),r.toSJISFunc&&Ly.setToSJISFunction(r.toSJISFunc)),Nie(e,i,n,s)}});var Z_=E(Ao=>{l();function ZU(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Ao.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:ZU(e.color.dark||"#000000ff"),light:ZU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ao.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Ao.getImageWidth=function(e,r){let n=Ao.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Ao.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Ao.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=u&&h>=u&&f{l();var eS=Z_();function Oie(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function Die(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Fy.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=Die()),i=eS.getOptions(i);let o=eS.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return eS.qrToImageData(u.data,e,i),Oie(a,s,o),a.putImageData(u,0,0),s};Fy.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Fy.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var n5=E(r5=>{l();var Pie=Z_();function t5(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function tS(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Rie(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?tS("M",u+r,.5+c+r):tS("m",i,0),i=0,s=!1),u+1':"",c="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` +`;return typeof n=="function"&&n(null,g),g}});var s5=E(rf=>{l();var Bie=sU(),rS=XU(),i5=e5(),Lie=n5();function nS(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!Bie())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,c){try{let f=rS.create(r,n);u(t(f,e,n))}catch(f){c(f)}})}try{let u=rS.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}rf.create=rS.create;rf.toCanvas=nS.bind(null,i5.render);rf.toDataURL=nS.bind(null,i5.renderToDataURL);rf.toString=nS.bind(null,function(t,e,r){return Lie.render(t,r)})});var aS=E(Es=>{"use strict";l();var Wie=Es&&Es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g5=Es&&Es.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wie(e,t,r)};Object.defineProperty(Es,"__esModule",{value:!0});g5(jl(),Es);g5(zI(),Es)});l();var zie=be(_m(),1),$ie=be(sE(),1),Kie=be(aE(),1),Yie=be(ht(),1),Jie=be(oa(),1),Xie=be(bn(),1),Zie=be(zn(),1),ese=be(ud(),1),tse=be(mv(),1),rse=be(Sc(),1),nse=be(Bd(),1),T5=be(vi(),1),Hn=be(oc(),1),C5=be(Gu(),1),x5=be(Lo(),1);l();l();var n2=be(Av(),1);l();l();var Ld="elvenjs_state",e2="https://devnet-api.multiversx.com";var qi="/dapp/init",Fd="devnet",t2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",r2=["wss://relay.walletconnect.com"],Jt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(Ld);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(Ld,JSON.stringify(r))},clear(){localStorage.removeItem(Ld)}};var Md=async()=>{let t=n2.ExtensionProvider.getInstance();try{let e=await t.init(),r=Se.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var uS=be(Av(),1),cS=be(Fl(),1),lS=be(jl(),1),S5=be(A_(),1),Gy=be(Bd(),1);l();var PM=be(Fl(),1);l();l();var Te=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};l();var gy=(s=>(s.ledger="ledger",s.mobile="mobile",s.webWallet="web-wallet",s.browserExtension="browser-extension",s.xAlias="x-alias",s))(gy||{});var wu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};l();var OM=be(ht(),1),DM=be(oa(),1);l();var Bt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;l();var Eu=()=>new Date().setHours(new Date().getHours()+24),yy=t=>Date.now()>t;var hs=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&yy(r))&&e&&t.networkProvider){let i=new OM.Address(e),s=new DM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),Se.set("nonce",o.nonce.valueOf()),Se.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};l();function my(t){return t[Math.floor(Math.random()*t.length)]}var RM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{hs(t),Te.run("onLoggedIn")},onClientLogout:()=>wu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=my(t.initOptions.walletConnectV2RelayAddresses),n=new PM.WalletConnectV2Provider(e,Jt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};l();var KM=be(kt(),1),_y=be(ht(),1),YM=be(BM(),1),JM=be(qM(),1),XM=be(D_(),1),ZM=be(QM(),1),eU=be(zM(),1),tU=be($M(),1),rU=be(Tc(),1);var Sy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Fd,this.apiUrl=e||Jt[this.chainType]?.apiAddress,this.apiTimeout=n||Jt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let c=u?.error||a.status;return clearTimeout(s),Promise.reject(c)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new _y.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new KM.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new YM.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new _y.Address(r.sender),receiver:new _y.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:d.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:JM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:XM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:ZM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new rU.Query({address:e,func:r,args:n,value:i,caller:s}),a=new tU.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return eU.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};l();var nU=async(t,e,r,n="/")=>{let i=await Md(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.run("onLogout"))}catch(u){let c=Bt(u);console.warn(`Something went wrong trying to login the user: ${c}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Se.set("loginToken",e),a&&Se.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");Se.set("address",u),Se.set("loginMethod","browser-extension"),Se.set("expires",Eu()),await hs(t),Te.run("onLoggedIn");let c=r.getToken(u,e,a);return Se.set("accessToken",c),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u?.message}`),Te.run("onLogout")}};l();l();var o5=be(s5(),1),a5=be(Fl(),1);var Fie=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Mie=t=>{let e=`${t2}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},Uie=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},qie=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},iS={},Vie=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",iS[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:iS[t.topic].signal}),r},My={},Hie=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=Vie(t,e);return n.appendChild(s),My[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:My[t.topic].signal}),n},Gie=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},kie=t=>{if(!t)return;document.getElementById(t)?.remove()},jie=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Qie=async t=>t?await o5.default.toString(t,{type:"svg"}):void 0,u5=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await Qie(e),o;if(s&&(o=Fie(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),jie()&&i.appendChild(Mie(e))),i&&r instanceof a5.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),kie(f))}catch(h){let g=Bt(h);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{My[f].abort()}},c=async f=>{try{let{approval:h}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(Gie()),await r.login({approval:h,token:n})}catch(h){let g=Bt(h);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let h of Object.values(My))h?.abort();for(let h of Object.values(iS))h?.abort()}};if(a&&a.length>0){let f=Uie();i.appendChild(f);let h=qie();f.appendChild(h);for(let g of a){let y=Hie(g,u,c);f.appendChild(y)}}}return i};var Uy=be(Fl(),1);var c5=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=my(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Uy.WalletConnectV2Provider){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",Eu()),await hs(t),c&&Se.set("signature",c),Se.set("loginToken",e);let f=r.getToken(u,e,c);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Uy.WalletConnectV2Provider&&(await wu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Uy.WalletConnectV2Provider(o,Jt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.run("onQrPending"),await a.init();let{uri:u,approval:c}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await u5(n,f,a,e),Te.run("onQrLoaded")),await a.login({approval:c,token:e}),a}}catch(u){let c=Bt(u);console.warn(`Something went wrong trying to login the user: ${c}`),Te.run("onLogout")}};l();var l5=be(jl(),1);var sS=async(t,e,r,n)=>{let i=new l5.WalletProvider(`${t}${qi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod",Jt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),Se.set("expires",Eu()),Se.set("loginToken",e),i}catch(a){let u=Bt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.set("loginMethod",""),Te.run("onLogout")}};l();var Sr=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};l();var f5=be(jl(),1);var h5=be(A_(),1),oS=async(t,e)=>{let r=Sr("signature"),n=Sr("address"),i=Se.get("address"),s=Se.get("loginToken");if(r&&Se.set("signature",r),n||i){n&&(Se.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new f5.WalletProvider(`${t}${qi}`);if(r&&e&&n){let u=new h5.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};l();var d5=be(oa(),1),p5=be(ud(),1);var qy=async(t,e)=>{Te.run("onTxSent",t),await new p5.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new d5.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};l();var Ou=be(aS(),1),m5=be(bn(),1);l();var y5=be(oa(),1);var Vy=t=>{let e=t.getSender(),r=new y5.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var w5=async(t,e,r,n)=>{if(Sr(Ou.WALLET_PROVIDER_CALLBACK_PARAM)===Ou.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=Sr("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=d.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new Ou.WalletProvider(`${r}${qi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let c=m5.Transaction.fromPlainObject(u);c.setNonce(n),Vy(c);try{Te.run("onTxStarted",c),await e.sendTransaction(c),await qy(c,e)}catch(f){let h=Bt(f);throw Te.run("onTxError",c,h),new Error(`Error: Transaction signing failed! ${h}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};l();var Hy=be(gc(),1),E5=be(ht(),1),v5=be(aS(),1);var A5=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Hy.TransactionVersion.withTxOptions()),t.setOptions(Hy.TransactionOptions.withOptions(r)),t.setGuardian(E5.Address.fromBech32(e))}return t},b5=async(t,e)=>{let r=new v5.WalletProvider(`${e}${qi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},I5=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};l();var _5=()=>{let t=!Sr("walletProviderStatus"),e=Sr("status")==="signed",r=Sr("message"),n=Sr("signature");t&&e&&r&&n&&(Te.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};var fS=class{static async init(e){let r=Se.get();if(r.expires&&yy(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Fd,apiUrl:e2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:r2,...e},this.networkProvider=new Sy(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),this.initOptions.onSignMsgStarted&&Te.set("onSignMsgStarted",this.initOptions.onSignMsgStarted),this.initOptions.onSignMsgFinalized&&Te.set("onSignMsgFinalized",this.initOptions.onSignMsgFinalized),this.initOptions.onSignMsgError&&Te.set("onSignMsgError",this.initOptions.onSignMsgError),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Sr("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await Md()),r.loginMethod==="mobile"&&(this.dappProvider=await RM(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await oS(Jt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions.chainType&&(this.dappProvider=await oS(Jt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await hs(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&(await w5(this.dappProvider,this.networkProvider,Jt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),_5()))}static async login(e,r){if(!Object.values(gy).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new S5.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await nU(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await c5(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await sS(Jt[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await sS(Jt[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=Bt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await wu(this);return this.dappProvider=void 0,e}catch(e){let r=Bt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");let r=A5(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof uS.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof cS.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof lS.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=I5(r);if(i||Vy(r),i&&this.initOptions?.chainType){await b5(r,Jt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await qy(r,this.networkProvider)}}catch(n){let i=Bt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider)throw new Error("Error: Message signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Message signing failed: There is no active network provider!");let n="";try{if(Te.run("onSignMsgStarted",e),this.dappProvider instanceof uS.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new Gy.SignableMessage({message:d.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof cS.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new Gy.SignableMessage({message:d.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof lS.WalletProvider){let i=o=>encodeURIComponent(o).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),s=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new Gy.SignableMessage({message:d.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${s}${s.includes("?")?"&":"?"}message=${i(e)}`)})}return Te.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Bt(i);throw Te.run("onSignMsgError",e,s),new Error(`Error: Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return await this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(o){let a=Bt(o);throw new Error(`Error: Smart contract query failed! ${a}`)}}static{this.storage=Se}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,Te.clear()}}};var export_Account=Jie.Account;var export_Address=Yie.Address;var export_AddressType=x5.AddressType;var export_AddressValue=x5.AddressValue;var export_BigUIntType=Hn.BigUIntType;var export_BigUIntValue=Hn.BigUIntValue;var export_BooleanType=C5.BooleanType;var export_BooleanValue=C5.BooleanValue;var export_BytesType=T5.BytesType;var export_BytesValue=T5.BytesValue;var export_ContractFunction=rse.ContractFunction;var export_GasEstimator=Kie.GasEstimator;var export_SignableMessage=nse.SignableMessage;var export_SmartContract=tse.SmartContract;var export_TokenTransfer=zie.TokenTransfer;var export_Transaction=Xie.Transaction;var export_TransactionPayload=Zie.TransactionPayload;var export_TransactionWatcher=ese.TransactionWatcher;var export_TransferTransactionsFactory=$ie.TransferTransactionsFactory;var export_U16Type=Hn.U16Type;var export_U16Value=Hn.U16Value;var export_U32Type=Hn.U32Type;var export_U32Value=Hn.U32Value;var export_U64Type=Hn.U64Type;var export_U64Value=Hn.U64Value;var export_U8Type=Hn.U8Type;var export_U8Value=Hn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,fS as ElvenJS,export_GasEstimator as GasEstimator,gy as LoginMethodsEnum,export_SignableMessage as SignableMessage,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; /*! Bundled license information: ieee754/index.js: diff --git a/build/types/elven.d.ts b/build/types/elven.d.ts index 7eca468..55a3b74 100644 --- a/build/types/elven.d.ts +++ b/build/types/elven.d.ts @@ -8,6 +8,7 @@ export { TransactionPayload } from '@multiversx/sdk-core/out/transactionPayload' export { TransactionWatcher } from '@multiversx/sdk-core/out/transactionWatcher'; export { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract'; export { ContractFunction } from '@multiversx/sdk-core/out/smartcontracts/function'; +export { SignableMessage } from '@multiversx/sdk-core/out/signableMessage'; export { BytesType, BytesValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/bytes'; export { U16Type, U16Value, U32Type, U32Value, U64Type, U64Value, U8Type, U8Value, BigUIntType, BigUIntValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/numerical'; export { BooleanType, BooleanValue, } from '@multiversx/sdk-core/out/smartcontracts/typesystem/boolean'; diff --git a/build/types/interaction/web-wallet-sign-message-finalize.d.ts b/build/types/interaction/web-wallet-sign-message-finalize.d.ts new file mode 100644 index 0000000..79635b0 --- /dev/null +++ b/build/types/interaction/web-wallet-sign-message-finalize.d.ts @@ -0,0 +1 @@ +export declare const webWalletSignMessageFinalize: () => void; diff --git a/build/types/main.d.ts b/build/types/main.d.ts index 0eee337..4187e95 100644 --- a/build/types/main.d.ts +++ b/build/types/main.d.ts @@ -21,6 +21,15 @@ export declare class ElvenJS { * Sign and send function */ static signAndSendTransaction(transaction: Transaction): Promise; + /** + * Sign a single message + */ + static signMessage(message: string, options?: { + callbackUrl?: string; + }): Promise<{ + message: string; + messageSignature: string; + }>; /** * Query Smart Contracts */ diff --git a/build/types/types.d.ts b/build/types/types.d.ts index 2d61b52..0419804 100644 --- a/build/types/types.d.ts +++ b/build/types/types.d.ts @@ -17,6 +17,9 @@ export interface InitOptions { onTxSent?: (transaction: Transaction) => void; onTxFinalized?: (transaction: Transaction) => void; onTxError?: (transaction: Transaction, error: string) => void; + onSignMsgStarted?: (message: string) => void; + onSignMsgFinalized?: (messageSignature: string) => void; + onSignMsgError?: (message: string, error: string) => void; } export declare enum LoginMethodsEnum { ledger = "ledger", @@ -43,7 +46,10 @@ export declare enum EventStoreEvents { onTxStarted = "onTxStarted", onTxSent = "onTxSent", onTxFinalized = "onTxFinalized", - onTxError = "onTxError" + onTxError = "onTxError", + onSignMsgStarted = "onSignMsgStarted", + onSignMsgFinalized = "onSignMsgFinalized", + onSignMsgError = "onSignMsgError" } export declare enum WebWalletUrlParamsEnum { hasWebWalletGuardianSign = "hasWebWalletGuardianSign" diff --git a/example/demo-styles.css b/example/demo-styles.css index 03fac40..e999e42 100644 --- a/example/demo-styles.css +++ b/example/demo-styles.css @@ -24,6 +24,7 @@ body * { border-radius: 8px; font-weight: bold; text-decoration: none; + white-space: nowrap; } .button.right { @@ -36,6 +37,7 @@ body * { border-bottom: 1px dashed #000; padding-bottom: 20px; margin-bottom: 20px; + flex-wrap: wrap; } a { @@ -46,10 +48,11 @@ a { display: inline-block; } -.tx-hash-or-query-result { +.operation-result { font-size: 16px; font-weight: bold; word-break: break-all; + margin-bottom: 30px; } @media screen and (max-width: 680px) { @@ -66,16 +69,16 @@ a { } } -.esdt-info { +.operation-info { margin-top: 10px; } -.esdt-info:nth-child(3) { +.operation-info.mb { margin-bottom: 30px; } -.esdt-info, -.esdt-info a { +.operation-info, +.operation-info a { font-size: 13px; } diff --git a/example/demo-ui-tools.js b/example/demo-ui-tools.js index 7c350db..7f8aec3 100644 --- a/example/demo-ui-tools.js +++ b/example/demo-ui-tools.js @@ -23,6 +23,8 @@ export const uiLoggedInState = (loggedIn) => { const txEsdtButton = document.getElementById('button-tx-esdt'); const mintButton = document.getElementById('button-mint'); const queryButton = document.getElementById('button-query'); + const signMessageButton = document.getElementById('button-sign-message'); + if (loggedIn) { loginExtensionButton.style.display = 'none'; loginButton.style.display = 'none'; @@ -33,6 +35,7 @@ export const uiLoggedInState = (loggedIn) => { txEsdtButton.style.display = 'block'; mintButton.style.display = 'block'; queryButton.style.display = 'block'; + signMessageButton.style.display = 'block'; } else { loginExtensionButton.style.display = 'block'; loginButton.style.display = 'block'; @@ -43,13 +46,14 @@ export const uiLoggedInState = (loggedIn) => { txEsdtButton.style.display = 'none'; mintButton.style.display = 'none'; queryButton.style.display = 'none'; + signMessageButton.style.display = 'none'; } uiPending(false); }; export const updateTxHashContainer = (txHash) => { if (txHash) { - const txHashContainer = document.getElementById('tx-hash-or-query-result'); + const txHashContainer = document.getElementById('operation-result'); const url = `https://devnet-explorer.multiversx.com/transactions/${txHash}`; const link = document.createElement('a'); link.setAttribute('href', url); @@ -59,8 +63,8 @@ export const updateTxHashContainer = (txHash) => { } }; -export const updateQueryResultContainer = (result) => { - const queryContainer = document.getElementById('tx-hash-or-query-result'); +export const updateOperationResultContainer = (result) => { + const queryContainer = document.getElementById('operation-result'); if (result) { queryContainer?.replaceChildren(); const divElem = document.createElement('div'); diff --git a/example/elven.js b/example/elven.js index 5f9eced..7fcf0ab 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,9 +1,10 @@ -var s5=Object.create;var Yl=Object.defineProperty;var o5=Object.getOwnPropertyDescriptor;var a5=Object.getOwnPropertyNames;var u5=Object.getPrototypeOf,c5=Object.prototype.hasOwnProperty;var JI=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var ge=(t,e)=>()=>(t&&(e=t(t=0)),e);var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var r in e)Yl(t,r,{get:e[r],enumerable:!0})},Kl=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a5(e))!c5.call(t,i)&&i!==r&&Yl(t,i,{get:()=>e[i],enumerable:!(n=o5(e,i))||n.enumerable});return t},Ht=(t,e,r)=>(Kl(t,e,"default"),r&&Kl(r,e,"default")),_e=(t,e,r)=>(r=t!=null?s5(u5(t)):{},Kl(e||!t||!t.__esModule?Yl(r,"default",{value:t,enumerable:!0}):r,t)),ct=t=>Kl(Yl({},"__esModule",{value:!0}),t);var C0=m(Jl=>{"use strict";c();Jl.byteLength=f5;Jl.toByteArray=d5;Jl.fromByteArray=y5;var Xr=[],Sr=[],l5=typeof Uint8Array<"u"?Uint8Array:Array,T0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Es=0,XI=T0.length;Es0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function f5(t){var e=ZI(t),r=e[0],n=e[1];return(r+n)*3/4-n}function h5(t,e,r){return(e+r)*3/4-r}function d5(t){var e,r=ZI(t),n=r[0],i=r[1],s=new l5(h5(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Sr[t.charCodeAt(u)]<<2|Sr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Sr[t.charCodeAt(u)]<<10|Sr[t.charCodeAt(u+1)]<<4|Sr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function p5(t){return Xr[t>>18&63]+Xr[t>>12&63]+Xr[t>>6&63]+Xr[t&63]}function g5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(Xr[e>>2]+Xr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Xr[e>>10]+Xr[e>>4&63]+Xr[e<<2&63]+"=")),i.join("")}});var N0=m(x0=>{c();x0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,d=r?i-1:0,g=r?-1:1,w=t[e+d];for(d+=g,s=w&(1<<-f)-1,w>>=-f,f+=a;f>0;s=s*256+t[e+d],d+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+d],d+=g,f-=8);if(s===0)s=1-l;else{if(s===u)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};x0.write=function(t,e,r,n,i,s){var o,a,u,l=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,E=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=g/u:e+=g*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=f?(a=0,o=f):o+d>=1?(a=(e*u-1)*Math.pow(2,i),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;t[r+w]=a&255,w+=E,a/=256,i-=8);for(o=o<0;t[r+w]=o&255,w+=E,o/=256,l-=8);t[r+w-E]|=T*128}});var hS=m(vo=>{"use strict";c();var O0=C0(),Eo=N0(),eS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;vo.Buffer=z;vo.SlowBuffer=b5;vo.INSPECT_MAX_BYTES=50;var Xl=2147483647;vo.kMaxLength=Xl;z.TYPED_ARRAY_SUPPORT=m5();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function m5(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function qn(t){if(t>Xl)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B0(t)}return nS(t,e,r)}z.poolSize=8192;function nS(t,e,r){if(typeof t=="string")return E5(t,e);if(ArrayBuffer.isView(t))return v5(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Zr(t,ArrayBuffer)||t&&Zr(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Zr(t,SharedArrayBuffer)||t&&Zr(t.buffer,SharedArrayBuffer)))return P0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);var i=A5(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return nS(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function iS(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function w5(t,e,r){return iS(t),t<=0?qn(t):e!==void 0?typeof r=="string"?qn(t).fill(e,r):qn(t).fill(e):qn(t)}z.alloc=function(t,e,r){return w5(t,e,r)};function B0(t){return iS(t),qn(t<0?0:L0(t)|0)}z.allocUnsafe=function(t){return B0(t)};z.allocUnsafeSlow=function(t){return B0(t)};function E5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=sS(t,e)|0,n=qn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function D0(t){for(var e=t.length<0?0:L0(t.length)|0,r=qn(e),n=0;n=Xl)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xl.toString(16)+" bytes");return t|0}function b5(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(Zr(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),Zr(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?z.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function sS(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Zr(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return R0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return fS(t).length;default:if(i)return n?-1:R0(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=sS;function _5(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return R5(this,e,r);case"utf8":case"utf-8":return aS(this,e,r);case"ascii":return D5(this,e,r);case"latin1":case"binary":return P5(this,e,r);case"base64":return N5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B5(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function vs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};eS&&(z.prototype[eS]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(Zr(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n),d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,F0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:tS(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):tS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function tS(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(w,E){return s===1?w[E]:w.readUInt16BE(E*s)}var l;if(i){var f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){for(var d=!0,g=0;gi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return I5(this,e,r,n);case"utf8":case"utf-8":return S5(this,e,r,n);case"ascii":case"latin1":case"binary":return T5(this,e,r,n);case"base64":return C5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function N5(t,e,r){return e===0&&r===t.length?O0.fromByteArray(t):O0.fromByteArray(t.slice(e,r))}function aS(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return O5(n)}var rS=4096;function O5(t){var e=t.length;if(e<=rS)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Rt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Rt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Rt(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Rt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Rt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Rt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Rt(e,4,this.length),Eo.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Rt(e,8,this.length),Eo.read(this,e,!1,52,8)};function or(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;or(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;or(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);or(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||or(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function uS(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function cS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,4,34028234663852886e22,-34028234663852886e22),Eo.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return cS(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return cS(this,e,r,!1,n)};function lS(t,e,r,n,i){return e=+e,r=r>>>0,i||uS(t,e,r,8,17976931348623157e292,-17976931348623157e292),Eo.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return lS(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return lS(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function M5(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function fS(t){return O0.toByteArray(F5(t))}function Zl(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Zr(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function F0(t){return t!==t}var q5=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var mS=m((Sie,yS)=>{c();var mt=yS.exports={},en,tn;function M0(){throw new Error("setTimeout has not been defined")}function U0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?en=setTimeout:en=M0}catch{en=M0}try{typeof clearTimeout=="function"?tn=clearTimeout:tn=U0}catch{tn=U0}})();function dS(t){if(en===setTimeout)return setTimeout(t,0);if((en===M0||!en)&&setTimeout)return en=setTimeout,setTimeout(t,0);try{return en(t,0)}catch{try{return en.call(null,t,0)}catch{return en.call(this,t,0)}}}function V5(t){if(tn===clearTimeout)return clearTimeout(t);if((tn===U0||!tn)&&clearTimeout)return tn=clearTimeout,clearTimeout(t);try{return tn(t)}catch{try{return tn.call(null,t)}catch{return tn.call(this,t)}}}var Vn=[],Ao=!1,As,ef=-1;function H5(){!Ao||!As||(Ao=!1,As.length?Vn=As.concat(Vn):ef=-1,Vn.length&&pS())}function pS(){if(!Ao){var t=dS(H5);Ao=!0;for(var e=Vn.length;e;){for(As=Vn,Vn=[];++ef1)for(var r=1;r{h=_e(hS()),p=_e(mS()),G5=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=G5});var Gt=m((wS,tf)=>{c();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,l=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,g=1e9;function w(I){var N,_,S,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),Q=20,V=4,k=-7,K=21,pe=-1e7,ue=1e7,re=!1,Y=1,se=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ie="0123456789abcdefghijklmnopqrstuvwxyz";function M(y,v){var b,P,C,O,L,x,F,H,q=this;if(!(q instanceof M))return new M(y,v);if(v==null){if(y&&y._isBigNumber===!0){q.s=y.s,!y.c||y.e>ue?q.c=q.e=null:y.e=10;L/=10,O++);O>ue?q.c=q.e=null:(q.e=O,q.c=[y]);return}H=String(y)}else{if(!r.test(H=String(y)))return S(q,H,x);q.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(O=H.indexOf("."))>-1&&(H=H.replace(".","")),(L=H.search(/e/i))>0?(O<0&&(O=L),O+=+H.slice(L+1),H=H.substring(0,L)):O<0&&(O=H.length)}else{if(B(v,2,ie.length,"Base"),v==10)return q=new M(y),oe(q,Q+q.e+1,V);if(H=String(y),x=typeof y=="number"){if(y*0!=0)return S(q,H,x,v);if(q.s=1/y<0?(H=H.slice(1),-1):1,M.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+y)}else q.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(b=ie.slice(0,v),O=L=0,F=H.length;LO){O=F;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,L=-1,O=0;continue}return S(q,String(y),x,v)}x=!1,H=_(H,v,10,q.s),(O=H.indexOf("."))>-1?H=H.replace(".",""):O=H.length}for(L=0;H.charCodeAt(L)===48;L++);for(F=H.length;H.charCodeAt(--F)===48;);if(H=H.slice(L,++F)){if(F-=L,x&&M.DEBUG&&F>15&&(y>l||y!==i(y)))throw Error(o+q.s*y);if((O=O-L-1)>ue)q.c=q.e=null;else if(O=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||b!==i(b))break e;if(b!==0)return!0}}}else if(P===null&&C===null&&(O===null||O===1||O===-1))return!0;throw Error(s+"Invalid BigNumber: "+y)},M.maximum=M.max=function(){return ae(arguments,R.lt)},M.minimum=M.min=function(){return ae(arguments,R.gt)},M.random=function(){var y=9007199254740992,v=Math.random()*y&2097151?function(){return i(Math.random()*y)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var P,C,O,L,x,F=0,H=[],q=new M(J);if(b==null?b=Q:B(b,0,g),L=n(b/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(H.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(H.push(x%1e14),F+=7);F=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(b,P,C,O,L){var x,F,H,q,Z,we,Ae,Re,tt=b.indexOf("."),lt=Q,Oe=V;for(tt>=0&&(q=se,se=0,b=b.replace(".",""),Re=new M(P),we=Re.pow(b.length-tt),se=q,Re.c=v(A(T(we.c),we.e,"0"),10,C,y),Re.e=Re.c.length),Ae=v(b,P,C,L?(x=ie,y):(x=y,ie)),H=q=Ae.length;Ae[--q]==0;Ae.pop());if(!Ae[0])return x.charAt(0);if(tt<0?--H:(we.c=Ae,we.e=H,we.s=O,we=N(we,Re,lt,Oe,C),Ae=we.c,Z=we.r,H=we.e),F=H+lt+1,tt=Ae[F],q=C/2,Z=Z||F<0||Ae[F+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>q||tt==q&&(Oe==4||Z||Oe==6&&Ae[F-1]&1||Oe==(we.s<0?8:7)),F<1||!Ae[0])b=Z?A(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(Ae.length=F,Z)for(--C;++Ae[--F]>C;)Ae[F]=0,F||(++H,Ae=[1].concat(Ae));for(q=Ae.length;!Ae[--q];);for(tt=0,b="";tt<=q;b+=x.charAt(Ae[tt++]));b=A(b,H,x.charAt(0))}return b}}(),N=function(){function y(P,C,O){var L,x,F,H,q=0,Z=P.length,we=C%d,Ae=C/d|0;for(P=P.slice();Z--;)F=P[Z]%d,H=P[Z]/d|0,L=Ae*F+H*we,x=we*F+L%d*d+q,q=(x/O|0)+(L/d|0)+Ae*H,P[Z]=x%O;return q&&(P=[q].concat(P)),P}function v(P,C,O,L){var x,F;if(O!=L)F=O>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function b(P,C,O,L){for(var x=0;O--;)P[O]-=x,x=P[O]1;P.splice(0,1));}return function(P,C,O,L,x){var F,H,q,Z,we,Ae,Re,tt,lt,Oe,Ue,Ot,hi,ms,ws,sr,Un,$t=P.s==C.s?1:-1,Dt=P.c,$e=C.c;if(!Dt||!Dt[0]||!$e||!$e[0])return new M(!P.s||!C.s||(Dt?$e&&Dt[0]==$e[0]:!$e)?NaN:Dt&&Dt[0]==0||!$e?$t*0:$t/0);for(tt=new M($t),lt=tt.c=[],H=P.e-C.e,$t=O+H+1,x||(x=a,H=E(P.e/u)-E(C.e/u),$t=$t/u|0),q=0;$e[q]==(Dt[q]||0);q++);if($e[q]>(Dt[q]||0)&&H--,$t<0)lt.push(1),Z=!0;else{for(ms=Dt.length,sr=$e.length,q=0,$t+=2,we=i(x/($e[0]+1)),we>1&&($e=y($e,we,x),Dt=y(Dt,we,x),sr=$e.length,ms=Dt.length),hi=sr,Oe=Dt.slice(0,sr),Ue=Oe.length;Ue=x/2&&ws++;do{if(we=0,F=v($e,Oe,sr,Ue),F<0){if(Ot=Oe[0],sr!=Ue&&(Ot=Ot*x+(Oe[1]||0)),we=i(Ot/ws),we>1)for(we>=x&&(we=x-1),Ae=y($e,we,x),Re=Ae.length,Ue=Oe.length;v(Ae,Oe,Re,Ue)==1;)we--,b(Ae,sr=10;$t/=10,q++);oe(tt,O+(tt.e=q+H*u-1)+1,L,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(y,v,b,P){var C,O,L,x,F;if(b==null?b=V:B(b,0,8),!y.c)return y.toString();if(C=y.c[0],L=y.e,v==null)F=T(y.c),F=P==1||P==2&&(L<=k||L>=K)?U(F,L):A(F,L,"0");else if(y=oe(new M(y),v,b),O=y.e,F=T(y.c),x=F.length,P==1||P==2&&(v<=O||O<=k)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=O-x,v>0)for(O+1==x&&(F+=".");v--;F+="0");return y.s<0&&C?"-"+F:F}function ae(y,v){for(var b,P=1,C=new M(y[0]);P=10;C/=10,P++);return(b=P+b*u-1)>ue?y.c=y.e=null:b=10;x/=10,C++);if(O=v-C,O<0)O+=u,L=v,F=Z[H=0],q=F/we[C-L-1]%10|0;else if(H=n((O+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));F=q=0,C=1,O%=u,L=O-u+1}else break e;else{for(F=x=Z[H],C=1;x>=10;x/=10,C++);O%=u,L=O-u+C,q=L<0?0:F/we[C-L-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(L<0?F:F%we[C-L-1]),P=b<4?(q||P)&&(b==0||b==(y.s<0?3:2)):q>5||q==5&&(b==4||P||b==6&&(O>0?L>0?F/we[C-L]:0:Z[H-1])%10&1||b==(y.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=y.e+1,Z[0]=we[(u-v%u)%u],y.e=-v||0):Z[0]=y.e=0,y;if(O==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=we[u-O],Z[H]=L>0?i(F/we[C-L]%we[L])*x:0),P)for(;;)if(H==0){for(O=1,L=Z[0];L>=10;L/=10,O++);for(L=Z[0]+=x,x=1;L>=10;L/=10,x++);O!=x&&(y.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=x,Z[H]!=a)break;Z[H--]=0,x=1}for(O=Z.length;Z[--O]===0;Z.pop());}y.e>ue?y.c=y.e=null:y.e=K?U(v,b):A(v,b,"0"),y.s<0?"-"+v:v)}return R.absoluteValue=R.abs=function(){var y=new M(this);return y.s<0&&(y.s=1),y},R.comparedTo=function(y,v){return D(this,new M(y,v))},R.decimalPlaces=R.dp=function(y,v){var b,P,C,O=this;if(y!=null)return B(y,0,g),v==null?v=V:B(v,0,8),oe(new M(O),y+O.e+1,v);if(!(b=O.c))return null;if(P=((C=b.length-1)-E(this.e/u))*u,C=b[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},R.dividedBy=R.div=function(y,v){return N(this,new M(y,v),Q,V)},R.dividedToIntegerBy=R.idiv=function(y,v){return N(this,new M(y,v),0,1)},R.exponentiatedBy=R.pow=function(y,v){var b,P,C,O,L,x,F,H,q,Z=this;if(y=new M(y),y.c&&!y.isInteger())throw Error(s+"Exponent not an integer: "+ce(y));if(v!=null&&(v=new M(v)),x=y.e>14,!Z.c||!Z.c[0]||Z.c[0]==1&&!Z.e&&Z.c.length==1||!y.c||!y.c[0])return q=new M(Math.pow(+ce(Z),x?2-W(y):+ce(y))),v?q.mod(v):q;if(F=y.s<0,v){if(v.c?!v.c[0]:!v.s)return new M(NaN);P=!F&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}else{if(y.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||x&&Z.c[1]>=24e7:Z.c[0]<8e13||x&&Z.c[0]<=9999975e7)))return O=Z.s<0&&W(y)?-0:0,Z.e>-1&&(O=1/O),new M(F?1/O:O);se&&(O=n(se/u+2))}for(x?(b=new M(.5),F&&(y.s=1),H=W(y)):(C=Math.abs(+ce(y)),H=C%2),q=new M(J);;){if(H){if(q=q.times(Z),!q.c)break;O?q.c.length>O&&(q.c.length=O):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(y=y.times(b),oe(y,y.e+1,1),y.e>14)H=W(y);else{if(C=+ce(y),C===0)break;H=C%2}Z=Z.times(Z),O?Z.c&&Z.c.length>O&&(Z.c.length=O):P&&(Z=Z.mod(v))}return P?q:(F&&(q=J.div(q)),v?q.mod(v):O?oe(q,se,V,L):q)},R.integerValue=function(y){var v=new M(this);return y==null?y=V:B(y,0,8),oe(v,v.e+1,y)},R.isEqualTo=R.eq=function(y,v){return D(this,new M(y,v))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(y,v){return D(this,new M(y,v))>0},R.isGreaterThanOrEqualTo=R.gte=function(y,v){return(v=D(this,new M(y,v)))===1||v===0},R.isInteger=function(){return!!this.c&&E(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(y,v){return D(this,new M(y,v))<0},R.isLessThanOrEqualTo=R.lte=function(y,v){return(v=D(this,new M(y,v)))===-1||v===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(y,v){var b,P,C,O,L=this,x=L.s;if(y=new M(y,v),v=y.s,!x||!v)return new M(NaN);if(x!=v)return y.s=-v,L.plus(y);var F=L.e/u,H=y.e/u,q=L.c,Z=y.c;if(!F||!H){if(!q||!Z)return q?(y.s=-v,y):new M(Z?L:NaN);if(!q[0]||!Z[0])return Z[0]?(y.s=-v,y):new M(q[0]?L:V==3?-0:0)}if(F=E(F),H=E(H),q=q.slice(),x=F-H){for((O=x<0)?(x=-x,C=q):(H=F,C=Z),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(O=(x=q.length)<(v=Z.length))?x:v,x=v=0;v0)for(;v--;q[b++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(b=0,we=Ot[C]%lt,Ae=Ot[C]/lt|0,L=F,O=C+L;O>C;)H=Ue[--L]%lt,q=Ue[L]/lt|0,x=Ae*H+q*we,H=we*H+x%lt*lt+Re[O]+b,b=(H/tt|0)+(x/lt|0)+Ae*q,Re[O--]=H%tt;Re[O]=b}return b?++P:Re.splice(0,1),fe(y,Re,P)},R.negated=function(){var y=new M(this);return y.s=-y.s||null,y},R.plus=function(y,v){var b,P=this,C=P.s;if(y=new M(y,v),v=y.s,!C||!v)return new M(NaN);if(C!=v)return y.s=-v,P.minus(y);var O=P.e/u,L=y.e/u,x=P.c,F=y.c;if(!O||!L){if(!x||!F)return new M(C/0);if(!x[0]||!F[0])return F[0]?y:new M(x[0]?P:C*0)}if(O=E(O),L=E(L),x=x.slice(),C=O-L){for(C>0?(L=O,b=F):(C=-C,b=x),b.reverse();C--;b.push(0));b.reverse()}for(C=x.length,v=F.length,C-v<0&&(b=F,F=x,x=b,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),fe(y,x,L)},R.precision=R.sd=function(y,v){var b,P,C,O=this;if(y!=null&&y!==!!y)return B(y,1,g),v==null?v=V:B(v,0,8),oe(new M(O),y,v);if(!(b=O.c))return null;if(C=b.length-1,P=C*u+1,C=b[C]){for(;C%10==0;C/=10,P--);for(C=b[0];C>=10;C/=10,P++);}return y&&O.e+1>P&&(P=O.e+1),P},R.shiftedBy=function(y){return B(y,-l,l),this.times("1e"+y)},R.squareRoot=R.sqrt=function(){var y,v,b,P,C,O=this,L=O.c,x=O.s,F=O.e,H=Q+4,q=new M("0.5");if(x!==1||!L||!L[0])return new M(!x||x<0&&(!L||L[0])?NaN:L?O:1/0);if(x=Math.sqrt(+ce(O)),x==0||x==1/0?(v=T(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=E((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),b=new M(v)):b=new M(x+""),b.c[0]){for(F=b.e,x=F+H,x<3&&(x=0);;)if(C=b,b=q.times(C.plus(N(O,C,H,1))),T(C.c).slice(0,x)===(v=T(b.c)).slice(0,x))if(b.e0&&Re>0){for(O=Re%x||x,q=Ae.substr(0,O);O0&&(q+=H+Ae.slice(O)),we&&(q="-"+q)}P=Z?q+(b.decimalSeparator||"")+((F=+b.fractionGroupSize)?Z.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):Z):q}return(b.prefix||"")+P+(b.suffix||"")},R.toFraction=function(y){var v,b,P,C,O,L,x,F,H,q,Z,we,Ae=this,Re=Ae.c;if(y!=null&&(x=new M(y),!x.isInteger()&&(x.c||x.s!==1)||x.lt(J)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Re)return new M(Ae);for(v=new M(J),H=b=new M(J),P=F=new M(J),we=T(Re),O=v.e=we.length-Ae.e-1,v.c[0]=f[(L=O%u)<0?u+L:L],y=!y||x.comparedTo(v)>0?O>0?v:H:x,L=ue,ue=1/0,x=new M(we),F.c[0]=0;q=N(x,v,0,1),C=b.plus(q.times(P)),C.comparedTo(y)!=1;)b=P,P=C,H=F.plus(q.times(C=H)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(y.minus(b),P,0,1),F=F.plus(C.times(H)),b=b.plus(C.times(P)),F.s=H.s=Ae.s,O=O*2,Z=N(H,P,O,V).minus(Ae).abs().comparedTo(N(F,b,O,V).minus(Ae).abs())<1?[H,P]:[F,b],ue=L,Z},R.toNumber=function(){return+ce(this)},R.toPrecision=function(y,v){return y!=null&&B(y,1,g),le(this,y,v,2)},R.toString=function(y){var v,b=this,P=b.s,C=b.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(y==null?v=C<=k||C>=K?U(T(b.c),C):A(T(b.c),C,"0"):y===10?(b=oe(new M(b),Q+C+1,V),v=A(T(b.c),b.e,"0")):(B(y,2,ie.length,"Base"),v=_(A(T(b.c),C,"0"),10,y,P,!0)),P<0&&b.c[0]&&(v="-"+v)),v},R.valueOf=R.toJSON=function(){return ce(this)},R._isBigNumber=!0,I!=null&&M.set(I),M}function E(I){var N=I|0;return I>0||I===N?N:N-1}function T(I){for(var N,_,S=1,R=I.length,J=I[0]+"";SK^_?1:-1;for(V=(k=R.length)<(K=J.length)?k:K,Q=0;QJ[Q]^_?1:-1;return k==K?0:k>K^_?1:-1}function B(I,N,_,S){if(I_||I!==i(I))throw Error(s+(S||"Argument")+(typeof I=="number"?I_?" out of range: ":" not an integer: ":" not a primitive number: ")+String(I))}function W(I){var N=I.c.length-1;return E(I.e/u)==N&&I.c[N]%2!=0}function U(I,N){return(I.length>1?I.charAt(0)+"."+I.slice(1):I)+(N<0?"e":"e+")+N}function A(I,N,_){var S,R;if(N<0){for(R=_+".";++N;R+=_);I=R+I}else if(S=I.length,++N>S){for(R=_,N-=S;--N;R+=_);I+=R}else N{"use strict";c();Object.defineProperty(he,"__esModule",{value:!0});he.ErrIsCompletedFieldIsMissingOnTransaction=he.ErrGasLimitShouldBe0ForInnerTransaction=he.ErrInvalidRelayedV2BuilderArguments=he.ErrInvalidRelayedV1BuilderArguments=he.ErrNotImplemented=he.ErrContractInteraction=he.ErrCodec=he.ErrCannotParseTransactionOutcome=he.ErrCannotParseContractResults=he.ErrMissingFieldOnEnum=he.ErrMissingFieldOnStruct=he.ErrTypingSystem=he.ErrMock=he.ErrContractHasNoAddress=he.ErrContract=he.ErrExpectedTransactionEventsNotFound=he.ErrExpectedTransactionStatusNotReached=he.ErrTransactionWatcherTimeout=he.ErrAsyncTimerAborted=he.ErrAsyncTimerAlreadyRunning=he.ErrInvalidFunctionName=he.ErrSignatureCannotCreate=he.ErrTransactionOptionsInvalid=he.ErrTransactionVersionInvalid=he.ErrNonceInvalid=he.ErrNotEnoughGas=he.ErrAddressEmpty=he.ErrAddressBadHrp=he.ErrAddressCannotCreate=he.ErrUnexpectedCondition=he.ErrInvariantFailed=he.ErrBadType=he.ErrUnsupportedOperation=he.ErrInvalidArgument=he.Err=void 0;var De=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};he.Err=De;var q0=class extends De{constructor(e,r){super(`Invalid argument: ${e}`,r)}};he.ErrInvalidArgument=q0;var V0=class extends De{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};he.ErrUnsupportedOperation=V0;var H0=class extends De{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};he.ErrBadType=H0;var G0=class extends De{constructor(e){super(`Invariant failed: [${e}]`)}};he.ErrInvariantFailed=G0;var k0=class extends De{constructor(e){super(`Unexpected condition: [${e}]`)}};he.ErrUnexpectedCondition=k0;var j0=class extends De{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};he.ErrAddressCannotCreate=j0;var Q0=class extends De{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};he.ErrAddressBadHrp=Q0;var W0=class extends De{constructor(){super("Address is empty")}};he.ErrAddressEmpty=W0;var $0=class extends De{constructor(e){super(`Not enough gas provided: ${e}`)}};he.ErrNotEnoughGas=$0;var z0=class extends De{constructor(e){super(`Invalid nonce: ${e}`)}};he.ErrNonceInvalid=z0;var K0=class extends De{constructor(e){super(`Invalid transaction version: ${e}`)}};he.ErrTransactionVersionInvalid=K0;var Y0=class extends De{constructor(e){super(`Invalid transaction options: ${e}`)}};he.ErrTransactionOptionsInvalid=Y0;var J0=class extends De{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};he.ErrSignatureCannotCreate=J0;var X0=class extends De{constructor(){super("Invalid function name")}};he.ErrInvalidFunctionName=X0;var Z0=class extends De{constructor(){super("Async timer already running")}};he.ErrAsyncTimerAlreadyRunning=Z0;var em=class extends De{constructor(){super("Async timer aborted")}};he.ErrAsyncTimerAborted=em;var tm=class extends De{constructor(){super("TransactionWatcher has timed out")}};he.ErrTransactionWatcherTimeout=tm;var rm=class extends De{constructor(){super("Expected transaction status not reached")}};he.ErrExpectedTransactionStatusNotReached=rm;var nm=class extends De{constructor(){super("Expected transaction events not found")}};he.ErrExpectedTransactionEventsNotFound=nm;var rf=class extends De{constructor(e){super(e)}};he.ErrContract=rf;var im=class extends rf{constructor(){super(` +var N5=Object.create;var sf=Object.defineProperty;var O5=Object.getOwnPropertyDescriptor;var D5=Object.getOwnPropertyNames;var P5=Object.getPrototypeOf,R5=Object.prototype.hasOwnProperty;var hS=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var fe=(t,e)=>()=>(t&&(e=t(t=0)),e);var E=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ct=(t,e)=>{for(var r in e)sf(t,r,{get:e[r],enumerable:!0})},nf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of D5(e))!R5.call(t,i)&&i!==r&&sf(t,i,{get:()=>e[i],enumerable:!(n=O5(e,i))||n.enumerable});return t},Gt=(t,e,r)=>(nf(t,e,"default"),r&&nf(r,e,"default")),be=(t,e,r)=>(r=t!=null?N5(P5(t)):{},nf(e||!t||!t.__esModule?sf(r,"default",{value:t,enumerable:!0}):r,t)),ft=t=>nf(sf({},"__esModule",{value:!0}),t);var P0=E(of=>{"use strict";l();of.byteLength=L5;of.toByteArray=M5;of.fromByteArray=V5;var rn=[],Tr=[],B5=typeof Uint8Array<"u"?Uint8Array:Array,D0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(bs=0,dS=D0.length;bs0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function L5(t){var e=pS(t),r=e[0],n=e[1];return(r+n)*3/4-n}function F5(t,e,r){return(e+r)*3/4-r}function M5(t){var e,r=pS(t),n=r[0],i=r[1],s=new B5(F5(t,n,i)),o=0,a=i>0?n-4:n,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Tr[t.charCodeAt(u)]<<2|Tr[t.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=Tr[t.charCodeAt(u)]<<10|Tr[t.charCodeAt(u+1)]<<4|Tr[t.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function U5(t){return rn[t>>18&63]+rn[t>>12&63]+rn[t>>6&63]+rn[t&63]}function q5(t,e,r){for(var n,i=[],s=e;sa?a:o+s));return n===1?(e=t[r-1],i.push(rn[e>>2]+rn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(rn[e>>10]+rn[e>>4&63]+rn[e<<2&63]+"=")),i.join("")}});var B0=E(R0=>{l();R0.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,u=(1<>1,f=-7,h=r?i-1:0,g=r?-1:1,y=t[e+h];for(h+=g,s=y&(1<<-f)-1,y>>=-f,f+=a;f>0;s=s*256+t[e+h],h+=g,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+h],h+=g,f-=8);if(s===0)s=1-c;else{if(s===u)return o?NaN:(y?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(y?-1:1)*o*Math.pow(2,s-n)};R0.write=function(t,e,r,n,i,s){var o,a,u,c=s*8-i-1,f=(1<>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,m=n?1:-1,T=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+h>=1?e+=g/u:e+=g*Math.pow(2,1-h),e*u>=2&&(o++,u/=2),o+h>=f?(a=0,o=f):o+h>=1?(a=(e*u-1)*Math.pow(2,i),o=o+h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+y]=a&255,y+=m,a/=256,i-=8);for(o=o<0;t[r+y]=o&255,y+=m,o/=256,c-=8);t[r+y-m]|=T*128}});var CS=E(Io=>{"use strict";l();var L0=P0(),bo=B0(),gS=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Io.Buffer=$;Io.SlowBuffer=W5;Io.INSPECT_MAX_BYTES=50;var af=2147483647;Io.kMaxLength=af;$.TYPED_ARRAY_SUPPORT=H5();!$.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function H5(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function kn(t){if(t>af)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return q0(t)}return wS(t,e,r)}$.poolSize=8192;function wS(t,e,r){if(typeof t=="string")return k5(t,e);if(ArrayBuffer.isView(t))return j5(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(nn(t,ArrayBuffer)||t&&nn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(nn(t,SharedArrayBuffer)||t&&nn(t.buffer,SharedArrayBuffer)))return M0(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return $.from(n,e,r);var i=Q5(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}$.from=function(t,e,r){return wS(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function ES(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function G5(t,e,r){return ES(t),t<=0?kn(t):e!==void 0?typeof r=="string"?kn(t).fill(e,r):kn(t).fill(e):kn(t)}$.alloc=function(t,e,r){return G5(t,e,r)};function q0(t){return ES(t),kn(t<0?0:V0(t)|0)}$.allocUnsafe=function(t){return q0(t)};$.allocUnsafeSlow=function(t){return q0(t)};function k5(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=vS(t,e)|0,n=kn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function F0(t){for(var e=t.length<0?0:V0(t.length)|0,r=kn(e),n=0;n=af)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+af.toString(16)+" bytes");return t|0}function W5(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(nn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),nn(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);si.length?$.from(o).copy(i,s):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function vS(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||nn(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U0(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return TS(t).length;default:if(i)return n?-1:U0(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=vS;function z5(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return n4(this,e,r);case"utf8":case"utf-8":return bS(this,e,r);case"ascii":return t4(this,e,r);case"latin1":case"binary":return r4(this,e,r);case"base64":return Z5(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i4(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Is(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}$.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;rr&&(e+=" ... "),""};gS&&($.prototype[gS]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(nn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n),h=0;h2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,H0(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:yS(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):yS(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function yS(t,e,r,n,i){var s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(y,m){return s===1?y[m]:y.readUInt16BE(m*s)}var c;if(i){var f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){for(var h=!0,g=0;gi&&(n=i)):n=i;var s=e.length;n>s/2&&(n=s/2);for(var o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return $5(this,e,r,n);case"utf8":case"utf-8":return K5(this,e,r,n);case"ascii":case"latin1":case"binary":return Y5(this,e,r,n);case"base64":return J5(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X5(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Z5(t,e,r){return e===0&&r===t.length?L0.fromByteArray(t):L0.fromByteArray(t.slice(e,r))}function bS(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var u,c,f,h;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(h=(s&31)<<6|u&63,h>127&&(o=h));break;case 3:u=t[i+1],c=t[i+2],(u&192)===128&&(c&192)===128&&(h=(s&15)<<12|(u&63)<<6|c&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(h=(s&15)<<18|(u&63)<<12|(c&63)<<6|f&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return e4(n)}var mS=4096;function e4(t){var e=t.length;if(e<=mS)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=this[e],s=1,o=0;++o>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=this[e+--r],s=1;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=this[e],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);for(var i=r,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),bo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),bo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),bo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),bo.read(this,e,!1,52,8)};function ur(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;ur(this,e,r,n,s,0)}var o=1,a=0;for(this[r]=e&255;++a>>0,n=n>>>0,!i){var s=Math.pow(2,8*n)-1;ur(this,e,r,n,s,0)}var o=n-1,a=1;for(this[r+o]=e&255;--o>=0&&(a*=256);)this[r+o]=e/a&255;return r+n};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);ur(this,e,r,n,s-1,-s)}var o=0,a=1,u=0;for(this[r]=e&255;++o>0)-u&255;return r+n};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){var s=Math.pow(2,8*n-1);ur(this,e,r,n,s-1,-s)}var o=n-1,a=1,u=0;for(this[r+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[r+o+1]!==0&&(u=1),this[r+o]=(e/a>>0)-u&255;return r+n};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||ur(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function IS(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _S(t,e,r,n,i){return e=+e,r=r>>>0,i||IS(t,e,r,4,34028234663852886e22,-34028234663852886e22),bo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return _S(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return _S(this,e,r,!1,n)};function SS(t,e,r,n,i){return e=+e,r=r>>>0,i||IS(t,e,r,8,17976931348623157e292,-17976931348623157e292),bo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return SS(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return SS(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function a4(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function TS(t){return L0.toByteArray(o4(t))}function uf(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function nn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function H0(t){return t!==t}var c4=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,i=0;i<16;++i)e[n+i]=t[r]+t[i];return e}()});var PS=E((fse,DS)=>{l();var mt=DS.exports={},sn,on;function G0(){throw new Error("setTimeout has not been defined")}function k0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?sn=setTimeout:sn=G0}catch{sn=G0}try{typeof clearTimeout=="function"?on=clearTimeout:on=k0}catch{on=k0}})();function xS(t){if(sn===setTimeout)return setTimeout(t,0);if((sn===G0||!sn)&&setTimeout)return sn=setTimeout,setTimeout(t,0);try{return sn(t,0)}catch{try{return sn.call(null,t,0)}catch{return sn.call(this,t,0)}}}function l4(t){if(on===clearTimeout)return clearTimeout(t);if((on===k0||!on)&&clearTimeout)return on=clearTimeout,clearTimeout(t);try{return on(t)}catch{try{return on.call(null,t)}catch{return on.call(this,t)}}}var jn=[],_o=!1,_s,cf=-1;function f4(){!_o||!_s||(_o=!1,_s.length?jn=_s.concat(jn):cf=-1,jn.length&&NS())}function NS(){if(!_o){var t=xS(f4);_o=!0;for(var e=jn.length;e;){for(_s=jn,jn=[];++cf1)for(var r=1;r{d=be(CS()),p=be(PS()),h4=function(t){function e(){var n=this||self;return delete t.prototype.__magic__,n}if(typeof globalThis=="object")return globalThis;if(this)return e();t.defineProperty(t.prototype,"__magic__",{configurable:!0,get:e});var r=__magic__;return r}(Object),global=h4});var kt=E((RS,lf)=>{l();(function(t){"use strict";var e,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,c=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,g=1e9;function y(_){var N,I,S,R=M.prototype={constructor:M,toString:null,valueOf:null},J=new M(1),Q=20,V=4,k=-7,K=21,ge=-1e7,ue=1e7,re=!1,Y=1,se=0,te={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ie="0123456789abcdefghijklmnopqrstuvwxyz";function M(w,v){var b,P,C,D,L,x,F,H,q=this;if(!(q instanceof M))return new M(w,v);if(v==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>ue?q.c=q.e=null:w.e=10;L/=10,D++);D>ue?q.c=q.e=null:(q.e=D,q.c=[w]);return}H=String(w)}else{if(!r.test(H=String(w)))return S(q,H,x);q.s=H.charCodeAt(0)==45?(H=H.slice(1),-1):1}(D=H.indexOf("."))>-1&&(H=H.replace(".","")),(L=H.search(/e/i))>0?(D<0&&(D=L),D+=+H.slice(L+1),H=H.substring(0,L)):D<0&&(D=H.length)}else{if(B(v,2,ie.length,"Base"),v==10)return q=new M(w),oe(q,Q+q.e+1,V);if(H=String(w),x=typeof w=="number"){if(w*0!=0)return S(q,H,x,v);if(q.s=1/w<0?(H=H.slice(1),-1):1,M.DEBUG&&H.replace(/^0\.0*|\./,"").length>15)throw Error(o+w)}else q.s=H.charCodeAt(0)===45?(H=H.slice(1),-1):1;for(b=ie.slice(0,v),D=L=0,F=H.length;LD){D=F;continue}}else if(!C&&(H==H.toUpperCase()&&(H=H.toLowerCase())||H==H.toLowerCase()&&(H=H.toUpperCase()))){C=!0,L=-1,D=0;continue}return S(q,String(w),x,v)}x=!1,H=I(H,v,10,q.s),(D=H.indexOf("."))>-1?H=H.replace(".",""):D=H.length}for(L=0;H.charCodeAt(L)===48;L++);for(F=H.length;H.charCodeAt(--F)===48;);if(H=H.slice(L,++F)){if(F-=L,x&&M.DEBUG&&F>15&&(w>c||w!==i(w)))throw Error(o+q.s*w);if((D=D-L-1)>ue)q.c=q.e=null;else if(D=-g&&C<=g&&C===i(C)){if(P[0]===0){if(C===0&&P.length===1)return!0;break e}if(v=(C+1)%u,v<1&&(v+=u),String(P[0]).length==v){for(v=0;v=a||b!==i(b))break e;if(b!==0)return!0}}}else if(P===null&&C===null&&(D===null||D===1||D===-1))return!0;throw Error(s+"Invalid BigNumber: "+w)},M.maximum=M.max=function(){return ae(arguments,R.lt)},M.minimum=M.min=function(){return ae(arguments,R.gt)},M.random=function(){var w=9007199254740992,v=Math.random()*w&2097151?function(){return i(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var P,C,D,L,x,F=0,H=[],q=new M(J);if(b==null?b=Q:B(b,0,g),L=n(b/u),re)if(crypto.getRandomValues){for(P=crypto.getRandomValues(new Uint32Array(L*=2));F>>11),x>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),P[F]=C[0],P[F+1]=C[1]):(H.push(x%1e14),F+=2);F=L/2}else if(crypto.randomBytes){for(P=crypto.randomBytes(L*=7);F=9e15?crypto.randomBytes(7).copy(P,F):(H.push(x%1e14),F+=7);F=L/7}else throw re=!1,Error(s+"crypto unavailable");if(!re)for(;F=10;x/=10,F++);FC-1&&(x[L+1]==null&&(x[L+1]=0),x[L+1]+=x[L]/C|0,x[L]%=C)}return x.reverse()}return function(b,P,C,D,L){var x,F,H,q,Z,we,Ae,Re,tt=b.indexOf("."),lt=Q,Oe=V;for(tt>=0&&(q=se,se=0,b=b.replace(".",""),Re=new M(P),we=Re.pow(b.length-tt),se=q,Re.c=v(A(T(we.c),we.e,"0"),10,C,w),Re.e=Re.c.length),Ae=v(b,P,C,L?(x=ie,w):(x=w,ie)),H=q=Ae.length;Ae[--q]==0;Ae.pop());if(!Ae[0])return x.charAt(0);if(tt<0?--H:(we.c=Ae,we.e=H,we.s=D,we=N(we,Re,lt,Oe,C),Ae=we.c,Z=we.r,H=we.e),F=H+lt+1,tt=Ae[F],q=C/2,Z=Z||F<0||Ae[F+1]!=null,Z=Oe<4?(tt!=null||Z)&&(Oe==0||Oe==(we.s<0?3:2)):tt>q||tt==q&&(Oe==4||Z||Oe==6&&Ae[F-1]&1||Oe==(we.s<0?8:7)),F<1||!Ae[0])b=Z?A(x.charAt(1),-lt,x.charAt(0)):x.charAt(0);else{if(Ae.length=F,Z)for(--C;++Ae[--F]>C;)Ae[F]=0,F||(++H,Ae=[1].concat(Ae));for(q=Ae.length;!Ae[--q];);for(tt=0,b="";tt<=q;b+=x.charAt(Ae[tt++]));b=A(b,H,x.charAt(0))}return b}}(),N=function(){function w(P,C,D){var L,x,F,H,q=0,Z=P.length,we=C%h,Ae=C/h|0;for(P=P.slice();Z--;)F=P[Z]%h,H=P[Z]/h|0,L=Ae*F+H*we,x=we*F+L%h*h+q,q=(x/D|0)+(L/h|0)+Ae*H,P[Z]=x%D;return q&&(P=[q].concat(P)),P}function v(P,C,D,L){var x,F;if(D!=L)F=D>L?1:-1;else for(x=F=0;xC[x]?1:-1;break}return F}function b(P,C,D,L){for(var x=0;D--;)P[D]-=x,x=P[D]1;P.splice(0,1));}return function(P,C,D,L,x){var F,H,q,Z,we,Ae,Re,tt,lt,Oe,Ue,Ot,gi,vs,As,ar,Gn,$t=P.s==C.s?1:-1,Dt=P.c,ze=C.c;if(!Dt||!Dt[0]||!ze||!ze[0])return new M(!P.s||!C.s||(Dt?ze&&Dt[0]==ze[0]:!ze)?NaN:Dt&&Dt[0]==0||!ze?$t*0:$t/0);for(tt=new M($t),lt=tt.c=[],H=P.e-C.e,$t=D+H+1,x||(x=a,H=m(P.e/u)-m(C.e/u),$t=$t/u|0),q=0;ze[q]==(Dt[q]||0);q++);if(ze[q]>(Dt[q]||0)&&H--,$t<0)lt.push(1),Z=!0;else{for(vs=Dt.length,ar=ze.length,q=0,$t+=2,we=i(x/(ze[0]+1)),we>1&&(ze=w(ze,we,x),Dt=w(Dt,we,x),ar=ze.length,vs=Dt.length),gi=ar,Oe=Dt.slice(0,ar),Ue=Oe.length;Ue=x/2&&As++;do{if(we=0,F=v(ze,Oe,ar,Ue),F<0){if(Ot=Oe[0],ar!=Ue&&(Ot=Ot*x+(Oe[1]||0)),we=i(Ot/As),we>1)for(we>=x&&(we=x-1),Ae=w(ze,we,x),Re=Ae.length,Ue=Oe.length;v(Ae,Oe,Re,Ue)==1;)we--,b(Ae,ar=10;$t/=10,q++);oe(tt,D+(tt.e=q+H*u-1)+1,L,Z)}else tt.e=H,tt.r=+Z;return tt}}();function le(w,v,b,P){var C,D,L,x,F;if(b==null?b=V:B(b,0,8),!w.c)return w.toString();if(C=w.c[0],L=w.e,v==null)F=T(w.c),F=P==1||P==2&&(L<=k||L>=K)?U(F,L):A(F,L,"0");else if(w=oe(new M(w),v,b),D=w.e,F=T(w.c),x=F.length,P==1||P==2&&(v<=D||D<=k)){for(;xx){if(--v>0)for(F+=".";v--;F+="0");}else if(v+=D-x,v>0)for(D+1==x&&(F+=".");v--;F+="0");return w.s<0&&C?"-"+F:F}function ae(w,v){for(var b,P=1,C=new M(w[0]);P=10;C/=10,P++);return(b=P+b*u-1)>ue?w.c=w.e=null:b=10;x/=10,C++);if(D=v-C,D<0)D+=u,L=v,F=Z[H=0],q=F/we[C-L-1]%10|0;else if(H=n((D+1)/u),H>=Z.length)if(P){for(;Z.length<=H;Z.push(0));F=q=0,C=1,D%=u,L=D-u+1}else break e;else{for(F=x=Z[H],C=1;x>=10;x/=10,C++);D%=u,L=D-u+C,q=L<0?0:F/we[C-L-1]%10|0}if(P=P||v<0||Z[H+1]!=null||(L<0?F:F%we[C-L-1]),P=b<4?(q||P)&&(b==0||b==(w.s<0?3:2)):q>5||q==5&&(b==4||P||b==6&&(D>0?L>0?F/we[C-L]:0:Z[H-1])%10&1||b==(w.s<0?8:7)),v<1||!Z[0])return Z.length=0,P?(v-=w.e+1,Z[0]=we[(u-v%u)%u],w.e=-v||0):Z[0]=w.e=0,w;if(D==0?(Z.length=H,x=1,H--):(Z.length=H+1,x=we[u-D],Z[H]=L>0?i(F/we[C-L]%we[L])*x:0),P)for(;;)if(H==0){for(D=1,L=Z[0];L>=10;L/=10,D++);for(L=Z[0]+=x,x=1;L>=10;L/=10,x++);D!=x&&(w.e++,Z[0]==a&&(Z[0]=1));break}else{if(Z[H]+=x,Z[H]!=a)break;Z[H--]=0,x=1}for(D=Z.length;Z[--D]===0;Z.pop());}w.e>ue?w.c=w.e=null:w.e=K?U(v,b):A(v,b,"0"),w.s<0?"-"+v:v)}return R.absoluteValue=R.abs=function(){var w=new M(this);return w.s<0&&(w.s=1),w},R.comparedTo=function(w,v){return O(this,new M(w,v))},R.decimalPlaces=R.dp=function(w,v){var b,P,C,D=this;if(w!=null)return B(w,0,g),v==null?v=V:B(v,0,8),oe(new M(D),w+D.e+1,v);if(!(b=D.c))return null;if(P=((C=b.length-1)-m(this.e/u))*u,C=b[C])for(;C%10==0;C/=10,P--);return P<0&&(P=0),P},R.dividedBy=R.div=function(w,v){return N(this,new M(w,v),Q,V)},R.dividedToIntegerBy=R.idiv=function(w,v){return N(this,new M(w,v),0,1)},R.exponentiatedBy=R.pow=function(w,v){var b,P,C,D,L,x,F,H,q,Z=this;if(w=new M(w),w.c&&!w.isInteger())throw Error(s+"Exponent not an integer: "+ce(w));if(v!=null&&(v=new M(v)),x=w.e>14,!Z.c||!Z.c[0]||Z.c[0]==1&&!Z.e&&Z.c.length==1||!w.c||!w.c[0])return q=new M(Math.pow(+ce(Z),x?2-W(w):+ce(w))),v?q.mod(v):q;if(F=w.s<0,v){if(v.c?!v.c[0]:!v.s)return new M(NaN);P=!F&&Z.isInteger()&&v.isInteger(),P&&(Z=Z.mod(v))}else{if(w.e>9&&(Z.e>0||Z.e<-1||(Z.e==0?Z.c[0]>1||x&&Z.c[1]>=24e7:Z.c[0]<8e13||x&&Z.c[0]<=9999975e7)))return D=Z.s<0&&W(w)?-0:0,Z.e>-1&&(D=1/D),new M(F?1/D:D);se&&(D=n(se/u+2))}for(x?(b=new M(.5),F&&(w.s=1),H=W(w)):(C=Math.abs(+ce(w)),H=C%2),q=new M(J);;){if(H){if(q=q.times(Z),!q.c)break;D?q.c.length>D&&(q.c.length=D):P&&(q=q.mod(v))}if(C){if(C=i(C/2),C===0)break;H=C%2}else if(w=w.times(b),oe(w,w.e+1,1),w.e>14)H=W(w);else{if(C=+ce(w),C===0)break;H=C%2}Z=Z.times(Z),D?Z.c&&Z.c.length>D&&(Z.c.length=D):P&&(Z=Z.mod(v))}return P?q:(F&&(q=J.div(q)),v?q.mod(v):D?oe(q,se,V,L):q)},R.integerValue=function(w){var v=new M(this);return w==null?w=V:B(w,0,8),oe(v,v.e+1,w)},R.isEqualTo=R.eq=function(w,v){return O(this,new M(w,v))===0},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(w,v){return O(this,new M(w,v))>0},R.isGreaterThanOrEqualTo=R.gte=function(w,v){return(v=O(this,new M(w,v)))===1||v===0},R.isInteger=function(){return!!this.c&&m(this.e/u)>this.c.length-2},R.isLessThan=R.lt=function(w,v){return O(this,new M(w,v))<0},R.isLessThanOrEqualTo=R.lte=function(w,v){return(v=O(this,new M(w,v)))===-1||v===0},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&this.c[0]==0},R.minus=function(w,v){var b,P,C,D,L=this,x=L.s;if(w=new M(w,v),v=w.s,!x||!v)return new M(NaN);if(x!=v)return w.s=-v,L.plus(w);var F=L.e/u,H=w.e/u,q=L.c,Z=w.c;if(!F||!H){if(!q||!Z)return q?(w.s=-v,w):new M(Z?L:NaN);if(!q[0]||!Z[0])return Z[0]?(w.s=-v,w):new M(q[0]?L:V==3?-0:0)}if(F=m(F),H=m(H),q=q.slice(),x=F-H){for((D=x<0)?(x=-x,C=q):(H=F,C=Z),C.reverse(),v=x;v--;C.push(0));C.reverse()}else for(P=(D=(x=q.length)<(v=Z.length))?x:v,x=v=0;v0)for(;v--;q[b++]=0);for(v=a-1;P>x;){if(q[--P]=0;){for(b=0,we=Ot[C]%lt,Ae=Ot[C]/lt|0,L=F,D=C+L;D>C;)H=Ue[--L]%lt,q=Ue[L]/lt|0,x=Ae*H+q*we,H=we*H+x%lt*lt+Re[D]+b,b=(H/tt|0)+(x/lt|0)+Ae*q,Re[D--]=H%tt;Re[D]=b}return b?++P:Re.splice(0,1),he(w,Re,P)},R.negated=function(){var w=new M(this);return w.s=-w.s||null,w},R.plus=function(w,v){var b,P=this,C=P.s;if(w=new M(w,v),v=w.s,!C||!v)return new M(NaN);if(C!=v)return w.s=-v,P.minus(w);var D=P.e/u,L=w.e/u,x=P.c,F=w.c;if(!D||!L){if(!x||!F)return new M(C/0);if(!x[0]||!F[0])return F[0]?w:new M(x[0]?P:C*0)}if(D=m(D),L=m(L),x=x.slice(),C=D-L){for(C>0?(L=D,b=F):(C=-C,b=x),b.reverse();C--;b.push(0));b.reverse()}for(C=x.length,v=F.length,C-v<0&&(b=F,F=x,x=b,v=C),C=0;v;)C=(x[--v]=x[v]+F[v]+C)/a|0,x[v]=a===x[v]?0:x[v]%a;return C&&(x=[C].concat(x),++L),he(w,x,L)},R.precision=R.sd=function(w,v){var b,P,C,D=this;if(w!=null&&w!==!!w)return B(w,1,g),v==null?v=V:B(v,0,8),oe(new M(D),w,v);if(!(b=D.c))return null;if(C=b.length-1,P=C*u+1,C=b[C]){for(;C%10==0;C/=10,P--);for(C=b[0];C>=10;C/=10,P++);}return w&&D.e+1>P&&(P=D.e+1),P},R.shiftedBy=function(w){return B(w,-c,c),this.times("1e"+w)},R.squareRoot=R.sqrt=function(){var w,v,b,P,C,D=this,L=D.c,x=D.s,F=D.e,H=Q+4,q=new M("0.5");if(x!==1||!L||!L[0])return new M(!x||x<0&&(!L||L[0])?NaN:L?D:1/0);if(x=Math.sqrt(+ce(D)),x==0||x==1/0?(v=T(L),(v.length+F)%2==0&&(v+="0"),x=Math.sqrt(+v),F=m((F+1)/2)-(F<0||F%2),x==1/0?v="5e"+F:(v=x.toExponential(),v=v.slice(0,v.indexOf("e")+1)+F),b=new M(v)):b=new M(x+""),b.c[0]){for(F=b.e,x=F+H,x<3&&(x=0);;)if(C=b,b=q.times(C.plus(N(D,C,H,1))),T(C.c).slice(0,x)===(v=T(b.c)).slice(0,x))if(b.e0&&Re>0){for(D=Re%x||x,q=Ae.substr(0,D);D0&&(q+=H+Ae.slice(D)),we&&(q="-"+q)}P=Z?q+(b.decimalSeparator||"")+((F=+b.fractionGroupSize)?Z.replace(new RegExp("\\d{"+F+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):Z):q}return(b.prefix||"")+P+(b.suffix||"")},R.toFraction=function(w){var v,b,P,C,D,L,x,F,H,q,Z,we,Ae=this,Re=Ae.c;if(w!=null&&(x=new M(w),!x.isInteger()&&(x.c||x.s!==1)||x.lt(J)))throw Error(s+"Argument "+(x.isInteger()?"out of range: ":"not an integer: ")+ce(x));if(!Re)return new M(Ae);for(v=new M(J),H=b=new M(J),P=F=new M(J),we=T(Re),D=v.e=we.length-Ae.e-1,v.c[0]=f[(L=D%u)<0?u+L:L],w=!w||x.comparedTo(v)>0?D>0?v:H:x,L=ue,ue=1/0,x=new M(we),F.c[0]=0;q=N(x,v,0,1),C=b.plus(q.times(P)),C.comparedTo(w)!=1;)b=P,P=C,H=F.plus(q.times(C=H)),F=C,v=x.minus(q.times(C=v)),x=C;return C=N(w.minus(b),P,0,1),F=F.plus(C.times(H)),b=b.plus(C.times(P)),F.s=H.s=Ae.s,D=D*2,Z=N(H,P,D,V).minus(Ae).abs().comparedTo(N(F,b,D,V).minus(Ae).abs())<1?[H,P]:[F,b],ue=L,Z},R.toNumber=function(){return+ce(this)},R.toPrecision=function(w,v){return w!=null&&B(w,1,g),le(this,w,v,2)},R.toString=function(w){var v,b=this,P=b.s,C=b.e;return C===null?P?(v="Infinity",P<0&&(v="-"+v)):v="NaN":(w==null?v=C<=k||C>=K?U(T(b.c),C):A(T(b.c),C,"0"):w===10?(b=oe(new M(b),Q+C+1,V),v=A(T(b.c),b.e,"0")):(B(w,2,ie.length,"Base"),v=I(A(T(b.c),C,"0"),10,w,P,!0)),P<0&&b.c[0]&&(v="-"+v)),v},R.valueOf=R.toJSON=function(){return ce(this)},R._isBigNumber=!0,_!=null&&M.set(_),M}function m(_){var N=_|0;return _>0||_===N?N:N-1}function T(_){for(var N,I,S=1,R=_.length,J=_[0]+"";SK^I?1:-1;for(V=(k=R.length)<(K=J.length)?k:K,Q=0;QJ[Q]^I?1:-1;return k==K?0:k>K^I?1:-1}function B(_,N,I,S){if(_I||_!==i(_))throw Error(s+(S||"Argument")+(typeof _=="number"?_I?" out of range: ":" not an integer: ":" not a primitive number: ")+String(_))}function W(_){var N=_.c.length-1;return m(_.e/u)==N&&_.c[N]%2!=0}function U(_,N){return(_.length>1?_.charAt(0)+"."+_.slice(1):_)+(N<0?"e":"e+")+N}function A(_,N,I){var S,R;if(N<0){for(R=I+".";++N;R+=I);_=R+_}else if(S=_.length,++N>S){for(R=I,N-=S;--N;R+=I);_+=R}else N{"use strict";l();Object.defineProperty(de,"__esModule",{value:!0});de.ErrIsCompletedFieldIsMissingOnTransaction=de.ErrGasLimitShouldBe0ForInnerTransaction=de.ErrInvalidRelayedV2BuilderArguments=de.ErrInvalidRelayedV1BuilderArguments=de.ErrNotImplemented=de.ErrContractInteraction=de.ErrCodec=de.ErrCannotParseTransactionOutcome=de.ErrCannotParseContractResults=de.ErrMissingFieldOnEnum=de.ErrMissingFieldOnStruct=de.ErrTypingSystem=de.ErrMock=de.ErrContractHasNoAddress=de.ErrContract=de.ErrExpectedTransactionEventsNotFound=de.ErrExpectedTransactionStatusNotReached=de.ErrTransactionWatcherTimeout=de.ErrAsyncTimerAborted=de.ErrAsyncTimerAlreadyRunning=de.ErrInvalidFunctionName=de.ErrSignatureCannotCreate=de.ErrTransactionOptionsInvalid=de.ErrTransactionVersionInvalid=de.ErrNonceInvalid=de.ErrNotEnoughGas=de.ErrAddressEmpty=de.ErrAddressBadHrp=de.ErrAddressCannotCreate=de.ErrUnexpectedCondition=de.ErrInvariantFailed=de.ErrBadType=de.ErrUnsupportedOperation=de.ErrInvalidArgument=de.Err=void 0;var De=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}summary(){let e=[];e.push({name:this.name,message:this.message});let r=this.inner;for(;r;)e.push({name:r.name,message:r.message}),r=r.inner;return e}};de.Err=De;var j0=class extends De{constructor(e,r){super(`Invalid argument: ${e}`,r)}};de.ErrInvalidArgument=j0;var Q0=class extends De{constructor(e,r="not specified"){super(`Operation "${e}" not supported. Reason: ${r}`)}};de.ErrUnsupportedOperation=Q0;var W0=class extends De{constructor(e,r,n){super(`Bad type of "${e}": ${n}. Expected type: ${r}`)}};de.ErrBadType=W0;var z0=class extends De{constructor(e){super(`Invariant failed: [${e}]`)}};de.ErrInvariantFailed=z0;var $0=class extends De{constructor(e){super(`Unexpected condition: [${e}]`)}};de.ErrUnexpectedCondition=$0;var K0=class extends De{constructor(e,r){let n=`Cannot create address from: ${e}`;super(n,r)}};de.ErrAddressCannotCreate=K0;var Y0=class extends De{constructor(e,r){super(`Wrong address HRP. Expected: ${e}, got ${r}`)}};de.ErrAddressBadHrp=Y0;var J0=class extends De{constructor(){super("Address is empty")}};de.ErrAddressEmpty=J0;var X0=class extends De{constructor(e){super(`Not enough gas provided: ${e}`)}};de.ErrNotEnoughGas=X0;var Z0=class extends De{constructor(e){super(`Invalid nonce: ${e}`)}};de.ErrNonceInvalid=Z0;var em=class extends De{constructor(e){super(`Invalid transaction version: ${e}`)}};de.ErrTransactionVersionInvalid=em;var tm=class extends De{constructor(e){super(`Invalid transaction options: ${e}`)}};de.ErrTransactionOptionsInvalid=tm;var rm=class extends De{constructor(e,r){let n=`Cannot create signature from: ${e}`;super(n,r)}};de.ErrSignatureCannotCreate=rm;var nm=class extends De{constructor(){super("Invalid function name")}};de.ErrInvalidFunctionName=nm;var im=class extends De{constructor(){super("Async timer already running")}};de.ErrAsyncTimerAlreadyRunning=im;var sm=class extends De{constructor(){super("Async timer aborted")}};de.ErrAsyncTimerAborted=sm;var om=class extends De{constructor(){super("TransactionWatcher has timed out")}};de.ErrTransactionWatcherTimeout=om;var am=class extends De{constructor(){super("Expected transaction status not reached")}};de.ErrExpectedTransactionStatusNotReached=am;var um=class extends De{constructor(){super("Expected transaction events not found")}};de.ErrExpectedTransactionEventsNotFound=um;var ff=class extends De{constructor(e){super(e)}};de.ErrContract=ff;var cm=class extends ff{constructor(){super(` The smart contract has no address set. Make sure you provide the address in the constructor, or call setAddress() appropriately. If you need to recompute the address of the contract, make use of SmartContract.computeAddress() (static method). -`)}};he.ErrContractHasNoAddress=im;var sm=class extends De{constructor(e){super(e)}};he.ErrMock=sm;var om=class extends De{constructor(e){super(e)}};he.ErrTypingSystem=om;var am=class extends De{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};he.ErrMissingFieldOnStruct=am;var um=class extends De{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};he.ErrMissingFieldOnEnum=um;var cm=class extends De{constructor(e){super(`cannot parse contract results: ${e}`)}};he.ErrCannotParseContractResults=cm;var lm=class extends De{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};he.ErrCannotParseTransactionOutcome=lm;var fm=class extends De{constructor(e){super(e)}};he.ErrCodec=fm;var hm=class extends De{constructor(e){super(e)}};he.ErrContractInteraction=hm;var dm=class extends De{constructor(){super("Method not yet implemented")}};he.ErrNotImplemented=dm;var pm=class extends De{constructor(){super("invalid arguments for relayed v1 builder")}};he.ErrInvalidRelayedV1BuilderArguments=pm;var gm=class extends De{constructor(){super("invalid arguments for relayed v2 builder")}};he.ErrInvalidRelayedV2BuilderArguments=gm;var ym=class extends De{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};he.ErrGasLimitShouldBe0ForInnerTransaction=ym;var mm=class extends De{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};he.ErrIsCompletedFieldIsMissingOnTransaction=mm});var Em=m(di=>{"use strict";c();var k5=di&&di.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(di,"__esModule",{value:!0});di.TokenPayment=di.TokenTransfer=void 0;var Cu=k5(Gt()),j5=Be(),ES="EGLD",vS=18;Cu.default.set({ROUNDING_MODE:1});var nf=class t{constructor(e){let r=new Cu.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new j5.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new Cu.default(e).shiftedBy(vS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:ES,nonce:0,amountAsBigInteger:e,numDecimals:vS})}static fungibleFromAmount(e,r,n){let i=new Cu.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Cu.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==ES}isFungible(){return this.nonce==0}};di.TokenTransfer=nf;var wm=class extends nf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};di.TokenPayment=wm});var bs=m(ze=>{"use strict";c();Object.defineProperty(ze,"__esModule",{value:!0});ze.ARGUMENTS_SEPARATOR=ze.ESDT_TRANSFER_VALUE=ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDTNFT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_FUNCTION_NAME=ze.ESDT_TRANSFER_GAS_LIMIT=ze.TRANSACTION_VERSION_WITH_OPTIONS=ze.TRANSACTION_VERSION_DEFAULT=ze.TRANSACTION_OPTIONS_TX_GUARDED=ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=ze.TRANSACTION_OPTIONS_DEFAULT=ze.TRANSACTION_MIN_GAS_PRICE=void 0;ze.TRANSACTION_MIN_GAS_PRICE=1e9;ze.TRANSACTION_OPTIONS_DEFAULT=0;ze.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;ze.TRANSACTION_OPTIONS_TX_GUARDED=2;ze.TRANSACTION_VERSION_DEFAULT=1;ze.TRANSACTION_VERSION_WITH_OPTIONS=2;ze.ESDT_TRANSFER_GAS_LIMIT=5e5;ze.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";ze.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";ze.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";ze.ESDT_TRANSFER_VALUE="0";ze.ARGUMENTS_SEPARATOR="@"});var wr=m(nt=>{"use strict";c();var Q5=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),W5=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$5=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Q5(e,t,r);return W5(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var bo=$5(Be());function z5(t,e){if(!t)throw new bo.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=z5;function K5(t,e){AS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=K5;function AS(t,e){if(e==null||e===void 0)throw new bo.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=AS;function Y5(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new bo.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=Y5;function J5(t,e){let r=t.length||0;if(r!=e)throw new bo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=J5;function X5(t,e){if(vm(t))throw new bo.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=X5;function Z5(t,e){if(!vm(t))throw new bo.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=Z5;function vm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=vm});var bS=m(sf=>{"use strict";c();Object.defineProperty(sf,"__esModule",{value:!0});sf.getJavascriptPrototypesInHierarchy=void 0;function e4(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}sf.getJavascriptPrototypesInHierarchy=e4});var It=m(_t=>{"use strict";c();Object.defineProperty(_t,"__esModule",{value:!0});_t.NullType=_t.TypePlaceholder=_t.isTyped=_t.PrimitiveValue=_t.TypedValue=_t.CustomType=_t.PrimitiveType=_t.TypeCardinality=_t.Type=void 0;var Am=bS(),_S=wr(),pi=class t{constructor(e,r=[],n=xu.fixed(1)){_S.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return Am.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return _S.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Am.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};_t.Type=pi;pi.ClassName="Type";var xu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};_t.TypeCardinality=xu;xu.MaxCardinality=4096;var of=class t extends pi{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveType=of;of.ClassName="PrimitiveType";var af=class t extends pi{getClassName(){return t.ClassName}};_t.CustomType=af;af.ClassName="CustomType";var Nu=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return Am.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};_t.TypedValue=Nu;Nu.ClassName="TypedValue";var uf=class t extends Nu{constructor(e){super(e)}getClassName(){return t.ClassName}};_t.PrimitiveValue=uf;uf.ClassName="PrimitiveValue";function t4(t){return t.belongsToTypesystem!==void 0}_t.isTyped=t4;var cf=class t extends pi{constructor(){super("...")}getClassName(){return t.ClassName}};_t.TypePlaceholder=cf;cf.ClassName="TypePlaceholder";var lf=class t extends pi{constructor(){super("?")}getClassName(){return t.ClassName}};_t.NullType=lf;lf.ClassName="NullType"});var IS=m((_o,Io)=>{c();(function(t){var e=typeof _o=="object"&&_o&&!_o.nodeType&&_o,r=typeof Io=="object"&&Io&&!Io.nodeType&&Io,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,l=38,f=700,d=72,g=128,w="-",E=/^xn--/,T=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=o-a,U=Math.floor,A=String.fromCharCode,I;function N(Y){throw new RangeError(B[Y])}function _(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function S(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(D,".");var M=Y.split("."),le=_(M,se).join(".");return ie+le}function R(Y){for(var se=[],te=0,ie=Y.length,M,le;te=55296&&M<=56319&&te65535&&(se-=65536,te+=A(se>>>10&1023|55296),se=56320|se&1023),te+=A(se),te}).join("")}function Q(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function V(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function k(Y,se,te){var ie=0;for(Y=te?U(Y/f):Y>>1,Y+=U(Y/se);Y>W*u>>1;ie+=o)Y=U(Y/W);return U(ie+(W+1)*Y/(Y+l))}function K(Y){var se=[],te=Y.length,ie,M=0,le=g,ae=d,fe,oe,ce,y,v,b,P,C,O;for(fe=Y.lastIndexOf(w),fe<0&&(fe=0),oe=0;oe=128&&N("not-basic"),se.push(Y.charCodeAt(oe));for(ce=fe>0?fe+1:0;ce=te&&N("invalid-input"),P=Q(Y.charCodeAt(ce++)),(P>=o||P>U((s-M)/v))&&N("overflow"),M+=P*v,C=b<=ae?a:b>=ae+u?u:b-ae,!(PU(s/O)&&N("overflow"),v*=O;ie=se.length+1,ae=k(M-y,ie,y==0),U(M/ie)>s-le&&N("overflow"),le+=U(M/ie),M%=ie,se.splice(M++,0,le)}return J(se)}function pe(Y){var se,te,ie,M,le,ae,fe,oe,ce,y,v,b=[],P,C,O,L;for(Y=R(Y),P=Y.length,se=g,te=0,le=d,ae=0;ae=se&&vU((s-te)/C)&&N("overflow"),te+=(fe-se)*C,se=fe,ae=0;aes&&N("overflow"),v==se){for(oe=te,ce=o;y=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";c();var TS=IS();function r4(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function bm(t){return t>="0"&&t<="7"}function n4(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function SS(t){return t=parseInt(t,16),TS.ucs2.encode([t])}function CS(t,e,r){var n=!1,i=[];function s(u){var l=t[u];if(!n4(l))throw new r4(u,"Unexpected token ILLEGAL");return l}for(;e{c();var DS=xS();BS.exports={validate:i4,parse:s4};function i4(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{ff(t,0,e,!1)}catch(n){r=n.message}return r}function s4(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=ff(t,0,e,!0);return r.value}function PS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function c4(t,e,r,n){for(var i=e,s=",",o=[],a=e;_s(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=ff(t,i,r,n),l=PS(t,u.end);n&&o.push(u.value),i=l.end,s=l.value}return{start:e,end:i,value:o}}function l4(t,e){return t.substr(e,4)==="true"}function f4(t,e){return t.substr(e,5)==="false"}function h4(t,e){return t.substr(e,4)==="null"}var d4=new RegExp(/^\s$/);function _s(t){return d4.test(t)}var p4=new RegExp(/^\d$/);function NS(t){return p4.test(t)}function Gn(t,e,r){var n=10,i;t.length{"use strict";c();var g4=rn&&rn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=rn&&rn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4=rn&&rn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g4(e,t,r);return y4(e,t),e};Object.defineProperty(rn,"__esModule",{value:!0});rn.TypeExpressionParser=void 0;var FS=m4(Be()),w4=It(),E4=LS(),Im=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new FS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return E4.parse(r)}catch{throw new FS.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new w4.Type(e,n)}};rn.TypeExpressionParser=Im});var Tm=m(gi=>{"use strict";c();Object.defineProperty(gi,"__esModule",{value:!0});gi.EndpointParameterDefinition=gi.EndpointModifiers=gi.EndpointDefinition=void 0;var v4=hf(),MS="?",A4="N / A",Sm=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?MS:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Ou.fromJSON(s)),n=e.outputs.map(s=>Ou.fromJSON(s)),i=new df(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};gi.EndpointDefinition=Sm;var df=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};gi.EndpointModifiers=df;var Ou=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new v4.TypeExpressionParser().parse(e.type);return new t(e.name||MS,e.description||A4,r)}};gi.EndpointParameterDefinition=Ou});var So=m(ar=>{"use strict";c();var b4=ar&&ar.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_4=ar&&ar.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),I4=ar&&ar.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&b4(e,t,r);return _4(e,t),e};Object.defineProperty(ar,"__esModule",{value:!0});ar.Fields=ar.Field=ar.FieldDefinition=void 0;var Cm=I4(Be()),S4=hf(),xm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new S4.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};ar.FieldDefinition=xm;var Nm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Cm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Cm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};ar.Field=Nm;var Om=class{static checkTyping(e,r){if(e.length!=r.length)throw new Cm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";c();Object.defineProperty(yi,"__esModule",{value:!0});yi.EnumValue=yi.EnumVariantDefinition=yi.EnumType=void 0;var T4=Be(),Dm=wr(),pf=So(),qS=It(),US=256,gf=class t extends qS.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>yf.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Dm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Dm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};yi.EnumType=gf;gf.ClassName="EnumType";var yf=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Dm.guardTrue(rpf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return pf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};yi.EnumVariantDefinition=yf;var mf=class t extends qS.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();pf.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=pf.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new T4.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};yi.EnumValue=mf;mf.ClassName="EnumValue"});var Co=m(To=>{"use strict";c();Object.defineProperty(To,"__esModule",{value:!0});To.Struct=To.StructType=void 0;var C4=Be(),wf=So(),VS=It(),Ef=class t extends VS.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>wf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return wf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};To.StructType=Ef;Ef.ClassName="StructType";var vf=class t extends VS.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();wf.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new C4.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return wf.Fields.equals(r,n)}};To.Struct=vf;vf.ClassName="Struct"});var Rm=m((rse,kS)=>{"use strict";c();var bf="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Pm={};for(Pu=0;Pu>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function HS(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=xo(e)^n>>5}for(e=xo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=HS(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=xo(n)^o,i+=bf.charAt(o)}for(s=0;s<6;++s)n=xo(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=bf.charAt(a)}return i}function GS(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=HS(s);if(typeof a=="string")return a;for(var u=[],l=0;l=o.length)&&u.push(d)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function N4(){var t=GS.apply(null,arguments);if(typeof t=="object")return t}function O4(t){var e=GS.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function _f(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";c();var L4=nn&&nn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),F4=nn&&nn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jS=nn&&nn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&L4(e,t,r);return F4(e,t),e};Object.defineProperty(nn,"__esModule",{value:!0});nn.Address=void 0;var If=jS(Rm()),No=jS(Be()),Bm="erd",Lm=32,M4="0".repeat(16),Fm=class t{constructor(e){if(this.valueHex="",!!e){if(e instanceof t)return t.fromAddress(e);if(e instanceof h.Buffer)return t.fromBuffer(e);if(typeof e=="string")return t.fromString(e);throw new No.ErrAddressCannotCreate(e)}}static fromAddress(e){return t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Lm)throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(e.toString("hex"))}static fromString(e){return t.isValidHex(e)?t.fromValidHex(e):t.fromBech32(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==Lm}static fromHex(e){if(!t.isValidHex(e))throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=If.decode(e)}catch(s){throw new No.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Bm)throw new No.ErrAddressBadHrp(Bm,n);let i=h.Buffer.from(If.fromWords(r.words));if(i.length!=Lm)throw new No.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=If.toWords(this.pubkey());return If.encode(Bm,e)}pubkey(){return this.isEmpty()?h.Buffer.from([]):h.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(M4)}};nn.Address=Fm});var Do=m(Oo=>{"use strict";c();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.AddressValue=Oo.AddressType=void 0;var U4=ht(),QS=It(),Ru=class t extends QS.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Oo.AddressType=Ru;Ru.ClassName="AddressType";var Sf=class t extends QS.PrimitiveValue{constructor(e){super(new Ru),this.value=new U4.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Oo.AddressValue=Sf;Sf.ClassName="AddressValue"});var Cf=m(Po=>{"use strict";c();Object.defineProperty(Po,"__esModule",{value:!0});Po.OptionalValue=Po.OptionalType=void 0;var q4=wr(),Bu=It(),Lu=class t extends Bu.Type{constructor(e){super("Optional",[e],Bu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Bu.NullType.ClassName);return r||n}};Po.OptionalType=Lu;Lu.ClassName="OptionalType";var Tf=class t extends Bu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Lu(new Bu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return q4.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Po.OptionalValue=Tf;Tf.ClassName="OptionalValue"});var Mu=m(Ro=>{"use strict";c();Object.defineProperty(Ro,"__esModule",{value:!0});Ro.BooleanValue=Ro.BooleanType=void 0;var WS=It(),Fu=class t extends WS.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Ro.BooleanType=Fu;Fu.ClassName="BooleanType";var xf=class t extends WS.PrimitiveValue{constructor(e){super(new Fu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Ro.BooleanValue=xf;xf.ClassName="BooleanValue"});var mi=m(Bo=>{"use strict";c();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.BytesValue=Bo.BytesType=void 0;var $S=It(),Uu=class t extends $S.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Bo.BytesType=Uu;Uu.ClassName="BytesType";var Nf=class t extends $S.PrimitiveValue{constructor(e){super(new Uu),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=h.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=h.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Bo.BytesValue=Nf;Nf.ClassName="BytesValue"});var KS=m(Lo=>{"use strict";c();Object.defineProperty(Lo,"__esModule",{value:!0});Lo.CodeMetadataValue=Lo.CodeMetadataType=void 0;var zS=It(),Of=class extends zS.PrimitiveType{constructor(){super("CodeMetadata")}};Lo.CodeMetadataType=Of;var Mm=class extends zS.PrimitiveValue{constructor(e){super(new Of),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Lo.CodeMetadataValue=Mm});var Pf=m(Fo=>{"use strict";c();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.CompositeValue=Fo.CompositeType=void 0;var V4=wr(),Um=It(),qu=class t extends Um.Type{constructor(...e){super("Composite",e,Um.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Fo.CompositeType=qu;qu.ClassName="CompositeType";var Df=class t extends Um.TypedValue{constructor(e,r){super(e),V4.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new qu(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.CollectionOfTypedValues=void 0;var qm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";c();Object.defineProperty(sn,"__esModule",{value:!0});sn.List=sn.OptionValue=sn.ListType=sn.OptionType=void 0;var H4=wr(),G4=Vm(),Ss=It(),Is=class t extends Ss.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(Ss.NullType.ClassName);return r||n}};sn.OptionType=Is;Is.ClassName="OptionType";var Vu=class t extends Ss.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};sn.ListType=Vu;Vu.ClassName="ListType";var Bf=class t extends Ss.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Is(new Ss.NullType);return new t(e)}static newMissingTyped(e){return new t(new Is(e))}static newProvided(e){let r=new Is(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return H4.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};sn.OptionValue=Bf;Bf.ClassName="OptionValue";var Lf=class t extends Ss.TypedValue{constructor(e,r){super(e),this.backingCollection=new G4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new Ss.TypePlaceholder,[]);let r=e[0].getType(),n=new Vu(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};sn.List=Lf;Lf.ClassName="List"});var Uf=m(Mo=>{"use strict";c();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.ArrayVec=Mo.ArrayVecType=void 0;var YS=wr(),k4=Vm(),JS=It(),Ff=class t extends JS.Type{constructor(e,r){super("Array",[r]),YS.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Mo.ArrayVecType=Ff;Ff.ClassName="ArrayVecType";var Mf=class t extends JS.TypedValue{constructor(e,r){super(e),YS.guardLength(r,e.length),this.backingCollection=new k4.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Mo.ArrayVec=Mf;Mf.ClassName="ArrayVec"});var ku=m(Uo=>{"use strict";c();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.H256Value=Uo.H256Type=void 0;var XS=It(),Gu=class t extends XS.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Uo.H256Type=Gu;Gu.ClassName="H256Type";var qf=class t extends XS.PrimitiveValue{constructor(e){super(new Gu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Uo.H256Value=qf;qf.ClassName="H256Value"});var Hf=m(qo=>{"use strict";c();Object.defineProperty(qo,"__esModule",{value:!0});qo.NothingValue=qo.NothingType=void 0;var ZS=It(),ju=class t extends ZS.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};qo.NothingType=ju;ju.ClassName="NothingType";var Vf=class t extends ZS.PrimitiveValue{constructor(){super(new ju)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};qo.NothingValue=Vf;Vf.ClassName="NothingValue"});var tc=m(Ie=>{"use strict";c();var j4=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Q4=Ie&&Ie.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),W4=Ie&&Ie.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&j4(e,t,r);return Q4(e,t),e},$4=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.BigIntValue=Ie.BigUIntValue=Ie.I64Value=Ie.U64Value=Ie.I32Value=Ie.U32Value=Ie.I16Value=Ie.U16Value=Ie.I8Value=Ie.U8Value=Ie.NumericalValue=Ie.BigIntType=Ie.BigUIntType=Ie.I64Type=Ie.U64Type=Ie.I32Type=Ie.U32Type=Ie.I16Type=Ie.U16Type=Ie.I8Type=Ie.U8Type=Ie.NumericalType=void 0;var eT=W4(Be()),tT=It(),Ts=$4(Gt()),ur=class t extends tT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ie.NumericalType=ur;ur.ClassName="NumericalType";var Qu=class t extends ur{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};Ie.U8Type=Qu;Qu.ClassName="U8Type";var Wu=class t extends ur{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};Ie.I8Type=Wu;Wu.ClassName="I8Type";var $u=class t extends ur{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};Ie.U16Type=$u;$u.ClassName="U16Type";var zu=class t extends ur{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};Ie.I16Type=zu;zu.ClassName="I16Type";var Ku=class t extends ur{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};Ie.U32Type=Ku;Ku.ClassName="U32Type";var Yu=class t extends ur{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};Ie.I32Type=Yu;Yu.ClassName="I32Type";var Ju=class t extends ur{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};Ie.U64Type=Ju;Ju.ClassName="U64Type";var Xu=class t extends ur{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};Ie.I64Type=Xu;Xu.ClassName="I64Type";var Zu=class t extends ur{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};Ie.BigUIntType=Zu;Zu.ClassName="BigUIntType";var ec=class t extends ur{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};Ie.BigIntType=ec;ec.ClassName="BigIntType";var cr=class t extends tT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ts.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new eT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new eT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ie.NumericalValue=cr;cr.ClassName="NumericalValue";var Gf=class t extends cr{constructor(e){super(new Qu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U8Value=Gf;Gf.ClassName="U8Value";var kf=class t extends cr{constructor(e){super(new Wu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I8Value=kf;kf.ClassName="I8Value";var jf=class t extends cr{constructor(e){super(new $u,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U16Value=jf;jf.ClassName="U16Value";var Qf=class t extends cr{constructor(e){super(new zu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I16Value=Qf;Qf.ClassName="I16Value";var Wf=class t extends cr{constructor(e){super(new Ku,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.U32Value=Wf;Wf.ClassName="U32Value";var $f=class t extends cr{constructor(e){super(new Yu,new Ts.default(e))}getClassName(){return t.ClassName}};Ie.I32Value=$f;$f.ClassName="I32Value";var zf=class t extends cr{constructor(e){super(new Ju,e)}getClassName(){return t.ClassName}};Ie.U64Value=zf;zf.ClassName="U64Value";var Kf=class t extends cr{constructor(e){super(new Xu,e)}getClassName(){return t.ClassName}};Ie.I64Value=Kf;Kf.ClassName="I64Value";var Yf=class t extends cr{constructor(e){super(new Zu,e)}getClassName(){return t.ClassName}};Ie.BigUIntValue=Yf;Yf.ClassName="BigUIntValue";var Jf=class t extends cr{constructor(e){super(new ec,e)}getClassName(){return t.ClassName}};Ie.BigIntValue=Jf;Jf.ClassName="BigIntValue"});var Zf=m(Vo=>{"use strict";c();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.StringValue=Vo.StringType=void 0;var rT=It(),rc=class t extends rT.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};Vo.StringType=rc;rc.ClassName="StringType";var Xf=class t extends rT.PrimitiveValue{constructor(e){super(new rc),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=h.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};Vo.StringValue=Xf;Xf.ClassName="StringValue"});var Go=m(Ho=>{"use strict";c();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.TokenIdentifierValue=Ho.TokenIdentifierType=void 0;var nT=It(),z4="EGLD",nc=class t extends nT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Ho.TokenIdentifierType=nc;nc.ClassName="TokenIdentifierType";var eh=class t extends nT.PrimitiveValue{constructor(e){super(new nc),this.value=e}static egld(){return new t(z4)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};Ho.TokenIdentifierValue=eh;eh.ClassName="TokenIdentifierValue"});var rh=m(Tr=>{"use strict";c();var K4=Tr&&Tr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Y4=Tr&&Tr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),J4=Tr&&Tr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&K4(e,t,r);return Y4(e,t),e};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.Tuple=Tr.TupleType=void 0;var X4=J4(Be()),iT=So(),sT=Co(),ic=class t extends sT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new iT.FieldDefinition(oT(i),"anonymous tuple field",n))}};Tr.TupleType=ic;ic.ClassName="TupleType";function oT(t){return`field${t}`}var th=class t extends sT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new X4.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new ic(...r),i=e.map((s,o)=>new iT.Field(s,oT(o)));return new t(n,i)}};Tr.Tuple=th;th.ClassName="Tuple"});var sh=m(wi=>{"use strict";c();Object.defineProperty(wi,"__esModule",{value:!0});wi.VariadicValue=wi.CountedVariadicType=wi.VariadicType=void 0;var ko=It(),Cs=class t extends ko.Type{constructor(e,r=!1){super("Variadic",[e],ko.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};wi.VariadicType=Cs;Cs.ClassName="VariadicType";var nh=class extends ko.Type{constructor(e){super("Variadic",[e],ko.TypeCardinality.variable())}getClassName(){return Cs.ClassName}};wi.CountedVariadicType=nh;nh.ClassName="VariadicType";var ih=class t extends ko.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Cs(new ko.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Cs(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";c();var Z4=on&&on.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),eq=on&&on.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),tq=on&&on.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Z4(e,t,r);return eq(e,t),e};Object.defineProperty(on,"__esModule",{value:!0});on.TypeMapper=void 0;var aT=tq(Be()),rq=Do(),Hm=Cf(),nq=Mu(),iq=mi(),sq=KS(),oh=Pf(),Gm=Du(),oq=So(),uT=Hu(),kn=Uf(),aq=ku(),cT=Hf(),Cr=tc(),uq=Zf(),lT=Co(),fT=Go(),Ei=rh(),ah=sh(),km=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new uT.OptionType(r[0])],["List",(...r)=>new uT.ListType(r[0])],["VarArgs",(...r)=>new ah.VariadicType(r[0])],["MultiResultVec",(...r)=>new ah.VariadicType(r[0])],["variadic",(...r)=>new ah.VariadicType(r[0])],["counted-variadic",(...r)=>new ah.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new Hm.OptionalType(r[0])],["optional",(...r)=>new Hm.OptionalType(r[0])],["OptionalResult",(...r)=>new Hm.OptionalType(r[0])],["multi",(...r)=>new oh.CompositeType(...r)],["MultiArg",(...r)=>new oh.CompositeType(...r)],["MultiResult",(...r)=>new oh.CompositeType(...r)],["multi",(...r)=>new oh.CompositeType(...r)],["tuple",(...r)=>new Ei.TupleType(...r)],["tuple2",(...r)=>new Ei.TupleType(...r)],["tuple3",(...r)=>new Ei.TupleType(...r)],["tuple4",(...r)=>new Ei.TupleType(...r)],["tuple5",(...r)=>new Ei.TupleType(...r)],["tuple6",(...r)=>new Ei.TupleType(...r)],["tuple7",(...r)=>new Ei.TupleType(...r)],["tuple8",(...r)=>new Ei.TupleType(...r)],["array2",(...r)=>new kn.ArrayVecType(2,r[0])],["array8",(...r)=>new kn.ArrayVecType(8,r[0])],["array16",(...r)=>new kn.ArrayVecType(16,r[0])],["array20",(...r)=>new kn.ArrayVecType(20,r[0])],["array32",(...r)=>new kn.ArrayVecType(32,r[0])],["array46",(...r)=>new kn.ArrayVecType(46,r[0])],["array64",(...r)=>new kn.ArrayVecType(64,r[0])],["array128",(...r)=>new kn.ArrayVecType(128,r[0])],["array256",(...r)=>new kn.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new Cr.U8Type],["u16",new Cr.U16Type],["u32",new Cr.U32Type],["u64",new Cr.U64Type],["U64",new Cr.U64Type],["BigUint",new Cr.BigUIntType],["i8",new Cr.I8Type],["i16",new Cr.I16Type],["i32",new Cr.I32Type],["i64",new Cr.I64Type],["Bigint",new Cr.BigIntType],["BigInt",new Cr.BigIntType],["bool",new nq.BooleanType],["bytes",new iq.BytesType],["Address",new rq.AddressType],["H256",new aq.H256Type],["utf-8 string",new uq.StringType],["TokenIdentifier",new fT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new fT.TokenIdentifierType],["CodeMetadata",new sq.CodeMetadataType],["nothing",new cT.NothingType],["AsyncCall",new cT.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new aT.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass(Gm.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(lT.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new lT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new Gm.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new Gm.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new oq.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new aT.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};on.TypeMapper=km});var yT=m(an=>{"use strict";c();var cq=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),lq=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),fq=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&cq(e,t,r);return lq(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.AbiRegistry=void 0;var hT=fq(Be()),Qm=wr(),sc=Tm(),dT=Du(),pT=Co(),hq=jm(),dq="?",Wm=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes}static create(e){let r=e.name||dq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=sc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),a=i.map(d=>sc.EndpointDefinition.fromJSON(d)),u=[];for(let d in s){let g=s[d];if(g.type=="struct")u.push(pT.StructType.fromJSON({name:d,fields:g.fields}));else if(g.type=="enum")u.push(dT.EnumType.fromJSON({name:d,variants:g.variants}));else throw new hT.ErrTypingSystem(`Cannot handle custom type: ${d}`)}return new t({name:r,constructorDefinition:o,endpoints:a,customTypes:u}).remapToKnownTypes()}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(pT.StructType.ClassName));return Qm.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(dT.EnumType.ClassName));return Qm.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return Qm.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}remapToKnownTypes(){let e=new hq.TypeMapper([]),r=[];for(let o of this.customTypes)this.mapCustomTypeDepthFirst(o,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new hT.ErrTypingSystem("Did not re-map all custom types");let n=gT(this.constructorDefinition,e),i=[];for(let o of this.endpoints)i.push(gT(o,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(l=>l.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};an.AbiRegistry=Wm;function gT(t,e){let r=t.input.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new sc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new sc.EndpointDefinition(t.name,r,n,t.modifiers)}});var wT=m(jo=>{"use strict";c();Object.defineProperty(jo,"__esModule",{value:!0});jo.createListOfTokenIdentifiers=jo.createListOfAddresses=void 0;var pq=Do(),mT=Hu(),gq=Go();function yq(t){let e=t.map(n=>new pq.AddressValue(n));return mT.List.fromItems(e)}jo.createListOfAddresses=yq;function mq(t){let e=t.map(n=>new gq.TokenIdentifierValue(n));return mT.List.fromItems(e)}jo.createListOfTokenIdentifiers=mq});var PT=m(zt=>{"use strict";c();var wq=zt&&zt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Eq=zt&&zt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vq=zt&&zt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&wq(e,t,r);return Eq(e,t),e};Object.defineProperty(zt,"__esModule",{value:!0});zt.onPrimitiveTypeSelect=zt.onPrimitiveValueSelect=zt.onTypedValueSelect=zt.onTypeSelect=void 0;var ch=vq(Be()),ET=Do(),vT=Mu(),AT=mi(),bT=Du(),uh=Hu(),_T=ku(),IT=tc(),ST=Hf(),TT=Co(),CT=Go(),xT=rh(),NT=It(),OT=Uf(),DT=Zf();function Aq(t,e){if(t.hasExactClass(uh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(uh.ListType.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(NT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(TT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(xT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't known: ${t}`)}zt.onTypeSelect=Aq;function bq(t,e){if(t.hasClassOrSuperclass(NT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(uh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(uh.List.ClassName))return e.onList();if(t.hasExactClass(OT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(TT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(xT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(bT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't typed: ${t}`)}zt.onTypedValueSelect=bq;function _q(t,e){if(t.hasExactClass(vT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringValue.ClassName))return e.onString();if(t.hasExactClass(_T.H256Value.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(ST.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}zt.onPrimitiveValueSelect=_q;function Iq(t,e){if(t.hasExactClass(vT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(IT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(ET.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(AT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass(DT.StringType.ClassName))return e.onString();if(t.hasExactClass(_T.H256Type.ClassName))return e.onH256();if(t.hasExactClass(CT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(ST.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new ch.ErrTypingSystem(`type isn't a known primitive: ${t}`)}zt.onPrimitiveTypeSelect=Iq});var St=m(qe=>{"use strict";c();var Sq=qe&&qe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Sq(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(yT(),qe);it(Do(),qe);it(Cf(),qe);it(Mu(),qe);it(mi(),qe);it(Pf(),qe);it(Tm(),qe);it(Du(),qe);it(wT(),qe);it(So(),qe);it(Hu(),qe);it(Uf(),qe);it(ku(),qe);it(PT(),qe);it(Hf(),qe);it(tc(),qe);it(Zf(),qe);it(Co(),qe);it(Go(),qe);it(rh(),qe);it(hf(),qe);it(jm(),qe);it(It(),qe);it(sh(),qe)});var BT=m(un=>{"use strict";c();var Tq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Cq=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xq=un&&un.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Tq(e,t,r);return Cq(e,t),e};Object.defineProperty(un,"__esModule",{value:!0});un.OptionValueBinaryCodec=void 0;var RT=xq(Be()),lh=St(),$m=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[lh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[lh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new lh.OptionValue(r);if(e[0]!=1)throw new RT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new lh.OptionValue(r,n)}encodeNested(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?h.Buffer.concat([h.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):h.Buffer.from([])}};un.OptionValueBinaryCodec=$m});var LT=m(fh=>{"use strict";c();Object.defineProperty(fh,"__esModule",{value:!0});fh.AddressBinaryCodec=void 0;var Nq=ht(),Oq=St(),zm=class{decodeNested(e){let r=e.slice(0,32),n=new Nq.Address(r);return[new Oq.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};fh.AddressBinaryCodec=zm});var MT=m(cn=>{"use strict";c();var Dq=cn&&cn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Pq=cn&&cn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Rq=cn&&cn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Dq(e,t,r);return Pq(e,t),e};Object.defineProperty(cn,"__esModule",{value:!0});cn.BooleanBinaryCodec=void 0;var Bq=Rq(Be()),FT=St(),oc=class t{decodeNested(e){let r=e.readUInt8(0);return[new FT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new Bq.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new FT.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?h.Buffer.from([t.TRUE]):h.Buffer.from([])}};cn.BooleanBinaryCodec=oc;oc.TRUE=1;oc.FALSE=0});var dh=m(hh=>{"use strict";c();Object.defineProperty(hh,"__esModule",{value:!0});hh.SizeOfU32=void 0;hh.SizeOfU32=4});var ph=m(ln=>{"use strict";c();var Lq=ln&&ln.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ln,"__esModule",{value:!0});ln.zeroPadStringIfOddLength=ln.isPaddedHex=ln.numberToPaddedHex=void 0;var Fq=Lq(Gt());function Mq(t){let e=new Fq.default(t).toString(16);return UT(e)}ln.numberToPaddedHex=Mq;function Uq(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}ln.isPaddedHex=Uq;function UT(t){return t=t||"",t.length%2==1?"0"+t:t}ln.zeroPadStringIfOddLength=UT});var ac=m(Tt=>{"use strict";c();var qq=Tt&&Tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.prependByteToBuffer=Tt.flipBufferBitsInPlace=Tt.getHexMagnitudeOfBigInt=Tt.bigIntToBuffer=Tt.bufferToBigInt=Tt.cloneBuffer=Tt.isMsbZero=Tt.isMsbOne=void 0;var Km=qq(Gt()),Vq=ph();function qT(t,e=0){return t[e]>>7==1}Tt.isMsbOne=qT;function Hq(t,e=0){return!qT(t,e)}Tt.isMsbZero=Hq;function Gq(t){let e=h.Buffer.alloc(t.length);return t.copy(e),e}Tt.cloneBuffer=Gq;function kq(t){let e=t.toString("hex");return new Km.default(`0x${e}`,16)}Tt.bufferToBigInt=kq;function jq(t){let e=VT(t);return h.Buffer.from(e,"hex")}Tt.bigIntToBuffer=jq;function VT(t){return t=new Km.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new Km.default(-1))),Vq.numberToPaddedHex(t)):""}Tt.getHexMagnitudeOfBigInt=VT;function Qq(t){for(let e=0;e{"use strict";c();var $q=Qo&&Qo.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.NumericalBinaryCodec=void 0;var uc=$q(Gt()),Ym=St(),HT=dh(),wt=ac(),Jm=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=HT.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=wt.cloneBuffer(e);if(e.length==0)return new Ym.NumericalValue(r,new uc.default(0));if(!r.withSign||wt.isMsbZero(n)){let l=wt.bufferToBigInt(n);return new Ym.NumericalValue(r,l)}wt.flipBufferBitsInPlace(n);let u=wt.bufferToBigInt(n).multipliedBy(new uc.default(-1)).minus(new uc.default(1));return new Ym.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=h.Buffer.alloc(HT.SizeOfU32);return n.writeUInt32BE(r.length),h.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return h.Buffer.alloc(r,0);if(!e.withSign){let o=wt.bigIntToBuffer(e.value),a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}if(e.value.isPositive()){let o=wt.bigIntToBuffer(e.value);wt.isMsbOne(o)&&(o=wt.prependByteToBuffer(o,0));let a=h.Buffer.alloc(r-o.length,0);return h.Buffer.concat([a,o])}let n=e.value.plus(new uc.default(1)),i=wt.bigIntToBuffer(n);wt.flipBufferBitsInPlace(i),wt.isMsbZero(i)&&(i=wt.prependByteToBuffer(i,255));let s=h.Buffer.alloc(r-i.length,255);return h.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?h.Buffer.alloc(0):r?this.encodePrimitive(e):wt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=wt.bigIntToBuffer(e.value);return wt.isMsbOne(i)&&(i=wt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new uc.default(1)),n=wt.bigIntToBuffer(r);return wt.flipBufferBitsInPlace(n),wt.isMsbZero(n)&&(n=wt.prependByteToBuffer(n,255)),n}};Qo.NumericalBinaryCodec=Jm});var kT=m(gh=>{"use strict";c();Object.defineProperty(gh,"__esModule",{value:!0});gh.H256BinaryCodec=void 0;var zq=ku(),Xm=class{decodeNested(e){let r=e.slice(0,32);return[new zq.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};gh.H256BinaryCodec=Xm});var wh=m(mh=>{"use strict";c();Object.defineProperty(mh,"__esModule",{value:!0});mh.BytesBinaryCodec=void 0;var jT=mi(),yh=dh(),Zm=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(yh.SizeOfU32,yh.SizeOfU32+r);return[new jT.BytesValue(n),yh.SizeOfU32+r]}decodeTopLevel(e){return new jT.BytesValue(e)}encodeNested(e){let r=h.Buffer.alloc(yh.SizeOfU32);return r.writeUInt32BE(e.getLength()),h.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};mh.BytesBinaryCodec=Zm});var WT=m(Eh=>{"use strict";c();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.TokenIdentifierCodec=void 0;var Kq=mi(),QT=Go(),Yq=wh(),ew=class{constructor(){this.bytesCodec=new Yq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new QT.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new QT.TokenIdentifierValue(r.toString())}encodeNested(e){let r=Kq.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Eh.TokenIdentifierCodec=ew});var zT=m(vh=>{"use strict";c();Object.defineProperty(vh,"__esModule",{value:!0});vh.NothingCodec=void 0;var $T=St(),tw=class{decodeNested(){return[new $T.NothingValue,0]}decodeTopLevel(){return new $T.NothingValue}encodeNested(){return h.Buffer.from([])}encodeTopLevel(){return h.Buffer.from([])}};vh.NothingCodec=tw});var YT=m(Ah=>{"use strict";c();Object.defineProperty(Ah,"__esModule",{value:!0});Ah.StringBinaryCodec=void 0;var KT=St(),Jq=mi(),Xq=wh(),rw=class{constructor(){this.bytesBinaryCodec=new Xq.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new KT.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new KT.StringValue(e.toString())}encodeNested(e){let r=Jq.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return h.Buffer.from(e.valueOf())}};Ah.StringBinaryCodec=rw});var JT=m(_h=>{"use strict";c();Object.defineProperty(_h,"__esModule",{value:!0});_h.PrimitiveBinaryCodec=void 0;var bh=St(),Zq=LT(),eV=MT(),tV=GT(),rV=kT(),nV=wh(),iV=WT(),sV=zT(),oV=YT(),nw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new eV.BooleanBinaryCodec,this.numericalCodec=new tV.NumericalBinaryCodec,this.addressCodec=new Zq.AddressBinaryCodec,this.h256Codec=new rV.H256BinaryCodec,this.bytesCodec=new nV.BytesBinaryCodec,this.stringCodec=new oV.StringBinaryCodec,this.tokenIdentifierCodec=new iV.TokenIdentifierCodec,this.nothingCodec=new sV.NothingCodec}decodeNested(e,r){return bh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return bh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return bh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return bh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};_h.PrimitiveBinaryCodec=nw});var eC=m(Ih=>{"use strict";c();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.ListBinaryCodec=void 0;var XT=St(),ZT=dh(),iw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=ZT.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new XT.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=h.Buffer.alloc(ZT.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return h.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return h.Buffer.concat(r)}};Ih.ListBinaryCodec=iw});var ow=m(Sh=>{"use strict";c();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.FieldsBinaryCodec=void 0;var aV=St(),sw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new aV.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return h.Buffer.concat(r)}};Sh.FieldsBinaryCodec=sw});var uw=m(Th=>{"use strict";c();Object.defineProperty(Th,"__esModule",{value:!0});Th.StructBinaryCodec=void 0;var uV=St(),cV=ow(),aw=class{constructor(e){this.fieldsCodec=new cV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new uV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Th.StructBinaryCodec=aw});var tC=m(xh=>{"use strict";c();Object.defineProperty(xh,"__esModule",{value:!0});xh.EnumBinaryCodec=void 0;var Ch=St(),lV=ow(),cw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new lV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Ch.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Ch.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Ch.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return h.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Ch.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return h.Buffer.concat([o,i])}};xh.EnumBinaryCodec=cw});var rC=m(Nh=>{"use strict";c();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.TupleBinaryCodec=void 0;var fV=uw(),lw=class{constructor(e){this.structCodec=new fV.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Nh.TupleBinaryCodec=lw});var nC=m(Oh=>{"use strict";c();Object.defineProperty(Oh,"__esModule",{value:!0});Oh.ArrayVecBinaryCodec=void 0;var hV=St(),fw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";c();var dV=xr&&xr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),pV=xr&&xr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),gV=xr&&xr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&dV(e,t,r);return pV(e,t),e};Object.defineProperty(xr,"__esModule",{value:!0});xr.BinaryCodecConstraints=xr.BinaryCodec=void 0;var iC=gV(Be()),Dh=St(),sC=wr(),yV=BT(),mV=JT(),wV=eC(),EV=uw(),vV=tC(),AV=rC(),bV=nC(),hw=class{constructor(e=null){this.constraints=e||new Ph,this.optionCodec=new yV.OptionValueBinaryCodec(this),this.listCodec=new wV.ListBinaryCodec(this),this.arrayCodec=new bV.ArrayVecBinaryCodec(this),this.primitiveCodec=new mV.PrimitiveBinaryCodec(this),this.structCodec=new EV.StructBinaryCodec(this),this.tupleCodec=new AV.TupleBinaryCodec(this),this.enumCodec=new vV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),Dh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=Dh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return sC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Dh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};xr.BinaryCodec=hw;var Ph=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new iC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new iC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};xr.BinaryCodecConstraints=Ph});var oC=m(Nr=>{"use strict";c();var _V=Nr&&Nr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.decodeBigNumber=Nr.decodeString=Nr.decodeBool=Nr.decodeUnsignedNumber=void 0;var IV=_V(Gt()),Rh=St(),SV=dw(),Bh=new SV.BinaryCodec;function TV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return Number(e.valueOf())}Nr.decodeUnsignedNumber=TV;function CV(t){return!!Bh.decodeTopLevel(t,new Rh.BooleanType).valueOf()}Nr.decodeBool=CV;function xV(t){let e=Bh.decodeTopLevel(t,new Rh.BytesType);return String(e.valueOf())}Nr.decodeString=xV;function NV(t){let e=Bh.decodeTopLevel(t,new Rh.BigUIntType);return new IV.default(e.valueOf())}Nr.decodeBigNumber=NV});var pw=m(vi=>{"use strict";c();var OV=vi&&vi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aC=vi&&vi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&OV(e,t,r)};Object.defineProperty(vi,"__esModule",{value:!0});aC(dw(),vi);aC(oC(),vi)});var Wo=m(Lh=>{"use strict";c();Object.defineProperty(Lh,"__esModule",{value:!0});Lh.ArgSerializer=void 0;var uC=bs(),DV=pw(),cC=St(),gw=Cf(),yw=Pf(),mw=sh(),PV={codec:new DV.BinaryCodec},ww=class{constructor(e){e=Object.assign(Object.assign({},PV),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(uC.ARGUMENTS_SEPARATOR).map(r=>h.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let d=0;d=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(uC.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(gw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(mw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(yw.CompositeValue.ClassName)){let u=o;for(let l of u.getItems())i(l);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new cC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};Lh.ArgSerializer=ww});var Uh=m(Mh=>{"use strict";c();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.Compatibility=void 0;var RV=ht(),Fh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==RV.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};Mh.Compatibility=Fh;Fh.areWarningsEnabled=!0});var lC=m(fn=>{"use strict";c();var BV=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),LV=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),FV=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&BV(e,t,r);return LV(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.Hash=void 0;var MV=FV(Be()),Ew=class t{constructor(e){if(!e)this.hash=h.Buffer.from([]);else if(e instanceof h.Buffer)this.hash=e;else if(typeof e=="string")this.hash=h.Buffer.from(e,"hex");else throw new MV.ErrBadType("hash","buffer | string",e)}static empty(){return new t(h.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};fn.Hash=Ew});var cc=m(Or=>{"use strict";c();var UV=Or&&Or.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qV=Or&&Or.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VV=Or&&Or.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UV(e,t,r);return qV(e,t),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.TransactionOptions=Or.TransactionVersion=void 0;var jr=bs(),fC=VV(Be()),vw=class t{constructor(e){if(e=Number(e),e<1)throw new fC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(jr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(jr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Or.TransactionVersion=vw;var Aw=class t{constructor(e){if(e=Number(e),e<0)throw new fC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(jr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=jr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&jr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&jr.TRANSACTION_OPTIONS_TX_GUARDED)==jr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=jr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=jr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Or.TransactionOptions=Aw});var dC=m((Woe,hC)=>{"use strict";c();hC.exports=HV;function HV(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";c();var qh=yC;qh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var $o=new Array(64),gC=new Array(123);for(Qr=0;Qr<64;)gC[$o[Qr]=Qr<26?Qr+65:Qr<52?Qr+71:Qr<62?Qr-4:Qr-59|43]=Qr++;var Qr;qh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(l&3)<<4,a=1;break;case 1:s[o++]=$o[u|l>>4],u=(l&15)<<2,a=2;break;case 2:s[o++]=$o[u|l>>6],s[o++]=$o[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=$o[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var pC="invalid encoding";qh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=gC[u])===void 0)throw Error(pC);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(pC);return n-i};qh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var EC=m((Yoe,wC)=>{"use strict";c();wC.exports=Vh;function Vh(){this._listeners={}}Vh.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};Vh.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";c();SC.exports=vC(vC);function vC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3]}function s(u,l,f){e[0]=u,l[f]=r[3],l[f+1]=r[2],l[f+2]=r[1],l[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],e[0]}function a(u,l){return r[3]=u[l],r[2]=u[l+1],r[1]=u[l+2],r[0]=u[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,AC),t.writeFloatBE=e.bind(null,bC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,l=o&8388607;return u===255?l?NaN:a*(1/0):u===0?a*1401298464324817e-60*l:a*Math.pow(2,u-150)*(l+8388608)}t.readFloatLE=r.bind(null,_C),t.readFloatBE=r.bind(null,IC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,l,f){e[0]=u,l[f]=r[0],l[f+1]=r[1],l[f+2]=r[2],l[f+3]=r[3],l[f+4]=r[4],l[f+5]=r[5],l[f+6]=r[6],l[f+7]=r[7]}function s(u,l,f){e[0]=u,l[f]=r[7],l[f+1]=r[6],l[f+2]=r[5],l[f+3]=r[4],l[f+4]=r[3],l[f+5]=r[2],l[f+6]=r[1],l[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,l){return r[0]=u[l],r[1]=u[l+1],r[2]=u[l+2],r[3]=u[l+3],r[4]=u[l+4],r[5]=u[l+5],r[6]=u[l+6],r[7]=u[l+7],e[0]}function a(u,l){return r[7]=u[l],r[6]=u[l+1],r[5]=u[l+2],r[4]=u[l+3],r[3]=u[l+4],r[2]=u[l+5],r[1]=u[l+6],r[0]=u[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((l<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((l<<31|f/4294967296)>>>0,a,u+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),f=o*Math.pow(2,-d),n(f*4503599627370496>>>0,a,u+i),n((l<<31|d+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,AC,0,4),t.writeDoubleBE=e.bind(null,bC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),l=n(o,a+s),f=(l>>31)*2+1,d=l>>>20&2047,g=4294967296*(l&1048575)+u;return d===2047?g?NaN:f*(1/0):d===0?f*5e-324*g:f*Math.pow(2,d-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,_C,0,4),t.readDoubleBE=r.bind(null,IC,4,0)}(),t}function AC(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function bC(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function _C(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function IC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var CC=m((exports,module)=>{"use strict";c();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var NC=m(xC=>{"use strict";c();var bw=xC;bw.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};bw.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var DC=m((nae,OC)=>{"use strict";c();OC.exports=GV;function GV(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var l=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),l}}});var RC=m((sae,PC)=>{"use strict";c();PC.exports=Bt;var lc=bi();function Bt(t,e){this.lo=t>>>0,this.hi=e>>>0}var xs=Bt.zero=new Bt(0,0);xs.toNumber=function(){return 0};xs.zzEncode=xs.zzDecode=function(){return this};xs.length=function(){return 1};var kV=Bt.zeroHash="\0\0\0\0\0\0\0\0";Bt.fromNumber=function(e){if(e===0)return xs;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Bt(n,i)};Bt.from=function(e){if(typeof e=="number")return Bt.fromNumber(e);if(lc.isString(e))if(lc.Long)e=lc.Long.fromString(e);else return Bt.fromNumber(parseInt(e,10));return e.low||e.high?new Bt(e.low>>>0,e.high>>>0):xs};Bt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Bt.prototype.toLong=function(e){return lc.Long?new lc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var Ai=String.prototype.charCodeAt;Bt.fromHash=function(e){return e===kV?xs:new Bt((Ai.call(e,0)|Ai.call(e,1)<<8|Ai.call(e,2)<<16|Ai.call(e,3)<<24)>>>0,(Ai.call(e,4)|Ai.call(e,5)<<8|Ai.call(e,6)<<16|Ai.call(e,7)<<24)>>>0)};Bt.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Bt.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Bt.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Bt.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var bi=m(_w=>{"use strict";c();var Ee=_w;Ee.asPromise=dC();Ee.base64=mC();Ee.EventEmitter=EC();Ee.float=TC();Ee.inquire=CC();Ee.utf8=NC();Ee.pool=DC();Ee.LongBits=RC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||_w;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function BC(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";c();qC.exports=Fe;var Dr=bi(),Iw,Hh=Dr.LongBits,FC=Dr.base64,MC=Dr.utf8;function fc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Tw(){}function jV(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Fe(){this.len=0,this.head=new fc(Tw,0,0),this.tail=this.head,this.states=null}var UC=function(){return Dr.Buffer?function(){return(Fe.create=function(){return new Iw})()}:function(){return new Fe}};Fe.create=UC();Fe.alloc=function(e){return new Dr.Array(e)};Dr.Array!==Array&&(Fe.alloc=Dr.pool(Fe.alloc,Dr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new fc(e,r,n),this.len+=r,this};function Cw(t,e,r){e[r]=t&255}function QV(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function xw(t,e){this.len=t,this.next=void 0,this.val=e}xw.prototype=Object.create(fc.prototype);xw.prototype.fn=QV;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new xw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Fe.prototype.int32=function(e){return e<0?this._push(Nw,10,Hh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Nw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Fe.prototype.uint64=function(e){var r=Hh.from(e);return this._push(Nw,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Hh.from(e).zzEncode();return this._push(Nw,r.length(),r)};Fe.prototype.bool=function(e){return this._push(Cw,1,e?1:0)};function Sw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Fe.prototype.fixed32=function(e){return this._push(Sw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Hh.from(e);return this._push(Sw,4,r.lo)._push(Sw,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(Dr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(Dr.float.writeDoubleLE,8,e)};var WV=Dr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Cw,1,0);if(Dr.isString(e)){var n=Fe.alloc(r=FC.length(e));FC.decode(e,n,0),e=n}return this.uint32(r)._push(WV,r,e)};Fe.prototype.string=function(e){var r=MC.length(e);return r?this.uint32(r)._push(MC.write,r,e):this._push(Cw,1,0)};Fe.prototype.fork=function(){return this.states=new jV(this),this.head=this.tail=new fc(Tw,0,0),this.len=0,this};Fe.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new fc(Tw,0,0),this.len=0),this};Fe.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Fe.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Fe._configure=function(t){Iw=t,Fe.create=UC(),Iw._configure()}});var GC=m((fae,HC)=>{"use strict";c();HC.exports=hn;var VC=Ow();(hn.prototype=Object.create(VC.prototype)).constructor=hn;var _i=bi();function hn(){VC.call(this)}hn._configure=function(){hn.alloc=_i._Buffer_allocUnsafe,hn.writeBytesBuffer=_i.Buffer&&_i.Buffer.prototype instanceof Uint8Array&&_i.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(hn.writeBytesBuffer,r,e),this};function $V(t,e,r){t.length<40?_i.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}hn.prototype.string=function(e){var r=_i.Buffer.byteLength(e);return this.uint32(r),r&&this._push($V,r,e),this};hn._configure()});var Rw=m((dae,$C)=>{"use strict";c();$C.exports=Et;var dn=bi(),Pw,QC=dn.LongBits,zV=dn.utf8;function Wr(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Et(t){this.buf=t,this.pos=0,this.len=t.length}var kC=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Et(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Et(e);throw Error("illegal buffer")},WC=function(){return dn.Buffer?function(r){return(Et.create=function(i){return dn.Buffer.isBuffer(i)?new Pw(i):kC(i)})(r)}:kC};Et.create=WC();Et.prototype._slice=dn.Array.prototype.subarray||dn.Array.prototype.slice;Et.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Wr(this,10);return e}}();Et.prototype.int32=function(){return this.uint32()|0};Et.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Dw(){var t=new QC(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Wr(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Wr(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Et.prototype.bool=function(){return this.uint32()!==0};function Gh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Et.prototype.fixed32=function(){if(this.pos+4>this.len)throw Wr(this,4);return Gh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Wr(this,4);return Gh(this.buf,this.pos+=4)|0};function jC(){if(this.pos+8>this.len)throw Wr(this,8);return new QC(Gh(this.buf,this.pos+=4),Gh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw Wr(this,4);var e=dn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw Wr(this,4);var e=dn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Et.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Wr(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};Et.prototype.string=function(){var e=this.bytes();return zV.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Wr(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Wr(this);while(this.buf[this.pos++]&128);return this};Et.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Et._configure=function(t){Pw=t,Et.create=WC(),Pw._configure();var e=dn.Long?"toLong":"toNumber";dn.merge(Et.prototype,{int64:function(){return Dw.call(this)[e](!1)},uint64:function(){return Dw.call(this)[e](!0)},sint64:function(){return Dw.call(this).zzDecode()[e](!1)},fixed64:function(){return jC.call(this)[e](!0)},sfixed64:function(){return jC.call(this)[e](!1)}})}});var JC=m((gae,YC)=>{"use strict";c();YC.exports=Ns;var KC=Rw();(Ns.prototype=Object.create(KC.prototype)).constructor=Ns;var zC=bi();function Ns(t){KC.call(this,t)}Ns._configure=function(){zC.Buffer&&(Ns.prototype._slice=zC.Buffer.prototype.slice)};Ns.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Ns._configure()});var ZC=m((mae,XC)=>{"use strict";c();XC.exports=hc;var Bw=bi();(hc.prototype=Object.create(Bw.EventEmitter.prototype)).constructor=hc;function hc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Bw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}hc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Bw.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,l){if(u)return o.emit("error",u,e),s(u);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};hc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var tx=m(ex=>{"use strict";c();var KV=ex;KV.Service=ZC()});var nx=m((Aae,rx)=>{"use strict";c();rx.exports={}});var ox=m(sx=>{"use strict";c();var lr=sx;lr.build="minimal";lr.Writer=Ow();lr.BufferWriter=GC();lr.Reader=Rw();lr.BufferReader=JC();lr.util=bi();lr.rpc=tx();lr.roots=nx();lr.configure=ix;function ix(){lr.util._configure(),lr.Writer._configure(lr.BufferWriter),lr.Reader._configure(lr.BufferReader)}ix()});var ux=m((Sae,ax)=>{"use strict";c();ax.exports=ox()});var lx=m((Cae,cx)=>{"use strict";c();var zo=ux(),kh=zo.Reader,YV=zo.Writer,X=zo.util,dc=zo.roots.default||(zo.roots.default={});dc.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof kh||(n=new kh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!X.isInteger(n.Nonce)&&!(n.Nonce&&X.isInteger(n.Nonce.low)&&X.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||X.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||X.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||X.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||X.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||X.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!X.isInteger(n.GasPrice)&&!(n.GasPrice&&X.isInteger(n.GasPrice.low)&&X.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!X.isInteger(n.GasLimit)&&!(n.GasLimit&&X.isInteger(n.GasLimit.low)&&X.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||X.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||X.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!X.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||X.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!X.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||X.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||X.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof dc.proto.Transaction)return n;var i=new dc.proto.Transaction;return n.Nonce!=null&&(X.Long?(i.Nonce=X.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?X.base64.decode(n.Value,i.Value=X.newBuffer(X.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?X.base64.decode(n.RcvAddr,i.RcvAddr=X.newBuffer(X.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?X.base64.decode(n.RcvUserName,i.RcvUserName=X.newBuffer(X.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?X.base64.decode(n.SndAddr,i.SndAddr=X.newBuffer(X.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?X.base64.decode(n.SndUserName,i.SndUserName=X.newBuffer(X.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(X.Long?(i.GasPrice=X.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(X.Long?(i.GasLimit=X.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?X.base64.decode(n.Data,i.Data=X.newBuffer(X.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?X.base64.decode(n.ChainID,i.ChainID=X.newBuffer(X.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?X.base64.decode(n.Signature,i.Signature=X.newBuffer(X.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?X.base64.decode(n.GuardAddr,i.GuardAddr=X.newBuffer(X.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?X.base64.decode(n.GuardSignature,i.GuardSignature=X.newBuffer(X.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(X.Long){var o=new X.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=X.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=X.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=X.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=X.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=X.newBuffer(s.SndUserName))),X.Long){var o=new X.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(X.Long){var o=new X.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=X.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=X.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=X.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=X.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=X.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?X.Long.prototype.toString.call(n.Nonce):i.longs===Number?new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?X.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?X.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?X.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?X.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?X.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?X.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?X.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?X.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?X.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?X.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?X.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?X.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,zo.util.toJSONOptions)},e}(),t}();cx.exports=dc});var fx=m(Pr=>{"use strict";c();var JV=Pr&&Pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XV=Pr&&Pr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZV=Pr&&Pr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&JV(e,t,r);return XV(e,t),e},eH=Pr&&Pr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.ProtoSerializer=void 0;var tH=eH(Gt()),Lw=ht(),rH=bs(),nH=ZV(Be()),iH=ac(),Fw=class{serializeTransaction(e){let r=lx().proto,n=new Lw.Address(e.getReceiver().bech32()).pubkey(),i=new Lw.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:e.getReceiverUsername()?h.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?h.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:h.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==rH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Lw.Address(u.bech32()).pubkey(),s.GuardSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return h.Buffer.from(o)}serializeTransactionValue(e){let r=new tH.default(e.toString());if(r.isZero())return h.Buffer.from([0,0]);let n=iH.bigIntToBuffer(r);return n=h.Buffer.concat([h.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new nH.ErrUnsupportedOperation("deserializeTransaction")}};Pr.ProtoSerializer=Fw});var hx=m(Os=>{"use strict";c();var sH=Os&&Os.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),oH=Os&&Os.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&sH(e,t,r)};Object.defineProperty(Os,"__esModule",{value:!0});oH(fx(),Os)});var jh=m(pn=>{"use strict";c();var aH=pn&&pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),uH=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),cH=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&aH(e,t,r);return uH(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.Signature=void 0;var dx=cH(Be()),px=64,Mw=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof h.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return h.Buffer.from(e,"hex").length==px}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=px)throw new dx.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};pn.Signature=Mw});var jn=m(Qh=>{"use strict";c();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.TransactionPayload=void 0;var Uw=class t{constructor(e){this.data=h.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=h.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>h.Buffer.from(e,"hex"))}length(){return h.Buffer.from(this.data).length}};Qh.TransactionPayload=Uw});var qw=m((Mae,gx)=>{c();Qn.notEqual=fH;Qn.notOk=hH;Qn.equal=lH;Qn.ok=Qn;gx.exports=Qn;function lH(t,e,r){Qn(t==e,r)}function fH(t,e,r){Qn(t!=e,r)}function hH(t,e){Qn(!t,e)}function Qn(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ps=m(Xo=>{"use strict";c();var Vw=C0(),Yo=N0(),yx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xo.Buffer=$;Xo.SlowBuffer=wH;Xo.INSPECT_MAX_BYTES=50;var Wh=2147483647;Xo.kMaxLength=Wh;$.TYPED_ARRAY_SUPPORT=dH();!$.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function dH(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if($.isBuffer(this))return this.buffer}});Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if($.isBuffer(this))return this.byteOffset}});function Wn(t){if(t>Wh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,$.prototype),e}function $(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return jw(t)}return vx(t,e,r)}$.poolSize=8192;function vx(t,e,r){if(typeof t=="string")return gH(t,e);if(ArrayBuffer.isView(t))return yH(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(gn(t,ArrayBuffer)||t&&gn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(gn(t,SharedArrayBuffer)||t&&gn(t.buffer,SharedArrayBuffer)))return Gw(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return $.from(n,e,r);let i=mH(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return $.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}$.from=function(t,e,r){return vx(t,e,r)};Object.setPrototypeOf($.prototype,Uint8Array.prototype);Object.setPrototypeOf($,Uint8Array);function Ax(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function pH(t,e,r){return Ax(t),t<=0?Wn(t):e!==void 0?typeof r=="string"?Wn(t).fill(e,r):Wn(t).fill(e):Wn(t)}$.alloc=function(t,e,r){return pH(t,e,r)};function jw(t){return Ax(t),Wn(t<0?0:Qw(t)|0)}$.allocUnsafe=function(t){return jw(t)};$.allocUnsafeSlow=function(t){return jw(t)};function gH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!$.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=bx(t,e)|0,n=Wn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Hw(t){let e=t.length<0?0:Qw(t.length)|0,r=Wn(e);for(let n=0;n=Wh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wh.toString(16)+" bytes");return t|0}function wH(t){return+t!=t&&(t=0),$.alloc(+t)}$.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==$.prototype};$.compare=function(e,r){if(gn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),gn(r,Uint8Array)&&(r=$.from(r,r.offset,r.byteLength)),!$.isBuffer(e)||!$.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?($.isBuffer(o)||(o=$.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if($.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function bx(t,e){if($.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||gn(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return kw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Dx(t).length;default:if(i)return n?-1:kw(t).length;e=(""+e).toLowerCase(),i=!0}}$.byteLength=bx;function EH(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return NH(this,e,r);case"utf8":case"utf-8":return Ix(this,e,r);case"ascii":return CH(this,e,r);case"latin1":case"binary":return xH(this,e,r);case"base64":return SH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OH(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}$.prototype._isBuffer=!0;function Ds(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}$.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};yx&&($.prototype[yx]=$.prototype.inspect);$.prototype.compare=function(e,r,n,i,s){if(gn(e,Uint8Array)&&(e=$.from(e,e.offset,e.byteLength)),!$.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),l=this.slice(i,s),f=e.slice(r,n);for(let d=0;d2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,$w(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=$.from(e,n)),$.isBuffer(e))return e.length===0?-1:mx(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):mx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function mx(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,d){return s===1?f[d]:f.readUInt16BE(d*s)}let l;if(i){let f=-1;for(l=r;lo&&(r=o-a),l=r;l>=0;l--){let f=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return vH(this,e,r,n);case"utf8":case"utf-8":return AH(this,e,r,n);case"ascii":case"latin1":case"binary":return bH(this,e,r,n);case"base64":return _H(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return IH(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};$.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function SH(t,e,r){return e===0&&r===t.length?Vw.fromByteArray(t):Vw.fromByteArray(t.slice(e,r))}function Ix(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,l,f,d;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(d=(s&31)<<6|u&63,d>127&&(o=d));break;case 3:u=t[i+1],l=t[i+2],(u&192)===128&&(l&192)===128&&(d=(s&15)<<12|(u&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:u=t[i+1],l=t[i+2],f=t[i+3],(u&192)===128&&(l&192)===128&&(f&192)===128&&(d=(s&15)<<18|(u&63)<<12|(l&63)<<6|f&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return TH(n)}var wx=4096;function TH(t){let e=t.length;if(e<=wx)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}$.prototype.readUintLE=$.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};$.prototype.readUint8=$.prototype.readUInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]};$.prototype.readUint16LE=$.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]|this[e+1]<<8};$.prototype.readUint16BE=$.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Lt(e,2,this.length),this[e]<<8|this[e+1]};$.prototype.readUint32LE=$.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};$.prototype.readUint32BE=$.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};$.prototype.readBigUInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Lt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};$.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Lt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};$.prototype.readInt8=function(e,r){return e=e>>>0,r||Lt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};$.prototype.readInt16LE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};$.prototype.readInt16BE=function(e,r){e=e>>>0,r||Lt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};$.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};$.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};$.prototype.readBigInt64LE=Ii(function(e){e=e>>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,Jo(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&pc(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Lt(e,4,this.length),Yo.read(this,e,!0,23,4)};$.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Lt(e,4,this.length),Yo.read(this,e,!1,23,4)};$.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!0,52,8)};$.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Lt(e,8,this.length),Yo.read(this,e,!1,52,8)};function fr(t,e,r,n,i,s){if(!$.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}$.prototype.writeUintLE=$.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;fr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;fr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};$.prototype.writeUint8=$.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,1,255,0),this[r]=e&255,r+1};$.prototype.writeUint16LE=$.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeUint16BE=$.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeUint32LE=$.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};$.prototype.writeUint32BE=$.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Sx(t,e,r,n,i){Ox(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function Tx(t,e,r,n,i){Ox(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}$.prototype.writeBigUInt64LE=Ii(function(e,r=0){return Sx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeBigUInt64BE=Ii(function(e,r=0){return Tx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});$.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};$.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);fr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};$.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};$.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};$.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};$.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};$.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||fr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};$.prototype.writeBigInt64LE=Ii(function(e,r=0){return Sx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});$.prototype.writeBigInt64BE=Ii(function(e,r=0){return Tx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Cx(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function xx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,4,34028234663852886e22,-34028234663852886e22),Yo.write(t,e,r,n,23,4),r+4}$.prototype.writeFloatLE=function(e,r,n){return xx(this,e,r,!0,n)};$.prototype.writeFloatBE=function(e,r,n){return xx(this,e,r,!1,n)};function Nx(t,e,r,n,i){return e=+e,r=r>>>0,i||Cx(t,e,r,8,17976931348623157e292,-17976931348623157e292),Yo.write(t,e,r,n,52,8),r+8}$.prototype.writeDoubleLE=function(e,r,n){return Nx(this,e,r,!0,n)};$.prototype.writeDoubleBE=function(e,r,n){return Nx(this,e,r,!1,n)};$.prototype.copy=function(e,r,n,i){if(!$.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=Ex(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ex(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ex(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function DH(t,e,r){Jo(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&pc(e,t.length-(r+1))}function Ox(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Ko.ERR_OUT_OF_RANGE("value",a,t)}DH(n,i,s)}function Jo(t,e){if(typeof t!="number")throw new Ko.ERR_INVALID_ARG_TYPE(e,"number",t)}function pc(t,e,r){throw Math.floor(t)!==t?(Jo(t,r),new Ko.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ko.ERR_BUFFER_OUT_OF_BOUNDS:new Ko.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var PH=/[^+/0-9A-Za-z-_]/g;function RH(t){if(t=t.split("=")[0],t=t.trim().replace(PH,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function kw(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function BH(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Dx(t){return Vw.toByteArray(RH(t))}function $h(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function gn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function $w(t){return t!==t}var FH=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ii(t){return typeof BigInt>"u"?MH:t}function MH(){throw new Error("BigInt not supported")}});var Rx=m((Gae,Px)=>{c();Px.exports=zw;zw.supported=typeof WebAssembly<"u";function zw(t){if(!zw.supported)return null;var e=t&&t.imports,r=UH("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function UH(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(qH)):new(Ps()).Buffer(t,"base64")}function qH(t){return t.charCodeAt(0)}});var Vx=m((Wae,mn)=>{c();var yn=qw(),Ke=Rx()(),$n=64,zh=[];mn.exports=Rr;var Bx=mn.exports.BYTES_MIN=16,Lx=mn.exports.BYTES_MAX=64,jae=mn.exports.BYTES=32,Fx=mn.exports.KEYBYTES_MIN=16,Mx=mn.exports.KEYBYTES_MAX=64,Qae=mn.exports.KEYBYTES=32,Ux=mn.exports.SALTBYTES=16,qx=mn.exports.PERSONALBYTES=16;function Rr(t,e,r,n,i){if(!(this instanceof Rr))return new Rr(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(yn(t>=Bx,"digestLength must be at least "+Bx+", was given "+t),yn(t<=Lx,"digestLength must be at most "+Lx+", was given "+t),e!=null&&yn(e.length>=Fx,"key must be at least "+Fx+", was given "+e.length),e!=null&&yn(e.length<=Mx,"key must be at least "+Mx+", was given "+e.length),r!=null&&yn(r.length===Ux,"salt must be exactly "+Ux+", was given "+r.length),n!=null&&yn(n.length===qx,"personal must be exactly "+qx+", was given "+n.length)),zh.length||(zh.push($n),$n+=216),this.digestLength=t,this.finalized=!1,this.pointer=zh.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,$n,$n+e.length),Ke.memory[this.pointer+200]=128)}Rr.prototype.update=function(t){return yn(this.finalized===!1,"Hash instance finalized"),yn(t,"input must be TypedArray or Buffer"),$n+t.length>Ke.memory.length&&Ke.realloc($n+t.length),Ke.memory.set(t,$n),Ke.exports.blake2b_update(this.pointer,$n,$n+t.length),this};Rr.prototype.digest=function(t){if(yn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,zh.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return HH(Ke.memory,this.pointer+128,this.digestLength);yn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{c();var Ci=qw(),yc=Vx();function Kh(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function Hx(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function zx(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function Si(t,e,r,n,i,s){var o=gc[i],a=gc[i+1],u=gc[s],l=gc[s+1];Kh(Ce,t,e),Hx(Ce,t,o,a);var f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1];Ce[n]=d,Ce[n+1]=f,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^d<<8,Ce[e+1]=d>>>24^f<<8,Kh(Ce,t,e),Hx(Ce,t,u,l),f=Ce[n]^Ce[t],d=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^d<<16,Ce[n+1]=d>>>16^f<<16,Kh(Ce,r,n),f=Ce[e]^Ce[r],d=Ce[e+1]^Ce[r+1],Ce[e]=d>>>31^f<<1,Ce[e+1]=f>>>31^d<<1}var Kx=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),kH=[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],Kt=new Uint8Array(kH.map(function(t){return t*2})),Ce=new Uint32Array(32),gc=new Uint32Array(32);function Yx(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=Kx[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)gc[r]=zx(t.b,4*r);for(r=0;r<12;r++)Si(0,8,16,24,Kt[r*16+0],Kt[r*16+1]),Si(2,10,18,26,Kt[r*16+2],Kt[r*16+3]),Si(4,12,20,28,Kt[r*16+4],Kt[r*16+5]),Si(6,14,22,30,Kt[r*16+6],Kt[r*16+7]),Si(0,10,20,30,Kt[r*16+8],Kt[r*16+9]),Si(2,12,22,24,Kt[r*16+10],Kt[r*16+11]),Si(4,14,16,26,Kt[r*16+12],Kt[r*16+13]),Si(6,8,18,28,Kt[r*16+14],Kt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ce[r]^Ce[r+16]}var Ti=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Zo(t,e,r,n){Ti.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ti[0]=t,e&&(Ti[1]=e.length),Ti[2]=1,Ti[3]=1,r&&Ti.set(r,32),n&&Ti.set(n,48);for(var i=0;i<16;i++)this.h[i]=Kx[i]^zx(Ti,i*4);e&&(Jx(this,e),this.c=128)}Zo.prototype.update=function(t){return Ci(t!=null,"input must be Uint8Array or Buffer"),Jx(this,t),this};Zo.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Ci(e.length>=this.outlen,"out must have at least outlen bytes of space"),jH(this,e),t==="hex"?QH(e):e};Zo.prototype.final=Zo.prototype.digest;Zo.ready=function(t){yc.ready(function(){t()})};function Jx(t,e){for(var r=0;r>2]>>8*(r&3);return e}function QH(t){for(var e="",r=0;r=Gx,"outlen must be at least "+Gx+", was given "+e),Ci(e<=kx,"outlen must be at most "+kx+", was given "+e),r!=null&&Ci(r.length>=jx,"key must be at least "+jx+", was given "+r.length),r!=null&&Ci(r.length<=Qx,"key must be at most "+Qx+", was given "+r.length),n!=null&&Ci(n.length===Wx,"salt must be exactly "+Wx+", was given "+n.length),i!=null&&Ci(i.length===$x,"personal must be exactly "+$x+", was given "+i.length)),new Xx(e,r,n,i)};hr.exports.ready=function(t){yc.ready(function(){t()})};hr.exports.WASM_SUPPORTED=yc.SUPPORTED;hr.exports.WASM_LOADED=!1;var Gx=hr.exports.BYTES_MIN=16,kx=hr.exports.BYTES_MAX=64,zae=hr.exports.BYTES=32,jx=hr.exports.KEYBYTES_MIN=16,Qx=hr.exports.KEYBYTES_MAX=64,Kae=hr.exports.KEYBYTES=32,Wx=hr.exports.SALTBYTES=16,$x=hr.exports.PERSONALBYTES=16;yc.ready(function(t){t||(hr.exports.WASM_LOADED=!0,Xx=yc)})});var wn=m(Br=>{"use strict";c();var $H=Br&&Br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),zH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),KH=Br&&Br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&$H(e,t,r);return zH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionHash=Br.Transaction=void 0;var ea=Gt(),mc=ht(),YH=Uh(),JH=bs(),XH=KH(Be()),ZH=lC(),zn=cc(),eG=hx(),eN=jh(),tN=jn(),tG=wr(),rG=Zx(),nG=32,Kw=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:l,chainID:f,version:d,options:g,guardian:w}){this.nonce=e||0,this.value=r?new ea.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||JH.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=l||new tN.TransactionPayload,this.chainID=f,this.version=d?new zn.TransactionVersion(d.valueOf()):zn.TransactionVersion.withDefaultVersion(),this.options=g?new zn.TransactionOptions(g.valueOf()):zn.TransactionOptions.withDefaultOptions(),this.guardian=w||mc.Address.empty(),this.signature=h.Buffer.from([]),this.guardianSignature=h.Buffer.from([]),this.hash=ta.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new zn.TransactionVersion(e.valueOf())}getOptions(){return new zn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new zn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return tG.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return h.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),senderUsername:this.senderUsername?h.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?h.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return YH.Compatibility.guardAddressIsSetAndNonZero(new mc.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new ea.BigNumber(e.value).toFixed(0),receiver:mc.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?h.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:mc.Address.fromString(e.sender),senderUsername:e.senderUsername?h.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?mc.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new tN.TransactionPayload(h.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new zn.TransactionVersion(e.version),options:e.options!=null?new zn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new eN.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new eN.Signature(e.guardianSignature)),r}applySignature(e){this.signature=this.interpretSignatureAsBuffer(e),this.hash=ta.compute(this)}interpretSignatureAsBuffer(e){if(ArrayBuffer.isView(e))return h.Buffer.from(e);if(e.hex!=null)return h.Buffer.from(e.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${e}`)}applyGuardianSignature(e){this.guardianSignature=this.interpretSignatureAsBuffer(e),this.hash=ta.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new XH.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new ea.BigNumber(this.gasPrice.valueOf()),i=new ea.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new ea.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new ea.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Br.Transaction=Kw;var ta=class t extends ZH.Hash{constructor(e){super(e)}static compute(e){let n=new eG.ProtoSerializer().serializeTransaction(e),i=rG(nG).update(n).digest("hex");return new t(i)}};Br.TransactionHash=ta});var Zw=m(Jh=>{"use strict";c();Object.defineProperty(Jh,"__esModule",{value:!0});Jh.TransferTransactionsFactory=void 0;var Yw=Wo(),$r=St(),Yh=wn(),Jw=jn(),Xw=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new Yh.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new Yh.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new Yw.ArgSerializer().valuesToString([$r.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new $r.U64Value(e.tokenTransfer.nonce),new $r.BigUIntValue(e.tokenTransfer.valueOf()),new $r.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new Jw.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new Yh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new $r.AddressValue(e.destination),new $r.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push($r.BytesValue.fromUTF8(u.tokenIdentifier),new $r.U64Value(u.nonce),new $r.BigUIntValue(u.valueOf()));let{argumentsString:n}=new Yw.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new Jw.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new Yh.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};Jh.TransferTransactionsFactory=Xw});var tE=m(Rs=>{"use strict";c();Object.defineProperty(Rs,"__esModule",{value:!0});Rs.GasEstimator=Rs.DefaultGasConfiguration=void 0;Rs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var iG=1e5,rN=8e5,eE=class{constructor(e){this.gasConfiguration=e||Rs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+iG}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+rN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+rN)*r+this.gasConfiguration.gasPerDataByte*e}};Rs.GasEstimator=eE});var ra=m(Xh=>{"use strict";c();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.Account=void 0;var sG=ht(),rE=class{constructor(e){this.address=new sG.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};Xh.Account=rE});var na=m(Ls=>{"use strict";c();Object.defineProperty(Ls,"__esModule",{value:!0});Ls.Logger=Ls.LogLevel=void 0;var Bs;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(Bs=Ls.LogLevel||(Ls.LogLevel={}));var Zh=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Bs.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Bs.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Bs.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Bs.Error||console.error(e,r)}};Ls.Logger=Zh;Zh.logLevel=Bs.Debug});var sE=m(En=>{"use strict";c();var oG=En&&En.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aG=En&&En.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uG=En&&En.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oG(e,t,r);return aG(e,t),e};Object.defineProperty(En,"__esModule",{value:!0});En.AsyncTimer=void 0;var cG=uG(Be()),lG=Be(),nE=na(),iE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new cG.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new lG.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(nE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};En.AsyncTimer=iE});var ed=m(ia=>{"use strict";c();var Lr=ia&&ia.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ia,"__esModule",{value:!0});ia.TransactionWatcher=void 0;var oE=sE(),xi=Be(),nN=na(),Ni=class t{constructor(e,r={}){this.fetcher=new aE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Lr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Lr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new xi.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Lr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.every(l=>a.includes(l))},i=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Lr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(l=>l.identifier);return r.find(l=>a.includes(l))!=null},i=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new xi.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Lr(this,void 0,void 0,function*(){let n=()=>Lr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new xi.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Lr(this,void 0,void 0,function*(){let i=new oE.AsyncTimer("watcher:periodic"),s=new oE.AsyncTimer("watcher:patience"),o=new oE.AsyncTimer("watcher:timeout"),a=!1,u,l=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),l=e(u),l||a)break}catch(f){if(nN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof xi.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof xi.Err))throw f}}if(l&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!l)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};ia.TransactionWatcher=Ni;Ni.DefaultPollingInterval=6e3;Ni.DefaultTimeout=Ni.DefaultPollingInterval*15;Ni.DefaultPatience=0;Ni.NoopOnStatusReceived=t=>{};var aE=class{constructor(e){this.fetcher=e}getTransaction(e){return Lr(this,void 0,void 0,function*(){return nN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var cE=m(nd=>{"use strict";c();Object.defineProperty(nd,"__esModule",{value:!0});nd.CodeMetadata=void 0;var uE=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=td.Upgradeable),this.readable&&(e|=td.Readable),this.payable&&(r|=rd.Payable),this.payableBySc&&(r|=rd.PayableBySc),h.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};nd.CodeMetadata=uE;var td;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(td||(td={}));var rd;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(rd||(rd={}))});var wc=m(vn=>{"use strict";c();var fG=vn&&vn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),hG=vn&&vn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),dG=vn&&vn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&fG(e,t,r);return hG(e,t),e};Object.defineProperty(vn,"__esModule",{value:!0});vn.ContractFunction=void 0;var pG=dG(Be()),lE=class t{constructor(e){if(this.name=e,e==null)throw new pG.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};vn.ContractFunction=lE});var dE=m(Fr=>{"use strict";c();var gG=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yG=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mG=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gG(e,t,r);return yG(e,t),e},wG=Fr&&Fr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.InteractionChecker=void 0;var fE=mG(Be()),EG=wG(Gt()),hE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new EG.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new fE.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new fE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";c();Object.defineProperty(id,"__esModule",{value:!0});id.Query=void 0;var vG=ht(),AG=Wo(),pE=class{constructor(e){this.caller=e.caller||new vG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new AG.ArgSerializer().valuesToStrings(this.args)}};id.Query=pE});var wE=m(sd=>{"use strict";c();Object.defineProperty(sd,"__esModule",{value:!0});sd.Interaction=void 0;var iN=ht(),bG=Uh(),gE=bs(),yE=wc(),_G=dE(),IG=Ec(),sa=St(),mE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new iN.Address,this.sender=new iN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new oa([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){bG.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new yE.ContractFunction(gE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new yE.ContractFunction(gE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new yE.ContractFunction(gE.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new IG.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new oa([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new oa([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new oa(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new _G.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};sd.Interaction=mE;var oa=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new sa.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return sa.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new sa.U64Value(e.nonce)}getTypedTokenQuantity(e){return new sa.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new sa.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return sa.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var sN=m(od=>{"use strict";c();Object.defineProperty(od,"__esModule",{value:!0});od.ArgumentErrorContext=void 0;var SG=Be(),EE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new SG.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) -Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};od.ArgumentErrorContext=EE});var AE=m(Fs=>{"use strict";c();var TG=Fs&&Fs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.NativeSerializer=void 0;var CG=TG(Gt()),xG=ht(),vE=Be(),NG=ph(),OG=sN(),ve=St(),DG;(function(t){function e(A,I){A=A||[],r(A,I),n(I)&&(A=i(A,I));let N=I.input,_=[];for(let S=0;S0&&I[0].type.getCardinality().isComposite()&&(_=1/0,S=!0);for(let R of I){if(R.type.getCardinality().isSingular())break;N-=1}return{min:N,max:_,variadic:S}}function o(A,I,N){if(A&&A.belongsToTypesystem)return A;if(I instanceof ve.OptionType)return a(A,I,N);if(I instanceof ve.OptionalType)return u(A,I,N);if(I instanceof ve.VariadicType)return l(A,I,N);if(I instanceof ve.CompositeType)return d(A,I,N);if(I instanceof ve.TupleType)return g(A,I,N);if(I instanceof ve.StructType)return w(A,I,N);if(I instanceof ve.ListType)return f(A,I,N);if(I instanceof ve.PrimitiveType)return E(A,I,N);if(I instanceof ve.EnumType)return T(A,I,N);N.throwError(`convertToTypedValue: unhandled type ${I}`)}function a(A,I,N){if(A==null)return ve.OptionValue.newMissing();let _=o(A,I.getFirstTypeParameter(),N);return ve.OptionValue.newProvided(_)}function u(A,I,N){if(A==null)return new ve.OptionalValue(I);let _=o(A,I.getFirstTypeParameter(),N);return new ve.OptionalValue(I,_)}function l(A,I,N){if(I.isCounted)throw new vE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');A==null&&(A=[]),A.map===void 0&&N.convertError(A,"Variadic");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.VariadicValue(I,_)}function f(A,I,N){A.map===void 0&&N.convertError(A,"List");let _=A.map(function(S){return o(S,I.getFirstTypeParameter(),N)});return new ve.List(I,_)}function d(A,I,N){let _=[],S=I.getTypeParameters();N.guardSameLength(A,S);for(let R=0;R{"use strict";c();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var SE=jn(),TE=wr(),PG=Wo();zr.ArwenVirtualMachine="0500";var bE=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${zr.ArwenVirtualMachine}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractDeployPayloadBuilder=bE;var _E=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){TE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=CE(n,this.arguments),new SE.TransactionPayload(n)}};zr.ContractUpgradePayloadBuilder=_E;var IE=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){TE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=CE(e,this.arguments),new SE.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=IE;function CE(t,e){let{argumentsString:r,count:n}=new PG.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Kn=m((xue,NE)=>{"use strict";c();var aa=typeof Reflect=="object"?Reflect:null,oN=aa&&typeof aa.apply=="function"?aa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ad;aa&&typeof aa.ownKeys=="function"?ad=aa.ownKeys:Object.getOwnPropertySymbols?ad=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ad=function(e){return Object.getOwnPropertyNames(e)};function RG(t){console&&console.warn&&console.warn(t)}var uN=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}NE.exports=ke;NE.exports.once=MG;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var aN=10;function ud(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return aN},set:function(t){if(typeof t!="number"||t<0||uN(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");aN=t}});ke.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||uN(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};function cN(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return cN(this)};ke.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")oN(u,this,r);else for(var l=u.length,f=pN(u,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,RG(a)}return t}ke.prototype.addListener=function(e,r){return lN(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return lN(this,e,r,!0)};function BG(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=BG.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return ud(r),this.on(e,fN(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return ud(r),this.prependListener(e,fN(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ud(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():LG(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ke.prototype.off=ke.prototype.removeListener;ke.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function hN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?FG(i):pN(i,i.length)}ke.prototype.listeners=function(e){return hN(this,e,!0)};ke.prototype.rawListeners=function(e){return hN(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dN.call(t,e)};ke.prototype.listenerCount=dN;function dN(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ke.prototype.eventNames=function(){return this._eventsCount>0?ad(this._events):[]};function pN(t,e){for(var r=new Array(e),n=0;n{c();yN.exports=Kn().EventEmitter});var DE=m(()=>{c()});var bN=m((Lue,AN)=>{"use strict";c();function mN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return cd.alloc(0);for(var n=cd.allocUnsafe(r>>>0),i=this.head,s=0;i;)WG(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=cd.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:QG,value:function(r,n){return PE(this,wN(wN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var BE=m((Mue,IN)=>{"use strict";c();function $G(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(RE,this,t)):p.default.nextTick(RE,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(ld,r):(r._writableState.errorEmitted=!0,p.default.nextTick(_N,r,s)):p.default.nextTick(_N,r,s):e?(p.default.nextTick(ld,r),e(s)):p.default.nextTick(ld,r)}),this)}function _N(t,e){RE(t,e),ld(t)}function ld(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function zG(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function RE(t,e){t.emit("error",e)}function KG(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}IN.exports={destroy:$G,undestroy:zG,errorOrDestroy:KG}});var Ms=m((que,CN)=>{"use strict";c();function YG(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var TN={};function Mr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){YG(o,s);function o(a,u,l){return s.call(this,n(a,u,l))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,TN[t]=i}function SN(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function JG(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function XG(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function ZG(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}Mr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);Mr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&JG(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(XG(t," argument"))i="The ".concat(t," ").concat(n," ").concat(SN(e,"type"));else{var s=ZG(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(SN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Mr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Mr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});Mr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Mr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});Mr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Mr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Mr("ERR_STREAM_WRITE_AFTER_END","write after end");Mr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Mr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);Mr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");CN.exports.codes=TN});var LE=m((Hue,xN)=>{"use strict";c();var ek=Ms().codes.ERR_INVALID_OPT_VALUE;function tk(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function rk(t,e,r,n){var i=tk(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new ek(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}xN.exports={getHighWaterMark:rk}});var ua=m((kue,FE)=>{c();typeof Object.create=="function"?FE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:FE.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var ON=m((Que,NN)=>{c();NN.exports=nk;function nk(t,e){if(ME("noDeprecation"))return t;var r=!1;function n(){if(!r){if(ME("throwDeprecation"))throw new Error(e);ME("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function ME(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var VE=m(($ue,FN)=>{"use strict";c();FN.exports=dt;function PN(t){var e=this;this.next=null,this.entry=null,this.finish=function(){Ok(e,t)}}var ca;dt.WritableState=Ac;var ik={deprecate:ON()},RN=OE(),hd=Ps().Buffer,sk=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ok(t){return hd.from(t)}function ak(t){return hd.isBuffer(t)||t instanceof sk}var qE=BE(),uk=LE(),ck=uk.getHighWaterMark,Oi=Ms().codes,lk=Oi.ERR_INVALID_ARG_TYPE,fk=Oi.ERR_METHOD_NOT_IMPLEMENTED,hk=Oi.ERR_MULTIPLE_CALLBACK,dk=Oi.ERR_STREAM_CANNOT_PIPE,pk=Oi.ERR_STREAM_DESTROYED,gk=Oi.ERR_STREAM_NULL_VALUES,yk=Oi.ERR_STREAM_WRITE_AFTER_END,mk=Oi.ERR_UNKNOWN_ENCODING,la=qE.errorOrDestroy;ua()(dt,RN);function wk(){}function Ac(t,e,r){ca=ca||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof ca),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=ck(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){Sk(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new PN(this)}Ac.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(Ac.prototype,"buffer",{get:ik.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var fd;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(fd=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return fd.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof Ac}})):fd=function(e){return e instanceof this};function dt(t){ca=ca||Us();var e=this instanceof ca;if(!e&&!fd.call(dt,this))return new dt(t);this._writableState=new Ac(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),RN.call(this)}dt.prototype.pipe=function(){la(this,new dk)};function Ek(t,e){var r=new yk;la(t,r),p.default.nextTick(e,r)}function vk(t,e,r,n){var i;return r===null?i=new gk:typeof r!="string"&&!e.objectMode&&(i=new lk("chunk",["string","Buffer"],r)),i?(la(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&ak(t);return s&&!hd.isBuffer(t)&&(t=ok(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=wk),n.ending?Ek(this,r):(s||vk(this,n,t,r))&&(n.pendingcb++,i=bk(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&BN(this,t))};dt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new mk(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Ak(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=hd.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function bk(t,e,r,n,i,s){if(!r){var o=Ak(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";c();var Dk=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};UN.exports=An;var MN=kE(),GE=VE();ua()(An,MN);for(HE=Dk(GE.prototype),dd=0;dd{c();var gd=Ps(),bn=gd.Buffer;function qN(t,e){for(var r in t)e[r]=t[r]}bn.from&&bn.alloc&&bn.allocUnsafe&&bn.allocUnsafeSlow?VN.exports=gd:(qN(gd,jE),jE.Buffer=qs);function qs(t,e,r){return bn(t,e,r)}qs.prototype=Object.create(bn.prototype);qN(bn,qs);qs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bn(t,e,r)};qs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=bn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};qs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bn(t)};qs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gd.SlowBuffer(t)}});var $E=m(kN=>{"use strict";c();var WE=HN().Buffer,GN=WE.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Bk(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function Lk(t){var e=Bk(t);if(typeof e!="string"&&(WE.isEncoding===GN||!GN(t)))throw new Error("Unknown encoding: "+t);return e||t}kN.StringDecoder=bc;function bc(t){this.encoding=Lk(t);var e;switch(this.encoding){case"utf16le":this.text=Hk,this.end=Gk,e=4;break;case"utf8":this.fillLast=Uk,e=4;break;case"base64":this.text=kk,this.end=jk,e=3;break;default:this.write=Qk,this.end=Wk;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=WE.allocUnsafe(e)}bc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Fk(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Mk(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Uk(t){var e=this.lastTotal-this.lastNeed,r=Mk(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function qk(t,e){var r=Fk(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Vk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Hk(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function Gk(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function kk(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function jk(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Qk(t){return t.toString(this.encoding)}function Wk(t){return t&&t.length?this.write(t):""}});var yd=m((ece,WN)=>{"use strict";c();var jN=Ms().codes.ERR_STREAM_PREMATURE_CLOSE;function $k(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";c();var md;function Di(t,e,r){return e=Yk(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yk(t){var e=Jk(t,"string");return typeof e=="symbol"?e:String(e)}function Jk(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xk=yd(),Pi=Symbol("lastResolve"),Vs=Symbol("lastReject"),_c=Symbol("error"),wd=Symbol("ended"),Hs=Symbol("lastPromise"),zE=Symbol("handlePromise"),Gs=Symbol("stream");function Ri(t,e){return{value:t,done:e}}function Zk(t){var e=t[Pi];if(e!==null){var r=t[Gs].read();r!==null&&(t[Hs]=null,t[Pi]=null,t[Vs]=null,e(Ri(r,!1)))}}function ej(t){p.default.nextTick(Zk,t)}function tj(t,e){return function(r,n){t.then(function(){if(e[wd]){r(Ri(void 0,!0));return}e[zE](r,n)},n)}}var rj=Object.getPrototypeOf(function(){}),nj=Object.setPrototypeOf((md={get stream(){return this[Gs]},next:function(){var e=this,r=this[_c];if(r!==null)return Promise.reject(r);if(this[wd])return Promise.resolve(Ri(void 0,!0));if(this[Gs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[_c]?a(e[_c]):o(Ri(void 0,!0))})});var n=this[Hs],i;if(n)i=new Promise(tj(n,this));else{var s=this[Gs].read();if(s!==null)return Promise.resolve(Ri(s,!1));i=new Promise(this[zE])}return this[Hs]=i,i}},Di(md,Symbol.asyncIterator,function(){return this}),Di(md,"return",function(){var e=this;return new Promise(function(r,n){e[Gs].destroy(null,function(i){if(i){n(i);return}r(Ri(void 0,!0))})})}),md),rj),ij=function(e){var r,n=Object.create(nj,(r={},Di(r,Gs,{value:e,writable:!0}),Di(r,Pi,{value:null,writable:!0}),Di(r,Vs,{value:null,writable:!0}),Di(r,_c,{value:null,writable:!0}),Di(r,wd,{value:e._readableState.endEmitted,writable:!0}),Di(r,zE,{value:function(s,o){var a=n[Gs].read();a?(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(Ri(a,!1))):(n[Pi]=s,n[Vs]=o)},writable:!0}),r));return n[Hs]=null,Xk(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[Vs];s!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,s(i)),n[_c]=i;return}var o=n[Pi];o!==null&&(n[Hs]=null,n[Pi]=null,n[Vs]=null,o(Ri(void 0,!0))),n[wd]=!0}),e.on("readable",ej.bind(null,n)),n};$N.exports=ij});var YN=m((ice,KN)=>{c();KN.exports=function(){throw new Error("Readable.from is not available in the browser")}});var kE=m((ace,oO)=>{"use strict";c();oO.exports=Me;var fa;Me.ReadableState=eO;var oce=Kn().EventEmitter,ZN=function(e,r){return e.listeners(r).length},Sc=OE(),Ed=Ps().Buffer,sj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oj(t){return Ed.from(t)}function aj(t){return Ed.isBuffer(t)||t instanceof sj}var KE=DE(),xe;KE&&KE.debuglog?xe=KE.debuglog("stream"):xe=function(){};var uj=bN(),rv=BE(),cj=LE(),lj=cj.getHighWaterMark,vd=Ms().codes,fj=vd.ERR_INVALID_ARG_TYPE,hj=vd.ERR_STREAM_PUSH_AFTER_EOF,dj=vd.ERR_METHOD_NOT_IMPLEMENTED,pj=vd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ha,YE,JE;ua()(Me,Sc);var Ic=rv.errorOrDestroy,XE=["error","close","destroy","pause","resume"];function gj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function eO(t,e,r){fa=fa||Us(),t=t||{},typeof r!="boolean"&&(r=e instanceof fa),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=lj(this,t,"readableHighWaterMark",r),this.buffer=new uj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(ha||(ha=$E().StringDecoder),this.decoder=new ha(t.encoding),this.encoding=t.encoding)}function Me(t){if(fa=fa||Us(),!(this instanceof Me))return new Me(t);var e=this instanceof fa;this._readableState=new eO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Sc.call(this)}Object.defineProperty(Me.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Me.prototype.destroy=rv.destroy;Me.prototype._undestroy=rv.undestroy;Me.prototype._destroy=function(t,e){e(t)};Me.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Ed.from(t,e),e=""),n=!0),tO(this,t,e,!1,n)};Me.prototype.unshift=function(t){return tO(this,t,null,!0,!1)};function tO(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,wj(t,s);else{var o;if(i||(o=yj(s,e)),o)Ic(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Ed.prototype&&(e=oj(e)),n)s.endEmitted?Ic(t,new pj):ZE(t,s,e,!0);else if(s.ended)Ic(t,new hj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?ZE(t,s,e,!1):tv(t,s)):ZE(t,s,e,!1)}else n||(s.reading=!1,tv(t,s))}return!s.ended&&(s.length=JN?t=JN:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function XN(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=mj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Me.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ev(this):Ad(this),null;if(t=XN(t,e),t===0&&e.ended)return e.length===0&&ev(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=iO(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&ev(this)),i!==null&&this.emit("data",i),i};function wj(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Ad(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,rO(t)))}}function Ad(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(rO,t))}function rO(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,nv(t)}function tv(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Ej,t,e))}function Ej(t,e){for(;!e.reading&&!e.ended&&(e.length1&&sO(n.pipes,t)!==-1)&&!l&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(D){xe("onerror",D),T(),t.removeListener("error",g),ZN(t,"error")===0&&Ic(t,D)}gj(t,"error",g);function w(){t.removeListener("finish",E),T()}t.once("close",w);function E(){xe("onfinish"),t.removeListener("close",w),T()}t.once("finish",E);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function vj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&ZN(t,"data")&&(r.flowing=!0,nv(t))}}Me.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?Ad(this):n.reading||p.default.nextTick(Aj,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Sc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(nO,this),r};Me.prototype.removeAllListeners=function(t){var e=Sc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(nO,this),e};function nO(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function Aj(t){xe("readable nexttick read 0"),t.read(0)}Me.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,bj(this,t)),t.paused=!1,this};function bj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(_j,t,e))}function _j(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),nv(t),e.flowing&&!e.reading&&t.read(0)}Me.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function nv(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Me.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function ev(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Ij,e,t))}function Ij(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Me.from=function(t,e){return JE===void 0&&(JE=YN()),JE(Me,t,e)});function sO(t,e){for(var r=0,n=t.length;r{"use strict";c();uO.exports=Yn;var bd=Ms().codes,Sj=bd.ERR_METHOD_NOT_IMPLEMENTED,Tj=bd.ERR_MULTIPLE_CALLBACK,Cj=bd.ERR_TRANSFORM_ALREADY_TRANSFORMING,xj=bd.ERR_TRANSFORM_WITH_LENGTH_0,_d=Us();ua()(Yn,_d);function Nj(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Tj);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";c();lO.exports=Tc;var cO=iv();ua()(Tc,cO);function Tc(t){if(!(this instanceof Tc))return new Tc(t);cO.call(this,t)}Tc.prototype._transform=function(t,e,r){r(null,t)}});var yO=m((dce,gO)=>{"use strict";c();var sv;function Dj(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var pO=Ms().codes,Pj=pO.ERR_MISSING_ARGS,Rj=pO.ERR_STREAM_DESTROYED;function hO(t){if(t)throw t}function Bj(t){return t.setHeader&&typeof t.abort=="function"}function Lj(t,e,r,n){n=Dj(n);var i=!1;t.on("close",function(){i=!0}),sv===void 0&&(sv=yd()),sv(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,Bj(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new Rj("pipe"))}}}function dO(t){t()}function Fj(t,e){return t.pipe(e)}function Mj(t){return!t.length||typeof t[t.length-1]!="function"?hO:t.pop()}function Uj(){for(var t=arguments.length,e=new Array(t),r=0;r0;return Lj(o,u,l,function(f){i||(i=f),f&&s.forEach(dO),!u&&(s.forEach(dO),n(i))})});return e.reduce(Fj)}gO.exports=Uj});var ov=m((Ur,mO)=>{c();Ur=mO.exports=kE();Ur.Stream=Ur;Ur.Readable=Ur;Ur.Writable=VE();Ur.Duplex=Us();Ur.Transform=iv();Ur.PassThrough=fO();Ur.finished=yd();Ur.pipeline=yO()});var vO=m((yce,EO)=>{c();var{Transform:qj}=ov();EO.exports=t=>class wO extends qj{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new wO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var _O=m((wce,bO)=>{c();var{Transform:Vj}=ov();bO.exports=t=>class AO extends Vj{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!h.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return h.Buffer.isBuffer(r)||(r=h.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new AO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var SO=m((vce,IO)=>{c();var Hj=vO(),Gj=_O();IO.exports=function(t){let e=Hj(t),r=Gj(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var xO=m(CO=>{c();var TO=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];CO.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],d=t[9]^t[19]^t[29]^t[39]^t[49],g=f^(i<<1|s>>>31),w=d^(s<<1|i>>>31),E=t[0]^g,T=t[1]^w,D=t[10]^g,B=t[11]^w,W=t[20]^g,U=t[21]^w,A=t[30]^g,I=t[31]^w,N=t[40]^g,_=t[41]^w;g=r^(o<<1|a>>>31),w=n^(a<<1|o>>>31);let S=t[2]^g,R=t[3]^w,J=t[12]^g,Q=t[13]^w,V=t[22]^g,k=t[23]^w,K=t[32]^g,pe=t[33]^w,ue=t[42]^g,re=t[43]^w;g=i^(u<<1|l>>>31),w=s^(l<<1|u>>>31);let Y=t[4]^g,se=t[5]^w,te=t[14]^g,ie=t[15]^w,M=t[24]^g,le=t[25]^w,ae=t[34]^g,fe=t[35]^w,oe=t[44]^g,ce=t[45]^w;g=o^(f<<1|d>>>31),w=a^(d<<1|f>>>31);let y=t[6]^g,v=t[7]^w,b=t[16]^g,P=t[17]^w,C=t[26]^g,O=t[27]^w,L=t[36]^g,x=t[37]^w,F=t[46]^g,H=t[47]^w;g=u^(r<<1|n>>>31),w=l^(n<<1|r>>>31);let q=t[8]^g,Z=t[9]^w,we=t[18]^g,Ae=t[19]^w,Re=t[28]^g,tt=t[29]^w,lt=t[38]^g,Oe=t[39]^w,Ue=t[48]^g,Ot=t[49]^w,hi=E,ms=T,ws=B<<4|D>>>28,sr=D<<4|B>>>28,Un=W<<3|U>>>29,$t=U<<3|W>>>29,Dt=I<<9|A>>>23,$e=A<<9|I>>>23,Uy=N<<18|_>>>14,qy=_<<18|N>>>14,Vy=S<<1|R>>>31,Hy=R<<1|S>>>31,Gy=Q<<12|J>>>20,ky=J<<12|Q>>>20,jy=V<<10|k>>>22,Qy=k<<10|V>>>22,Wy=pe<<13|K>>>19,$y=K<<13|pe>>>19,zy=ue<<2|re>>>30,Ky=re<<2|ue>>>30,Yy=se<<30|Y>>>2,Jy=Y<<30|se>>>2,Xy=te<<6|ie>>>26,Zy=ie<<6|te>>>26,e0=le<<11|M>>>21,t0=M<<11|le>>>21,r0=ae<<15|fe>>>17,n0=fe<<15|ae>>>17,i0=ce<<29|oe>>>3,s0=oe<<29|ce>>>3,o0=y<<28|v>>>4,a0=v<<28|y>>>4,u0=P<<23|b>>>9,c0=b<<23|P>>>9,l0=C<<25|O>>>7,f0=O<<25|C>>>7,h0=L<<21|x>>>11,d0=x<<21|L>>>11,p0=H<<24|F>>>8,g0=F<<24|H>>>8,y0=q<<27|Z>>>5,m0=Z<<27|q>>>5,w0=we<<20|Ae>>>12,E0=Ae<<20|we>>>12,v0=tt<<7|Re>>>25,A0=Re<<7|tt>>>25,b0=lt<<8|Oe>>>24,_0=Oe<<8|lt>>>24,I0=Ue<<14|Ot>>>18,S0=Ot<<14|Ue>>>18;t[0]=hi^~Gy&e0,t[1]=ms^~ky&t0,t[10]=o0^~w0&Un,t[11]=a0^~E0&$t,t[20]=Vy^~Xy&l0,t[21]=Hy^~Zy&f0,t[30]=y0^~ws&jy,t[31]=m0^~sr&Qy,t[40]=Yy^~u0&v0,t[41]=Jy^~c0&A0,t[2]=Gy^~e0&h0,t[3]=ky^~t0&d0,t[12]=w0^~Un&Wy,t[13]=E0^~$t&$y,t[22]=Xy^~l0&b0,t[23]=Zy^~f0&_0,t[32]=ws^~jy&r0,t[33]=sr^~Qy&n0,t[42]=u0^~v0&Dt,t[43]=c0^~A0&$e,t[4]=e0^~h0&I0,t[5]=t0^~d0&S0,t[14]=Un^~Wy&i0,t[15]=$t^~$y&s0,t[24]=l0^~b0&Uy,t[25]=f0^~_0&qy,t[34]=jy^~r0&p0,t[35]=Qy^~n0&g0,t[44]=v0^~Dt&zy,t[45]=A0^~$e&Ky,t[6]=h0^~I0&hi,t[7]=d0^~S0&ms,t[16]=Wy^~i0&o0,t[17]=$y^~s0&a0,t[26]=b0^~Uy&Vy,t[27]=_0^~qy&Hy,t[36]=r0^~p0&y0,t[37]=n0^~g0&m0,t[46]=Dt^~zy&Yy,t[47]=$e^~Ky&Jy,t[8]=I0^~hi&Gy,t[9]=S0^~ms&ky,t[18]=i0^~o0&w0,t[19]=s0^~a0&E0,t[28]=Uy^~Vy&Xy,t[29]=qy^~Hy&Zy,t[38]=p0^~y0&ws,t[39]=g0^~m0&sr,t[48]=zy^~Yy&u0,t[49]=Ky^~Jy&c0,t[0]^=TO[e*2],t[1]^=TO[e*2+1]}}});var OO=m((Ice,NO)=>{c();var Id=xO();function da(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}da.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};da.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Id.p1600(this.state),this.count=0);return e};da.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};NO.exports=da});var av=m((Tce,DO)=>{c();DO.exports=SO()(OO())});var fv=m(pa=>{"use strict";c();var kj=pa&&pa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pa,"__esModule",{value:!0});pa.SmartContract=void 0;var jj=kj(Gt()),Cc=ht(),uv=Uh(),Qj=Be(),cv=wn(),Wj=wr(),$j=ac(),PO=cE(),RO=wc(),BO=wE(),zj=AE(),Kj=Ec(),Sd=xE(),Yj=av(),lv=class{constructor(e={}){this.address=new Cc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Cc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new RO.ContractFunction(i);return new BO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new RO.ContractFunction(i),a=zj.NativeSerializer.nativeToTypedValues(s||[],n);return new BO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return Wj.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.Transaction({receiver:Cc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){uv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new PO.CodeMetadata,i=i||[],s=s||0;let l=new Sd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new cv.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:l,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){uv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let l=new Sd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new cv.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:l,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new Kj.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new Qj.ErrContractHasNoAddress}static computeAddress(e,r){let n=h.Buffer.alloc(8,0),i=new Cc.Address(e.bech32()).pubkey(),s=i.slice(30),o=h.Buffer.alloc(8),a=new jj.default(r.valueOf().toString(10)),u=$j.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let l=h.Buffer.concat([i,o]),f=Yj("keccak256").update(l).digest(),d=h.Buffer.from(Sd.ArwenVirtualMachine,"hex"),g=h.Buffer.concat([n,d,f.slice(10,30),s]);return new Cc.Address(g)}};pa.SmartContract=lv});var LO=m(Bi=>{"use strict";c();Object.defineProperty(Bi,"__esModule",{value:!0});Bi.ErrAccountNotConnected=Bi.ErrCannotSignSingleTransaction=Bi.Err=void 0;var xc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Bi.Err=xc;var hv=class extends xc{constructor(){super("Cannot sign single transaction.")}};Bi.ErrCannotSignSingleTransaction=hv;var dv=class extends xc{constructor(){super("Account is not connected.")}};Bi.ErrAccountNotConnected=dv});var FO=m(Nc=>{"use strict";c();Object.defineProperty(Nc,"__esModule",{value:!0});Nc.Operation=void 0;var Jj;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(Jj=Nc.Operation||(Nc.Operation={}))});var pv=m(ga=>{"use strict";c();var Li=ga&&ga.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(ga,"__esModule",{value:!0});ga.ExtensionProvider=void 0;var Xj=wn(),MO=LO(),Oc=FO(),Dc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Li(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Oc.Operation.Connect,n),this.account.address})}logout(){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Oc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Li(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Li(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new MO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new MO.ErrAccountNotConnected}signTransactions(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Oc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>Xj.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Li(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Oc.Operation.SignMessage,r)).signature,s=h.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Oc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};ga.ExtensionProvider=Dc;Dc._instance=new Dc});var Er={};ft(Er,{__assign:()=>yv,__asyncDelegator:()=>fQ,__asyncGenerator:()=>lQ,__asyncValues:()=>hQ,__await:()=>Pc,__awaiter:()=>iQ,__classPrivateFieldGet:()=>yQ,__classPrivateFieldSet:()=>mQ,__createBinding:()=>oQ,__decorate:()=>tQ,__exportStar:()=>aQ,__extends:()=>Zj,__generator:()=>sQ,__importDefault:()=>gQ,__importStar:()=>pQ,__makeTemplateObject:()=>dQ,__metadata:()=>nQ,__param:()=>rQ,__read:()=>GO,__rest:()=>eQ,__spread:()=>uQ,__spreadArrays:()=>cQ,__values:()=>mv});function Zj(t,e){gv(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function eQ(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function rQ(t,e){return function(r,n){e(r,n,t)}}function nQ(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function iQ(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function sQ(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function GO(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function uQ(){for(var t=[],e=0;e1||a(g,w)})})}function a(g,w){try{u(n[g](w))}catch(E){d(s[0][3],E)}}function u(g){g.value instanceof Pc?Promise.resolve(g.value.v).then(l,f):d(s[0][2],g)}function l(g){a("next",g)}function f(g){a("throw",g)}function d(g,w){g(w),s.shift(),s.length&&a(s[0][0],s[0][1])}}function fQ(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:Pc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function hQ(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof mv=="function"?mv(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(l){s({value:l,done:a})},o)}}function dQ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function pQ(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function gQ(t){return t&&t.__esModule?t:{default:t}}function yQ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function mQ(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var gv,yv,vr=ge(()=>{c();gv=function(t,e){return gv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},gv(t,e)};yv=function(){return yv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";c();Object.defineProperty(Nd,"__esModule",{value:!0});function wQ(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}Nd.safeJsonParse=wQ;function EQ(t){return typeof t=="string"?t:JSON.stringify(t,(e,r)=>typeof r>"u"?null:r)}Nd.safeJsonStringify=EQ});var kO=m(($ce,Od)=>{"use strict";c();(function(){"use strict";let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?Od.exports=global.localStorage:typeof window<"u"&&window.localStorage?Od.exports=window.localStorage:Od.exports=new e})()});var jO=m(Dd=>{"use strict";c();Object.defineProperty(Dd,"__esModule",{value:!0});Dd.IKeyValueStorage=void 0;var Ev=class{};Dd.IKeyValueStorage=Ev});var QO=m(Pd=>{"use strict";c();Object.defineProperty(Pd,"__esModule",{value:!0});Pd.parseEntry=void 0;var vQ=wv();function AQ(t){var e;return[t[0],vQ.safeJsonParse((e=t[1])!==null&&e!==void 0?e:"")]}Pd.parseEntry=AQ});var $O=m(Rd=>{"use strict";c();Object.defineProperty(Rd,"__esModule",{value:!0});var WO=(vr(),ct(Er));WO.__exportStar(jO(),Rd);WO.__exportStar(QO(),Rd)});var KO=m(Rc=>{"use strict";c();Object.defineProperty(Rc,"__esModule",{value:!0});Rc.KeyValueStorage=void 0;var ya=(vr(),ct(Er)),zO=wv(),bQ=ya.__importDefault(kO()),_Q=$O(),Bd=class{constructor(){this.localStorage=bQ.default}getKeys(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return ya.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_Q.parseEntry)})}getItem(e){return ya.__awaiter(this,void 0,void 0,function*(){let r=this.localStorage.getItem(e);if(r!==null)return zO.safeJsonParse(r)})}setItem(e,r){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,zO.safeJsonStringify(r))})}removeItem(e){return ya.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Rc.KeyValueStorage=Bd;Rc.default=Bd});var YO=m(Ld=>{"use strict";c();Object.defineProperty(Ld,"__esModule",{value:!0});Ld.delay=void 0;function IQ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}Ld.delay=IQ});var JO=m(ma=>{"use strict";c();Object.defineProperty(ma,"__esModule",{value:!0});ma.ONE_THOUSAND=ma.ONE_HUNDRED=void 0;ma.ONE_HUNDRED=100;ma.ONE_THOUSAND=1e3});var XO=m(de=>{"use strict";c();Object.defineProperty(de,"__esModule",{value:!0});de.ONE_YEAR=de.FOUR_WEEKS=de.THREE_WEEKS=de.TWO_WEEKS=de.ONE_WEEK=de.THIRTY_DAYS=de.SEVEN_DAYS=de.FIVE_DAYS=de.THREE_DAYS=de.ONE_DAY=de.TWENTY_FOUR_HOURS=de.TWELVE_HOURS=de.SIX_HOURS=de.THREE_HOURS=de.ONE_HOUR=de.SIXTY_MINUTES=de.THIRTY_MINUTES=de.TEN_MINUTES=de.FIVE_MINUTES=de.ONE_MINUTE=de.SIXTY_SECONDS=de.THIRTY_SECONDS=de.TEN_SECONDS=de.FIVE_SECONDS=de.ONE_SECOND=void 0;de.ONE_SECOND=1;de.FIVE_SECONDS=5;de.TEN_SECONDS=10;de.THIRTY_SECONDS=30;de.SIXTY_SECONDS=60;de.ONE_MINUTE=de.SIXTY_SECONDS;de.FIVE_MINUTES=de.ONE_MINUTE*5;de.TEN_MINUTES=de.ONE_MINUTE*10;de.THIRTY_MINUTES=de.ONE_MINUTE*30;de.SIXTY_MINUTES=de.ONE_MINUTE*60;de.ONE_HOUR=de.SIXTY_MINUTES;de.THREE_HOURS=de.ONE_HOUR*3;de.SIX_HOURS=de.ONE_HOUR*6;de.TWELVE_HOURS=de.ONE_HOUR*12;de.TWENTY_FOUR_HOURS=de.ONE_HOUR*24;de.ONE_DAY=de.TWENTY_FOUR_HOURS;de.THREE_DAYS=de.ONE_DAY*3;de.FIVE_DAYS=de.ONE_DAY*5;de.SEVEN_DAYS=de.ONE_DAY*7;de.THIRTY_DAYS=de.ONE_DAY*30;de.ONE_WEEK=de.SEVEN_DAYS;de.TWO_WEEKS=de.ONE_WEEK*2;de.THREE_WEEKS=de.ONE_WEEK*3;de.FOUR_WEEKS=de.ONE_WEEK*4;de.ONE_YEAR=de.ONE_DAY*365});var vv=m(Fd=>{"use strict";c();Object.defineProperty(Fd,"__esModule",{value:!0});var ZO=(vr(),ct(Er));ZO.__exportStar(JO(),Fd);ZO.__exportStar(XO(),Fd)});var t2=m(wa=>{"use strict";c();Object.defineProperty(wa,"__esModule",{value:!0});wa.fromMiliseconds=wa.toMiliseconds=void 0;var e2=vv();function SQ(t){return t*e2.ONE_THOUSAND}wa.toMiliseconds=SQ;function TQ(t){return Math.floor(t/e2.ONE_THOUSAND)}wa.fromMiliseconds=TQ});var n2=m(Md=>{"use strict";c();Object.defineProperty(Md,"__esModule",{value:!0});var r2=(vr(),ct(Er));r2.__exportStar(YO(),Md);r2.__exportStar(t2(),Md)});var i2=m(Bc=>{"use strict";c();Object.defineProperty(Bc,"__esModule",{value:!0});Bc.Watch=void 0;var Ud=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};Bc.Watch=Ud;Bc.default=Ud});var s2=m(qd=>{"use strict";c();Object.defineProperty(qd,"__esModule",{value:!0});qd.IWatch=void 0;var Av=class{};qd.IWatch=Av});var o2=m(bv=>{"use strict";c();Object.defineProperty(bv,"__esModule",{value:!0});var CQ=(vr(),ct(Er));CQ.__exportStar(s2(),bv)});var ks=m(Ea=>{"use strict";c();Object.defineProperty(Ea,"__esModule",{value:!0});var Vd=(vr(),ct(Er));Vd.__exportStar(n2(),Ea);Vd.__exportStar(i2(),Ea);Vd.__exportStar(o2(),Ea);Vd.__exportStar(vv(),Ea)});var _v,a2=ge(()=>{c();_v=class{}});var Iv={};ft(Iv,{IEvents:()=>_v});var Sv=ge(()=>{c();a2()});var u2=m(Hd=>{"use strict";c();Object.defineProperty(Hd,"__esModule",{value:!0});Hd.IHeartBeat=void 0;var xQ=(Sv(),ct(Iv)),Tv=class extends xQ.IEvents{constructor(e){super()}};Hd.IHeartBeat=Tv});var xv=m(Cv=>{"use strict";c();Object.defineProperty(Cv,"__esModule",{value:!0});var NQ=(vr(),ct(Er));NQ.__exportStar(u2(),Cv)});var c2=m(va=>{"use strict";c();Object.defineProperty(va,"__esModule",{value:!0});va.HEARTBEAT_EVENTS=va.HEARTBEAT_INTERVAL=void 0;var OQ=ks();va.HEARTBEAT_INTERVAL=OQ.FIVE_SECONDS;va.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var Ov=m(Nv=>{"use strict";c();Object.defineProperty(Nv,"__esModule",{value:!0});var DQ=(vr(),ct(Er));DQ.__exportStar(c2(),Nv)});var l2=m(Gd=>{"use strict";c();Object.defineProperty(Gd,"__esModule",{value:!0});Gd.HeartBeat=void 0;var Dv=(vr(),ct(Er)),PQ=Kn(),RQ=ks(),BQ=xv(),Pv=Ov(),Rv=class t extends BQ.IHeartBeat{constructor(e){super(e),this.events=new PQ.EventEmitter,this.interval=Pv.HEARTBEAT_INTERVAL,this.interval=e?.interval||Pv.HEARTBEAT_INTERVAL}static init(e){return Dv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return Dv.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return Dv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),RQ.toMiliseconds(this.interval))})}pulse(){this.events.emit(Pv.HEARTBEAT_EVENTS.pulse)}};Gd.HeartBeat=Rv});var f2=m(Lc=>{"use strict";c();Object.defineProperty(Lc,"__esModule",{value:!0});var Bv=(vr(),ct(Er));Bv.__exportStar(l2(),Lc);Bv.__exportStar(xv(),Lc);Bv.__exportStar(Ov(),Lc)});var d2=m((qle,h2)=>{"use strict";c();function LQ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}h2.exports=FQ;function FQ(t,e,r){var n=r&&r.stringify||LQ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?d:0,t.charCodeAt(w+1)){case 100:case 102:if(f>=u||e[f]==null)break;d=u||e[f]==null)break;d=u||e[f]===void 0)break;d",d=w+2,w++;break}l+=n(e[f]),d=w+2,w++;break;case 115:if(f>=u)break;d{"use strict";c();var p2=d2();m2.exports=_n;var Fc=WQ().console||{},MQ={mapHttpRequest:kd,mapHttpResponse:kd,wrapRequestSerializer:Lv,wrapResponseSerializer:Lv,wrapErrorSerializer:Lv,req:kd,res:kd,err:GQ};function UQ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function _n(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||Fc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=UQ(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=Mc),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:d,set:g});let l={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:kQ(t)};u.levels=_n.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=Mc,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=w,e&&(u._logEvent=Fv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function d(){return this._level}function g(E){if(E!=="silent"&&!this.levels.values[E])throw Error("unknown level "+E);this._level=E,Aa(l,u,"error","log"),Aa(l,u,"fatal","error"),Aa(l,u,"warn","error"),Aa(l,u,"info","log"),Aa(l,u,"debug","log"),Aa(l,u,"trace","log")}function w(E,T){if(!E)throw new Error("missing bindings for child Pino");T=T||{},i&&E.serializers&&(T.serializers=E.serializers);let D=T.serializers;if(i&&D){var B=Object.assign({},n,D),W=t.browser.serialize===!0?Object.keys(B):i;delete E.serializers,jd([E],W,B,this._stdErrSerialize)}function U(A){this._childLevel=(A._childLevel|0)+1,this.error=ba(A,E,"error"),this.fatal=ba(A,E,"fatal"),this.warn=ba(A,E,"warn"),this.info=ba(A,E,"info"),this.debug=ba(A,E,"debug"),this.trace=ba(A,E,"trace"),B&&(this.serializers=B,this._serialize=W),e&&(this._logEvent=Fv([].concat(A._logEvent.bindings,E)))}return U.prototype=this,new U(this)}return u}_n.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};_n.stdSerializers=MQ;_n.stdTimeFunctions=Object.assign({},{nullTime:g2,epochTime:y2,unixTime:jQ,isoTime:QQ});function Aa(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?Mc:i[r]?i[r]:Fc[r]||Fc[n]||Mc,qQ(t,e,r)}function qQ(t,e,r){!t.transmit&&e[r]===Mc||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Fc?Fc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function ba(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.PINO_CUSTOM_CONTEXT_KEY=_a.PINO_LOGGER_DEFAULTS=void 0;_a.PINO_LOGGER_DEFAULTS={level:"info"};_a.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var _2=m(dr=>{"use strict";c();Object.defineProperty(dr,"__esModule",{value:!0});dr.generateChildLogger=dr.formatChildLoggerContext=dr.getLoggerContext=dr.setBrowserLoggerContext=dr.getBrowserLoggerContext=dr.getDefaultLoggerOptions=void 0;var Ia=Mv();function $Q(t){return Object.assign(Object.assign({},t),{level:t?.level||Ia.PINO_LOGGER_DEFAULTS.level})}dr.getDefaultLoggerOptions=$Q;function E2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}dr.getBrowserLoggerContext=E2;function v2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}dr.setBrowserLoggerContext=v2;function A2(t,e=Ia.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=E2(t,e):r=t.bindings().context||"",r}dr.getLoggerContext=A2;function b2(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=A2(t,r);return n.trim()?`${n}/${e}`:e}dr.formatChildLoggerContext=b2;function zQ(t,e,r=Ia.PINO_CUSTOM_CONTEXT_KEY){let n=b2(t,e,r),i=t.child({context:n});return v2(i,n,r)}dr.generateChildLogger=zQ});var qv=m(Sa=>{"use strict";c();Object.defineProperty(Sa,"__esModule",{value:!0});Sa.pino=void 0;var Uv=(vr(),ct(Er)),KQ=Uv.__importDefault(w2());Object.defineProperty(Sa,"pino",{enumerable:!0,get:function(){return KQ.default}});Uv.__exportStar(Mv(),Sa);Uv.__exportStar(_2(),Sa)});var n1=m(Pt=>{"use strict";c();Object.defineProperty(Pt,"__esModule",{value:!0});var Ta=(Sv(),ct(Iv)),I2=Kn();function YQ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var JQ=YQ(I2),Vv=class extends Ta.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Hv=class{constructor(e,r,n){this.core=e,this.logger=r}},Gv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},kv=class{constructor(e,r){this.logger=e,this.core=r}},jv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Qv=class extends Ta.IEvents{constructor(e){super()}},Wv=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},$v=class{constructor(){this.map=new Map}},zv=class extends Ta.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},Kv=class{constructor(e,r){this.core=e,this.logger=r}},Yv=class extends Ta.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},Jv=class{constructor(e,r){this.logger=e,this.core=r}},Xv=class{constructor(e,r){this.projectId=e,this.logger=r}},Zv=class extends JQ.default{constructor(){super()}},e1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},t1=class extends I2.EventEmitter{constructor(){super()}},r1=class{constructor(e){this.client=e}};Pt.ICore=Vv,Pt.ICrypto=Hv,Pt.IEngine=r1,Pt.IEngineEvents=t1,Pt.IExpirer=Yv,Pt.IJsonRpcHistory=Gv,Pt.IKeyChain=Kv,Pt.IMessageTracker=kv,Pt.IPairing=Jv,Pt.IPublisher=jv,Pt.IRelayer=Qv,Pt.ISignClient=e1,Pt.ISignClientEvents=Zv,Pt.IStore=Wv,Pt.ISubscriber=zv,Pt.ISubscriberTopicMap=$v,Pt.IVerify=Xv});var S2={};ft(S2,{safeJsonParse:()=>Uc,safeJsonStringify:()=>qc});function Uc(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ZQ(t)}catch{return t}}function qc(t){return typeof t=="string"?t:XQ(t)||""}var XQ,ZQ,Qd=ge(()=>{c();XQ=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),ZQ=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var C2=m(Wd=>{"use strict";c();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.BrowserRandomSource=void 0;var T2=65536,i1=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";c();Object.defineProperty(s1,"__esModule",{value:!0});function e7(t){for(var e=0;e{c()});var N2=m($d=>{"use strict";c();Object.defineProperty($d,"__esModule",{value:!0});$d.NodeRandomSource=void 0;var t7=qr(),o1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof JI<"u"){let e=x2();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";c();Object.defineProperty(zd,"__esModule",{value:!0});zd.SystemRandomSource=void 0;var r7=C2(),n7=N2(),a1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new r7.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new n7.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};zd.SystemRandomSource=a1});var D2=m(Ar=>{"use strict";c();Object.defineProperty(Ar,"__esModule",{value:!0});function i7(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}Ar.mul=Math.imul||i7;function s7(t,e){return t+e|0}Ar.add=s7;function o7(t,e){return t-e|0}Ar.sub=o7;function a7(t,e){return t<>>32-e}Ar.rotl=a7;function u7(t,e){return t<<32-e|t>>>e}Ar.rotr=u7;function c7(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ar.isInteger=Number.isInteger||c7;Ar.MAX_SAFE_INTEGER=9007199254740991;Ar.isSafeInteger=function(t){return Ar.isInteger(t)&&t>=-Ar.MAX_SAFE_INTEGER&&t<=Ar.MAX_SAFE_INTEGER}});var Ca=m(Ne=>{"use strict";c();Object.defineProperty(Ne,"__esModule",{value:!0});var P2=D2();function l7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=l7;function f7(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=f7;function h7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=h7;function d7(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=d7;function R2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=R2;Ne.writeInt16BE=R2;function B2(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=B2;Ne.writeInt16LE=B2;function u1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=u1;function c1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=c1;function l1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=l1;function f1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=f1;function Kd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Kd;Ne.writeInt32BE=Kd;function Yd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Yd;Ne.writeInt32LE=Yd;function p7(t,e){e===void 0&&(e=0);var r=u1(t,e),n=u1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=p7;function g7(t,e){e===void 0&&(e=0);var r=c1(t,e),n=c1(t,e+4);return r*4294967296+n}Ne.readUint64BE=g7;function y7(t,e){e===void 0&&(e=0);var r=l1(t,e),n=l1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=y7;function m7(t,e){e===void 0&&(e=0);var r=f1(t,e),n=f1(t,e+4);return n*4294967296+r}Ne.readUint64LE=m7;function L2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Kd(t/4294967296>>>0,e,r),Kd(t>>>0,e,r+4),e}Ne.writeUint64BE=L2;Ne.writeInt64BE=L2;function F2(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Yd(t>>>0,e,r),Yd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=F2;Ne.writeInt64LE=F2;function w7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=w7;function E7(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=v7;function A7(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!P2.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";c();Object.defineProperty(Jt,"__esModule",{value:!0});Jt.randomStringForEntropy=Jt.randomString=Jt.randomUint32=Jt.randomBytes=Jt.defaultRandomSource=void 0;var O7=O2(),D7=Ca(),M2=qr();Jt.defaultRandomSource=new O7.SystemRandomSource;function h1(t,e=Jt.defaultRandomSource){return e.randomBytes(t)}Jt.randomBytes=h1;function P7(t=Jt.defaultRandomSource){let e=h1(4,t),r=(0,D7.readUint32LE)(e);return(0,M2.wipe)(e),r}Jt.randomUint32=P7;var U2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function q2(t,e=U2,r=Jt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=h1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";c();Object.defineProperty(Jn,"__esModule",{value:!0});var Na=Ca(),xa=qr();Jn.DIGEST_LENGTH=64;Jn.BLOCK_SIZE=128;var H2=function(){function t(){this.digestLength=Jn.DIGEST_LENGTH,this.blockSize=Jn.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){xa.wipe(this._buffer),xa.wipe(this._tempHi),xa.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(d1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=d1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){xa.wipe(e.stateHi),xa.wipe(e.stateLo),e.buffer&&xa.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Jn.SHA512=H2;var V2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function d1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],l=r[2],f=r[3],d=r[4],g=r[5],w=r[6],E=r[7],T=n[0],D=n[1],B=n[2],W=n[3],U=n[4],A=n[5],I=n[6],N=n[7],_,S,R,J,Q,V,k,K;o>=128;){for(var pe=0;pe<16;pe++){var ue=8*pe+s;t[pe]=Na.readUint32BE(i,ue),e[pe]=Na.readUint32BE(i,ue+4)}for(var pe=0;pe<80;pe++){var re=a,Y=u,se=l,te=f,ie=d,M=g,le=w,ae=E,fe=T,oe=D,ce=B,y=W,v=U,b=A,P=I,C=N;if(_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(d>>>14|U<<32-14)^(d>>>18|U<<32-18)^(U>>>41-32|d<<32-(41-32)),S=(U>>>14|d<<32-14)^(U>>>18|d<<32-18)^(d>>>41-32|U<<32-(41-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=d&g^~d&w,S=U&A^~U&I,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=V2[pe*2],S=V2[pe*2+1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=t[pe%16],S=e[pe%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,R=k&65535|K<<16,J=Q&65535|V<<16,_=R,S=J,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=(a>>>28|T<<32-28)^(T>>>34-32|a<<32-(34-32))^(T>>>39-32|a<<32-(39-32)),S=(T>>>28|a<<32-28)^(a>>>34-32|T<<32-(34-32))^(a>>>39-32|T<<32-(39-32)),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,_=a&u^a&l^u&l,S=T&D^T&B^D&B,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,ae=k&65535|K<<16,C=Q&65535|V<<16,_=te,S=y,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=R,S=J,Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,te=k&65535|K<<16,y=Q&65535|V<<16,u=re,l=Y,f=se,d=te,g=ie,w=M,E=le,a=ae,D=fe,B=oe,W=ce,U=y,A=v,I=b,N=P,T=C,pe%16===15)for(var ue=0;ue<16;ue++)_=t[ue],S=e[ue],Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=t[(ue+9)%16],S=e[(ue+9)%16],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+1)%16],J=e[(ue+1)%16],_=(R>>>1|J<<32-1)^(R>>>8|J<<32-8)^R>>>7,S=(J>>>1|R<<32-1)^(J>>>8|R<<32-8)^(J>>>7|R<<32-7),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,R=t[(ue+14)%16],J=e[(ue+14)%16],_=(R>>>19|J<<32-19)^(J>>>61-32|R<<32-(61-32))^R>>>6,S=(J>>>19|R<<32-19)^(R>>>61-32|J<<32-(61-32))^(J>>>6|R<<32-6),Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,t[ue]=k&65535|K<<16,e[ue]=Q&65535|V<<16}_=a,S=T,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[0],S=n[0],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[0]=a=k&65535|K<<16,n[0]=T=Q&65535|V<<16,_=u,S=D,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[1],S=n[1],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[1]=u=k&65535|K<<16,n[1]=D=Q&65535|V<<16,_=l,S=B,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[2],S=n[2],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[2]=l=k&65535|K<<16,n[2]=B=Q&65535|V<<16,_=f,S=W,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[3],S=n[3],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[3]=f=k&65535|K<<16,n[3]=W=Q&65535|V<<16,_=d,S=U,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[4],S=n[4],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[4]=d=k&65535|K<<16,n[4]=U=Q&65535|V<<16,_=g,S=A,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[5],S=n[5],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[5]=g=k&65535|K<<16,n[5]=A=Q&65535|V<<16,_=w,S=I,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[6],S=n[6],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[6]=w=k&65535|K<<16,n[6]=I=Q&65535|V<<16,_=E,S=N,Q=S&65535,V=S>>>16,k=_&65535,K=_>>>16,_=r[7],S=n[7],Q+=S&65535,V+=S>>>16,k+=_&65535,K+=_>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[7]=E=k&65535|K<<16,n[7]=N=Q&65535|V<<16,s+=128,o-=128}return s}function B7(t){var e=new H2;e.update(t);var r=e.digest();return e.clean(),r}Jn.hash=B7});var rD=m(Ve=>{"use strict";c();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.convertSecretKeyToX25519=Ve.convertPublicKeyToX25519=Ve.verify=Ve.sign=Ve.extractPublicKeyFromSecretKey=Ve.generateKeyPair=Ve.generateKeyPairFromSeed=Ve.SEED_LENGTH=Ve.SECRET_KEY_LENGTH=Ve.PUBLIC_KEY_LENGTH=Ve.SIGNATURE_LENGTH=void 0;var L7=Vc(),Hc=G2(),$2=qr();Ve.SIGNATURE_LENGTH=64;Ve.PUBLIC_KEY_LENGTH=32;Ve.SECRET_KEY_LENGTH=64;Ve.SEED_LENGTH=32;function be(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,z2(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function K2(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function Q2(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Gc(r,t),Gc(n,e),K2(r,n)}function Y2(t){let e=new Uint8Array(32);return Gc(e,t),e[0]&1}function V7(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function js(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ws(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function je(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function Qs(t,e){je(t,e,e)}function J2(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Qs(r,r),n!==2&&n!==4&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function H7(t,e){let r=be(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Qs(r,r),n!==1&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function m1(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be(),l=be(),f=be();Ws(r,t[1],t[0]),Ws(f,e[1],e[0]),je(r,r,f),js(n,t[0],t[1]),js(f,e[0],e[1]),je(n,n,f),je(i,t[3],e[3]),je(i,i,U7),je(s,t[2],e[2]),js(s,s,s),Ws(o,n,r),Ws(a,s,i),js(u,s,i),js(l,n,r),je(t[0],o,a),je(t[1],l,u),je(t[2],u,a),je(t[3],o,l)}function W2(t,e,r){for(let n=0;n<4;n++)z2(t[n],e[n],r)}function E1(t,e){let r=be(),n=be(),i=be();J2(i,e[2]),je(r,e[0],i),je(n,e[1],i),Gc(t,n),t[31]^=Y2(r)<<7}function X2(t,e,r){Mi(t[0],y1),Mi(t[1],Oa),Mi(t[2],Oa),Mi(t[3],y1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;W2(t,e,i),m1(e,t),m1(t,t),W2(t,e,i)}}function v1(t,e){let r=[be(),be(),be(),be()];Mi(r[0],k2),Mi(r[1],j2),Mi(r[2],Oa),je(r[3],k2,j2),X2(t,r,e)}function Z2(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Hc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[be(),be(),be(),be()];v1(n,e),E1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=Z2;function G7(t){let e=(0,L7.randomBytes)(32,t),r=Z2(e);return(0,$2.wipe)(e),r}Ve.generateKeyPair=G7;function k7(t){if(t.length!==Ve.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ve.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ve.extractPublicKeyFromSecretKey=k7;var g1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function eD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*g1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*g1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function w1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;eD(t,e)}function j7(t,e){let r=new Float64Array(64),n=[be(),be(),be(),be()],i=(0,Hc.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new Hc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),w1(a),v1(n,a),E1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();w1(u);for(let l=0;l<32;l++)r[l]=a[l];for(let l=0;l<32;l++)for(let f=0;f<32;f++)r[l+f]+=u[l]*i[f];return eD(s.subarray(32),r),s}Ve.sign=j7;function tD(t,e){let r=be(),n=be(),i=be(),s=be(),o=be(),a=be(),u=be();return Mi(t[2],Oa),V7(t[1],e),Qs(i,t[1]),je(s,i,M7),Ws(i,i,t[2]),js(s,t[2],s),Qs(o,s),Qs(a,o),je(u,a,o),je(r,u,i),je(r,r,s),H7(r,r),je(r,r,i),je(r,r,s),je(r,r,s),je(t[0],r,s),Qs(n,t[0]),je(n,n,s),Q2(n,i)&&je(t[0],t[0],q7),Qs(n,t[0]),je(n,n,s),Q2(n,i)?-1:(Y2(t[0])===e[31]>>7&&Ws(t[0],y1,t[0]),je(t[3],t[0],t[1]),0)}function Q7(t,e,r){let n=new Uint8Array(32),i=[be(),be(),be(),be()],s=[be(),be(),be(),be()];if(r.length!==Ve.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ve.SIGNATURE_LENGTH} bytes`);if(tD(s,t))return!1;let o=new Hc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return w1(a),X2(i,s,a),v1(s,r.subarray(32)),m1(i,s),E1(n,i),!K2(r,n)}Ve.verify=Q7;function W7(t){let e=[be(),be(),be(),be()];if(tD(e,t))throw new Error("Ed25519: invalid public key");let r=be(),n=be(),i=e[1];js(r,Oa,i),Ws(n,Oa,i),J2(n,n),je(r,r,n);let s=new Uint8Array(32);return Gc(s,r),s}Ve.convertPublicKeyToX25519=W7;function $7(t){let e=(0,Hc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,$2.wipe)(e),r}Ve.convertSecretKeyToX25519=$7});var Jd,Xd,$s,Da,Zd,kc,ep,tp,rp,Pa,np,ip,nD,iD,sp=ge(()=>{c();Jd="EdDSA",Xd="JWT",$s=".",Da="base64url",Zd="utf8",kc="utf8",ep=":",tp="did",rp="key",Pa="base58btc",np="z",ip="K36",nD=32,iD=32});function Ui(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var jc=ge(()=>{c()});function Ra(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ui(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var op=ge(()=>{c();jc()});function ap(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Ra(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ui(r)}var A1=ge(()=>{c();op();jc()});function z7(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var K7,Y7,sD,oD=ge(()=>{c();K7=z7,Y7=K7,sD=Y7});var Rfe,aD,Xn,uD,cD,qi=ge(()=>{c();Rfe=new Uint8Array(0),aD=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},uD=t=>new TextEncoder().encode(t),cD=t=>new TextDecoder().decode(t)});var b1,_1,I1,fD,S1,Ba,Vi,J7,X7,pt,Kr=ge(()=>{c();oD();qi();b1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},_1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return fD(this,e)}},I1=class{constructor(e){this.decoders=e}or(e){return fD(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},fD=(t,e)=>new I1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),S1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new b1(e,r,n),this.decoder=new _1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ba=({name:t,prefix:e,encode:r,decode:n})=>new S1(t,e,r,n),Vi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=sD(r,e);return Ba({prefix:t,name:e,encode:n,decode:s=>Xn(i(s))})},J7=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},X7=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Ba({prefix:e,name:t,encode(i){return X7(i,n,r)},decode(i){return J7(i,n,r,t)}})});var T1={};ft(T1,{identity:()=>Z7});var Z7,hD=ge(()=>{c();Kr();qi();Z7=Ba({prefix:"\0",name:"identity",encode:t=>cD(t),decode:t=>uD(t)})});var C1={};ft(C1,{base2:()=>e9});var e9,dD=ge(()=>{c();Kr();e9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var x1={};ft(x1,{base8:()=>t9});var t9,pD=ge(()=>{c();Kr();t9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var N1={};ft(N1,{base10:()=>r9});var r9,gD=ge(()=>{c();Kr();r9=Vi({prefix:"9",name:"base10",alphabet:"0123456789"})});var O1={};ft(O1,{base16:()=>n9,base16upper:()=>i9});var n9,i9,yD=ge(()=>{c();Kr();n9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),i9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var D1={};ft(D1,{base32:()=>La,base32hex:()=>u9,base32hexpad:()=>l9,base32hexpadupper:()=>f9,base32hexupper:()=>c9,base32pad:()=>o9,base32padupper:()=>a9,base32upper:()=>s9,base32z:()=>h9});var La,s9,o9,a9,u9,c9,l9,f9,h9,P1=ge(()=>{c();Kr();La=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),u9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),f9=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h9=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var R1={};ft(R1,{base36:()=>d9,base36upper:()=>p9});var d9,p9,mD=ge(()=>{c();Kr();d9=Vi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),p9=Vi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var B1={};ft(B1,{base58btc:()=>In,base58flickr:()=>g9});var In,g9,L1=ge(()=>{c();Kr();In=Vi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),g9=Vi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var F1={};ft(F1,{base64:()=>y9,base64pad:()=>m9,base64url:()=>w9,base64urlpad:()=>E9});var y9,m9,w9,E9,wD=ge(()=>{c();Kr();y9=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),m9=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w9=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),E9=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var M1={};ft(M1,{base256emoji:()=>I9});function b9(t){return t.reduce((e,r)=>(e+=v9[r],e),"")}function _9(t){let e=[];for(let r of t){let n=A9[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var ED,v9,A9,I9,vD=ge(()=>{c();Kr();ED=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),v9=ED.reduce((t,e,r)=>(t[r]=e,t),[]),A9=ED.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);I9=Ba({prefix:"\u{1F680}",name:"base256emoji",encode:b9,decode:_9})});function _D(t,e,r){e=e||[],r=r||0;for(var n=r;t>=x9;)e[r++]=t&255|AD,t/=128;for(;t&C9;)e[r++]=t&255|AD,t>>>=7;return e[r]=t|0,_D.bytes=r-n+1,e}function U1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw U1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&bD)<=O9);return U1.bytes=s-n,r}var S9,AD,T9,C9,x9,N9,O9,bD,D9,P9,R9,B9,L9,F9,M9,U9,q9,V9,H9,G9,Qc,ID=ge(()=>{c();S9=_D,AD=128,T9=127,C9=~T9,x9=Math.pow(2,31);N9=U1,O9=128,bD=127;D9=Math.pow(2,7),P9=Math.pow(2,14),R9=Math.pow(2,21),B9=Math.pow(2,28),L9=Math.pow(2,35),F9=Math.pow(2,42),M9=Math.pow(2,49),U9=Math.pow(2,56),q9=Math.pow(2,63),V9=function(t){return t{c();ID();Wc=(t,e=0)=>[Qc.decode(t,e),Qc.decode.bytes],Fa=(t,e,r=0)=>(Qc.encode(t,e,r),e),Ma=t=>Qc.encodingLength(t)});var zs,SD,TD,Ua,zc=ge(()=>{c();qi();cp();zs=(t,e)=>{let r=e.byteLength,n=Ma(t),i=n+Ma(r),s=new Uint8Array(i+r);return Fa(t,s,0),Fa(r,s,n),s.set(e,i),new Ua(t,r,e,s)},SD=t=>{let e=Xn(t),[r,n]=Wc(e),[i,s]=Wc(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ua(r,i,o,e)},TD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&aD(t.bytes,e.bytes),Ua=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var V1,q1,H1=ge(()=>{c();zc();V1=({name:t,code:e,encode:r})=>new q1(t,e,r),q1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?zs(this.code,r):r.then(n=>zs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var G1={};ft(G1,{sha256:()=>k9,sha512:()=>j9});var xD,k9,j9,ND=ge(()=>{c();H1();xD=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),k9=V1({name:"sha2-256",code:18,encode:xD("SHA-256")}),j9=V1({name:"sha2-512",code:19,encode:xD("SHA-512")})});var k1={};ft(k1,{identity:()=>$9});var OD,Q9,DD,W9,$9,PD=ge(()=>{c();qi();zc();OD=0,Q9="identity",DD=Xn,W9=t=>zs(OD,DD(t)),$9={code:OD,name:Q9,encode:DD,digest:W9}});var RD=ge(()=>{c();qi()});var Ehe,vhe,BD=ge(()=>{c();Ehe=new TextEncoder,vhe=new TextDecoder});var hp,Y9,J9,X9,Kc,Z9,LD,FD,lp,fp,eW,tW,rW,MD=ge(()=>{c();cp();zc();L1();P1();qi();hp=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:fp,byteLength:fp,code:lp,version:lp,multihash:lp,bytes:lp,_baseCache:fp,asCID:fp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==Kc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Z9)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=zs(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&TD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return J9(r,i,e||In.encoder);default:return X9(r,i,e||La.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return tW(/^0\.0/,rW),!!(e&&(e[FD]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||LD(r,n,i.bytes))}else if(e!=null&&e[FD]===!0){let{version:r,multihash:n,code:i}=e,s=SD(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==Kc)throw new Error(`Version 0 CID must use dag-pb (code: ${Kc}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=LD(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Kc,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Xn(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Ua(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[d,g]=Wc(e.subarray(r));return r+=g,d},i=n(),s=Kc;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),l=r+u,f=l-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:l}}static parse(e,r){let[n,i]=Y9(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},Y9=(t,e)=>{switch(t[0]){case"Q":{let r=e||In;return[In.prefix,r.decode(`${In.prefix}${t}`)]}case In.prefix:{let r=e||In;return[In.prefix,r.decode(t)]}case La.prefix:{let r=e||La;return[La.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},J9=(t,e,r)=>{let{prefix:n}=r;if(n!==In.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},X9=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},Kc=112,Z9=18,LD=(t,e,r)=>{let n=Ma(t),i=n+Ma(e),s=new Uint8Array(i+r.byteLength);return Fa(t,s,0),Fa(e,s,n),s.set(r,i),s},FD=Symbol.for("@ipld/js-cid/CID"),lp={writable:!1,configurable:!1,enumerable:!0},fp={writable:!1,enumerable:!1,configurable:!1},eW="0.0.0-dev",tW=(t,e)=>{if(t.test(eW))console.warn(e);else throw new Error(e)},rW=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};de.ErrContractHasNoAddress=cm;var lm=class extends De{constructor(e){super(e)}};de.ErrMock=lm;var fm=class extends De{constructor(e){super(e)}};de.ErrTypingSystem=fm;var hm=class extends De{constructor(e,r){super(`field ${e} does not exist on struct ${r}`)}};de.ErrMissingFieldOnStruct=hm;var dm=class extends De{constructor(e,r){super(`field ${e} does not exist on enum ${r}`)}};de.ErrMissingFieldOnEnum=dm;var pm=class extends De{constructor(e){super(`cannot parse contract results: ${e}`)}};de.ErrCannotParseContractResults=pm;var gm=class extends De{constructor(e,r){super(`cannot parse outcome of transaction ${e}: ${r}`)}};de.ErrCannotParseTransactionOutcome=gm;var ym=class extends De{constructor(e){super(e)}};de.ErrCodec=ym;var mm=class extends De{constructor(e){super(e)}};de.ErrContractInteraction=mm;var wm=class extends De{constructor(){super("Method not yet implemented")}};de.ErrNotImplemented=wm;var Em=class extends De{constructor(){super("invalid arguments for relayed v1 builder")}};de.ErrInvalidRelayedV1BuilderArguments=Em;var vm=class extends De{constructor(){super("invalid arguments for relayed v2 builder")}};de.ErrInvalidRelayedV2BuilderArguments=vm;var Am=class extends De{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};de.ErrGasLimitShouldBe0ForInnerTransaction=Am;var bm=class extends De{constructor(){super("The transaction watcher requires the `isCompleted` property to be defined on the transaction object. Perhaps you've used the sdk-network-provider's `ProxyNetworkProvider.getTransaction()` and in that case you should also pass `withProcessStatus=true`.")}};de.ErrIsCompletedFieldIsMissingOnTransaction=bm});var _m=E(yi=>{"use strict";l();var d4=yi&&yi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yi,"__esModule",{value:!0});yi.TokenPayment=yi.TokenTransfer=void 0;var Du=d4(kt()),p4=Be(),BS="EGLD",LS=18;Du.default.set({ROUNDING_MODE:1});var hf=class t{constructor(e){let r=new Du.default(e.amountAsBigInteger);if(!r.isInteger()||r.isNegative())throw new p4.ErrInvalidArgument(`bad amountAsBigInteger: ${e.amountAsBigInteger}`);this.tokenIdentifier=e.tokenIdentifier,this.nonce=e.nonce,this.amountAsBigInteger=r,this.numDecimals=e.numDecimals||0}static egldFromAmount(e){let r=new Du.default(e).shiftedBy(LS).decimalPlaces(0);return this.egldFromBigInteger(r)}static egldFromBigInteger(e){return new t({tokenIdentifier:BS,nonce:0,amountAsBigInteger:e,numDecimals:LS})}static fungibleFromAmount(e,r,n){let i=new Du.default(r).shiftedBy(n).decimalPlaces(0);return this.fungibleFromBigInteger(e,i,n)}static fungibleFromBigInteger(e,r,n=0){return new t({tokenIdentifier:e,nonce:0,amountAsBigInteger:r,numDecimals:n})}static nonFungible(e,r){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:1,numDecimals:0})}static semiFungible(e,r,n){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:0})}static metaEsdtFromAmount(e,r,n,i){let s=new Du.default(n).shiftedBy(i).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,r,s,i)}static metaEsdtFromBigInteger(e,r,n,i=0){return new t({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toAmount()} ${this.tokenIdentifier}`}toAmount(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==BS}isFungible(){return this.nonce==0}};yi.TokenTransfer=hf;var Im=class extends hf{constructor(e,r,n,i){super({tokenIdentifier:e,nonce:r,amountAsBigInteger:n,numDecimals:i})}};yi.TokenPayment=Im});var Ss=E($e=>{"use strict";l();Object.defineProperty($e,"__esModule",{value:!0});$e.ARGUMENTS_SEPARATOR=$e.ESDT_TRANSFER_VALUE=$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDTNFT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_FUNCTION_NAME=$e.ESDT_TRANSFER_GAS_LIMIT=$e.TRANSACTION_VERSION_WITH_OPTIONS=$e.TRANSACTION_VERSION_DEFAULT=$e.TRANSACTION_OPTIONS_TX_GUARDED=$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=$e.TRANSACTION_OPTIONS_DEFAULT=$e.TRANSACTION_MIN_GAS_PRICE=void 0;$e.TRANSACTION_MIN_GAS_PRICE=1e9;$e.TRANSACTION_OPTIONS_DEFAULT=0;$e.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;$e.TRANSACTION_OPTIONS_TX_GUARDED=2;$e.TRANSACTION_VERSION_DEFAULT=1;$e.TRANSACTION_VERSION_WITH_OPTIONS=2;$e.ESDT_TRANSFER_GAS_LIMIT=5e5;$e.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";$e.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";$e.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";$e.ESDT_TRANSFER_VALUE="0";$e.ARGUMENTS_SEPARATOR="@"});var vr=E(nt=>{"use strict";l();var g4=nt&&nt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),y4=nt&&nt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),m4=nt&&nt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&g4(e,t,r);return y4(e,t),e};Object.defineProperty(nt,"__esModule",{value:!0});nt.isEmpty=nt.guardEmpty=nt.guardNotEmpty=nt.guardLength=nt.guardSameLength=nt.guardValueIsSetWithMessage=nt.guardValueIsSet=nt.guardTrue=void 0;var So=m4(Be());function w4(t,e){if(!t)throw new So.ErrInvariantFailed(`[<${e}>] isn't true`)}nt.guardTrue=w4;function E4(t,e){FS(`${t} isn't set (null or undefined)`,e)}nt.guardValueIsSet=E4;function FS(t,e){if(e==null||e===void 0)throw new So.ErrInvariantFailed(t)}nt.guardValueIsSetWithMessage=FS;function v4(t,e){if(t=t||[],e=e||[],t.length!=e.length)throw new So.ErrInvariantFailed("arrays do not have the same length")}nt.guardSameLength=v4;function A4(t,e){let r=t.length||0;if(r!=e)throw new So.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${r}`)}nt.guardLength=A4;function b4(t,e){if(Sm(t))throw new So.ErrInvariantFailed(`${e} is empty`)}nt.guardNotEmpty=b4;function I4(t,e){if(!Sm(t))throw new So.ErrInvariantFailed(`${e} is not empty`)}nt.guardEmpty=I4;function Sm(t){return t.isEmpty?t.isEmpty():t.length===0}nt.isEmpty=Sm});var MS=E(df=>{"use strict";l();Object.defineProperty(df,"__esModule",{value:!0});df.getJavascriptPrototypesInHierarchy=void 0;function _4(t,e){let r=[],n=Object.getPrototypeOf(t);for(;n&&e(n);)r.push(n),n=Object.getPrototypeOf(n);return r}df.getJavascriptPrototypesInHierarchy=_4});var _t=E(It=>{"use strict";l();Object.defineProperty(It,"__esModule",{value:!0});It.NullType=It.TypePlaceholder=It.isTyped=It.PrimitiveValue=It.TypedValue=It.CustomType=It.PrimitiveType=It.TypeCardinality=It.Type=void 0;var Tm=MS(),US=vr(),mi=class t{constructor(e,r=[],n=Pu.fixed(1)){US.guardValueIsSet("name",e),this.name=e,this.typeParameters=r,this.cardinality=n}getName(){return this.name}getClassName(){return t.ClassName}getClassHierarchy(){return Tm.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(r=>r.getFullyQualifiedName()).join(", ");return this.isGenericType()?`multiversx:types:${this.getName()}<${e}>`:`multiversx:types:${this.getName()}`}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}getTypeParameters(){return this.typeParameters}isGenericType(){return this.typeParameters.length>0}getFirstTypeParameter(){return US.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(n=>n.toString()).join(", "),r=e?`<${e}>`:"";return`${this.name}${r}`}equals(e){return t.equals(this,e)}static equals(e,r){return e.getFullyQualifiedName()==r.getFullyQualifiedName()}static equalsMany(e,r){return e.every((n,i)=>n.equals(r[i]))}static isAssignableFromMany(e,r){return e.every((n,i)=>n.isAssignableFrom(r[i]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!t.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let n=this.getFullyQualifiedName();return t.getFullyQualifiedNamesInHierarchy(e).includes(n)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return Tm.getJavascriptPrototypesInHierarchy(e,i=>i.belongsToTypesystem).map(i=>i.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let r of this.typeParameters)e.push(r.getName()),e.push(...r.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};It.Type=mi;mi.ClassName="Type";var Pu=class t{constructor(e,r){this.lowerBound=e,this.upperBound=r}static fixed(e){return new t(e,e)}static variable(e){return new t(0,e)}isSingular(){return this.lowerBound==1&&this.upperBound==1}isSingularOrNone(){return this.lowerBound==0&&this.upperBound==1}isComposite(){return this.upperBound!=1}isFixed(){return this.lowerBound==this.upperBound}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound||t.MaxCardinality}};It.TypeCardinality=Pu;Pu.MaxCardinality=4096;var pf=class t extends mi{constructor(e){super(e)}getClassName(){return t.ClassName}};It.PrimitiveType=pf;pf.ClassName="PrimitiveType";var gf=class t extends mi{getClassName(){return t.ClassName}};It.CustomType=gf;gf.ClassName="CustomType";var Ru=class t{constructor(e){this.type=e}getClassName(){return t.ClassName}getClassHierarchy(){return Tm.getJavascriptPrototypesInHierarchy(this,n=>n.belongsToTypesystem).map(n=>n.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};It.TypedValue=Ru;Ru.ClassName="TypedValue";var yf=class t extends Ru{constructor(e){super(e)}getClassName(){return t.ClassName}};It.PrimitiveValue=yf;yf.ClassName="PrimitiveValue";function S4(t){return t.belongsToTypesystem!==void 0}It.isTyped=S4;var mf=class t extends mi{constructor(){super("...")}getClassName(){return t.ClassName}};It.TypePlaceholder=mf;mf.ClassName="TypePlaceholder";var wf=class t extends mi{constructor(){super("?")}getClassName(){return t.ClassName}};It.NullType=wf;wf.ClassName="NullType"});var qS=E((To,Co)=>{l();(function(t){var e=typeof To=="object"&&To&&!To.nodeType&&To,r=typeof Co=="object"&&Co&&!Co.nodeType&&Co,n=typeof global=="object"&&global;(n.global===n||n.window===n||n.self===n)&&(t=n);var i,s=2147483647,o=36,a=1,u=26,c=38,f=700,h=72,g=128,y="-",m=/^xn--/,T=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},W=o-a,U=Math.floor,A=String.fromCharCode,_;function N(Y){throw new RangeError(B[Y])}function I(Y,se){for(var te=Y.length,ie=[];te--;)ie[te]=se(Y[te]);return ie}function S(Y,se){var te=Y.split("@"),ie="";te.length>1&&(ie=te[0]+"@",Y=te[1]),Y=Y.replace(O,".");var M=Y.split("."),le=I(M,se).join(".");return ie+le}function R(Y){for(var se=[],te=0,ie=Y.length,M,le;te=55296&&M<=56319&&te65535&&(se-=65536,te+=A(se>>>10&1023|55296),se=56320|se&1023),te+=A(se),te}).join("")}function Q(Y){return Y-48<10?Y-22:Y-65<26?Y-65:Y-97<26?Y-97:o}function V(Y,se){return Y+22+75*(Y<26)-((se!=0)<<5)}function k(Y,se,te){var ie=0;for(Y=te?U(Y/f):Y>>1,Y+=U(Y/se);Y>W*u>>1;ie+=o)Y=U(Y/W);return U(ie+(W+1)*Y/(Y+c))}function K(Y){var se=[],te=Y.length,ie,M=0,le=g,ae=h,he,oe,ce,w,v,b,P,C,D;for(he=Y.lastIndexOf(y),he<0&&(he=0),oe=0;oe=128&&N("not-basic"),se.push(Y.charCodeAt(oe));for(ce=he>0?he+1:0;ce=te&&N("invalid-input"),P=Q(Y.charCodeAt(ce++)),(P>=o||P>U((s-M)/v))&&N("overflow"),M+=P*v,C=b<=ae?a:b>=ae+u?u:b-ae,!(PU(s/D)&&N("overflow"),v*=D;ie=se.length+1,ae=k(M-w,ie,w==0),U(M/ie)>s-le&&N("overflow"),le+=U(M/ie),M%=ie,se.splice(M++,0,le)}return J(se)}function ge(Y){var se,te,ie,M,le,ae,he,oe,ce,w,v,b=[],P,C,D,L;for(Y=R(Y),P=Y.length,se=g,te=0,le=h,ae=0;ae=se&&vU((s-te)/C)&&N("overflow"),te+=(he-se)*C,se=he,ae=0;aes&&N("overflow"),v==se){for(oe=te,ce=o;w=ce<=le?a:ce>=le+u?u:ce-le,!(oe{"use strict";l();var HS=qS();function T4(t,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=t}function Cm(t){return t>="0"&&t<="7"}function C4(t){return t>="0"&&t<="9"||t>="a"&&t<="f"||t>="A"&&t<="F"}function VS(t){return t=parseInt(t,16),HS.ucs2.encode([t])}function GS(t,e,r){var n=!1,i=[];function s(u){var c=t[u];if(!C4(c))throw new T4(u,"Unexpected token ILLEGAL");return c}for(;e{l();var WS=kS();KS.exports={validate:x4,parse:N4};function x4(t,e){var r;if(e=e||!1,typeof t!="string")r="Input must be a string";else try{Ef(t,0,e,!1)}catch(n){r=n.message}return r}function N4(t,e){if(typeof t!="string")throw new Error("Input must be a string");e=e||!1;var r=Ef(t,0,e,!0);return r.value}function zS(t,e){for(var r=t.length,n=e,i,s=e;s-1&&t[r]==="\\";)n++,r--;return n%2===0}function R4(t,e,r,n){for(var i=e,s=",",o=[],a=e;Ts(t[a]);)a++;if(t[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Ef(t,i,r,n),c=zS(t,u.end);n&&o.push(u.value),i=c.end,s=c.value}return{start:e,end:i,value:o}}function B4(t,e){return t.substr(e,4)==="true"}function L4(t,e){return t.substr(e,5)==="false"}function F4(t,e){return t.substr(e,4)==="null"}var M4=new RegExp(/^\s$/);function Ts(t){return M4.test(t)}var U4=new RegExp(/^\d$/);function jS(t){return U4.test(t)}function Wn(t,e,r){var n=10,i;t.length{"use strict";l();var q4=an&&an.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),V4=an&&an.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),H4=an&&an.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&q4(e,t,r);return V4(e,t),e};Object.defineProperty(an,"__esModule",{value:!0});an.TypeExpressionParser=void 0;var JS=H4(Be()),G4=_t(),k4=YS(),Nm=class{parse(e){let r=this.doParse(e),n=Object.keys(r);if(n.length!=1)throw new JS.ErrTypingSystem(`bad type expression: ${e}`);let i=n[0];return this.nodeToType(i,r[i])}doParse(e){let r=this.getJsonedString(e);try{return k4.parse(r)}catch{throw new JS.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${r}.`)}}getJsonedString(e){let r="";for(var n=0;n"?a!=">"?r+=": {} }":r+="}":o==","?u==">"||(a==">"?r+=",":r+=": {},"):r+=o}let i=/(:|\{|\}|,|\s)/,s=r.replace(/utf\-8\sstring/ig,"utf-8-string").split(i).filter(o=>o);return r=s.map(o=>i.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${r}: {}}`:`{${r}}`}nodeToType(e,r){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let n=Object.keys(r).map(i=>this.nodeToType(i,r[i]));return new G4.Type(e,n)}};an.TypeExpressionParser=Nm});var Dm=E(wi=>{"use strict";l();Object.defineProperty(wi,"__esModule",{value:!0});wi.EndpointParameterDefinition=wi.EndpointModifiers=wi.EndpointDefinition=void 0;var j4=Bu(),XS="?",Q4="N / A",Om=class t{constructor(e,r,n,i){this.input=[],this.output=[],this.name=e,this.input=r||[],this.output=n||[],this.modifiers=i}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?XS:e.name,e.onlyOwner=e.onlyOwner||!1,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let r=e.inputs.map(s=>Lu.fromJSON(s)),n=e.outputs.map(s=>Lu.fromJSON(s)),i=new vf(e.mutability,e.payableInTokens,e.onlyOwner);return new t(e.name,r,n,i)}};wi.EndpointDefinition=Om;var vf=class{constructor(e,r,n){this.mutability=e||"",this.payableInTokens=r||[],this.onlyOwner=n||!1}isPayableInEGLD(){return this.isPayableInToken("EGLD")}isPayableInToken(e){return this.payableInTokens.includes(e)?!0:this.payableInTokens.includes(`!${e}`)?!1:!!this.payableInTokens.includes("*")}isPayable(){return this.payableInTokens.length!=0}isReadonly(){return this.mutability=="readonly"}isOnlyOwner(){return this.onlyOwner}};wi.EndpointModifiers=vf;var Lu=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new j4.TypeExpressionParser().parse(e.type);return new t(e.name||XS,e.description||Q4,r)}};wi.EndpointParameterDefinition=Lu});var xo=E(cr=>{"use strict";l();var W4=cr&&cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=cr&&cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=cr&&cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&W4(e,t,r);return z4(e,t),e};Object.defineProperty(cr,"__esModule",{value:!0});cr.Fields=cr.Field=cr.FieldDefinition=void 0;var Pm=$4(Be()),K4=Bu(),Rm=class t{constructor(e,r,n){this.name=e,this.description=r,this.type=n}static fromJSON(e){let r=new K4.TypeExpressionParser().parse(e.type);return new t(e.name,e.description,r)}};cr.FieldDefinition=Rm;var Bm=class{constructor(e,r=""){this.value=e,this.name=r}checkTyping(e){let r=this.value.getType();if(!r.equals(e.type))throw new Pm.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${r}"`);if(this.name!=e.name)throw new Pm.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};cr.Field=Bm;var Lm=class{static checkTyping(e,r){if(e.length!=r.length)throw new Pm.ErrTypingSystem("fields length vs. field definitions length");for(let n=0;n{"use strict";l();Object.defineProperty(Ei,"__esModule",{value:!0});Ei.EnumValue=Ei.EnumVariantDefinition=Ei.EnumType=void 0;var Y4=Be(),Fm=vr(),Af=xo(),eT=_t(),ZS=256,bf=class t extends eT.CustomType{constructor(e,r){super(e),this.variants=[],this.variants=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.variants||[]).map(n=>If.fromJSON(n));return new t(e.name,r)}getVariantByDiscriminant(e){let r=this.variants.find(n=>n.discriminant==e);return Fm.guardValueIsSet(`variant by discriminant (${e})`,r),r}getVariantByName(e){let r=this.variants.find(n=>n.name==e);return Fm.guardValueIsSet(`variant by name (${e})`,r),r}getNamesOfDependencies(){let e=[];for(let r of this.variants)e.push(...r.getNamesOfDependencies());return[...new Set(e)]}};Ei.EnumType=bf;bf.ClassName="EnumType";var If=class t{constructor(e,r,n=[]){this.fieldsDefinitions=[],Fm.guardTrue(rAf.FieldDefinition.fromJSON(n));return new t(e.name,e.discriminant,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Af.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ei.EnumVariantDefinition=If;var _f=class t extends eT.TypedValue{constructor(e,r,n){super(e),this.fields=[],this.name=r.name,this.discriminant=r.discriminant,this.fields=n,this.fieldsByName=new Map(n.map(s=>[s.name,s]));let i=r.getFieldsDefinitions();Af.Fields.checkTyping(this.fields,i)}getClassName(){return t.ClassName}static fromName(e,r){let n=e.getVariantByName(r);return new t(e,n,[])}static fromDiscriminant(e,r){let n=e.getVariantByDiscriminant(r);return new t(e,n,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields(),i=this.name==e.name,s=this.discriminant==e.discriminant,o=Af.Fields.equals(r,n);return i&&s&&o}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new Y4.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach((r,n)=>e.fields[n]=r.value.valueOf()),e}};Ei.EnumValue=_f;_f.ClassName="EnumValue"});var rT=E(No=>{"use strict";l();Object.defineProperty(No,"__esModule",{value:!0});No.EventTopicDefinition=No.EventDefinition=void 0;var J4=Bu(),tT="?",Mm=class t{constructor(e,r){this.inputs=[],this.identifier=e,this.inputs=r||[]}static fromJSON(e){e.identifier=e.identifier==null?tT:e.identifier,e.inputs=e.inputs||[];let r=e.inputs.map(n=>Sf.fromJSON(n));return new t(e.identifier,r)}};No.EventDefinition=Mm;var Sf=class t{constructor(e){this.name=e.name,this.type=e.type,this.indexed=e.indexed}static fromJSON(e){let r=new J4.TypeExpressionParser().parse(e.type);return new t({name:e.name||tT,type:r,indexed:e.indexed})}};No.EventTopicDefinition=Sf});var Do=E(Oo=>{"use strict";l();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.Struct=Oo.StructType=void 0;var X4=Be(),Tf=xo(),nT=_t(),Cf=class t extends nT.CustomType{constructor(e,r){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=r}getClassName(){return t.ClassName}static fromJSON(e){let r=(e.fields||[]).map(n=>Tf.FieldDefinition.fromJSON(n));return new t(e.name,r)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(r=>r.name==e)}getNamesOfDependencies(){return Tf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Oo.StructType=Cf;Cf.ClassName="StructType";var xf=class t extends nT.TypedValue{constructor(e,r){super(e),this.fields=r,this.fieldsByName=new Map(r.map(n=>[n.name,n])),this.checkTyping()}getClassName(){return t.ClassName}checkTyping(){let r=this.getType().getFieldsDefinitions();Tf.Fields.checkTyping(this.fields,r)}getFields(){return this.fields}getFieldValue(e){let r=this.fieldsByName.get(e);if(r)return r.value.valueOf();throw new X4.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let r of this.fields)e[r.name]=r.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let r=this.getFields(),n=e.getFields();return Tf.Fields.equals(r,n)}};Oo.Struct=xf;xf.ClassName="Struct"});var qm=E((jse,oT)=>{"use strict";l();var Of="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Um={};for(Mu=0;Mu>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function iT(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=Po(e)^n>>5}for(e=Po(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=iT(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",s=0;s>5)throw new Error("Non 5-bit word");n=Po(n)^o,i+=Of.charAt(o)}for(s=0;s<6;++s)n=Po(n);for(n^=1,s=0;s<6;++s){var a=n>>(5-s)*5&31;i+=Of.charAt(a)}return i}function sT(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var s=t.slice(0,i),o=t.slice(i+1);if(o.length<6)return"Data too short";var a=iT(s);if(typeof a=="string")return a;for(var u=[],c=0;c=o.length)&&u.push(h)}return a!==1?"Invalid checksum for "+t:{prefix:s,words:u}}function eq(){var t=sT.apply(null,arguments);if(typeof t=="object")return t}function tq(t){var e=sT.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Df(t,e,r,n){for(var i=0,s=0,o=(1<=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<{"use strict";l();var oq=un&&un.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aq=un&&un.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),aT=un&&un.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oq(e,t,r);return aq(e,t),e};Object.defineProperty(un,"__esModule",{value:!0});un.Address=void 0;var Pf=aT(qm()),Ro=aT(Be()),Vm="erd",Hm=32,uq="0".repeat(16),Gm=class t{constructor(e){if(this.valueHex="",!!e){if(e instanceof t)return t.fromAddress(e);if(e instanceof d.Buffer)return t.fromBuffer(e);if(typeof e=="string")return t.fromString(e);throw new Ro.ErrAddressCannotCreate(e)}}static fromAddress(e){return t.fromValidHex(e.valueHex)}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Hm)throw new Ro.ErrAddressCannotCreate(e);return t.fromValidHex(e.toString("hex"))}static fromString(e){return t.isValidHex(e)?t.fromValidHex(e):t.fromBech32(e)}static isValidHex(e){return d.Buffer.from(e,"hex").length==Hm}static fromHex(e){if(!t.isValidHex(e))throw new Ro.ErrAddressCannotCreate(e);return t.fromValidHex(e)}static empty(){return new t}static fromBech32(e){let r;try{r=Pf.decode(e)}catch(s){throw new Ro.ErrAddressCannotCreate(e,s)}let n=r.prefix;if(n!=Vm)throw new Ro.ErrAddressBadHrp(Vm,n);let i=d.Buffer.from(Pf.fromWords(r.words));if(i.length!=Hm)throw new Ro.ErrAddressCannotCreate(e);return t.fromValidHex(i.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Pf.toWords(this.pubkey());return Pf.encode(Vm,e)}pubkey(){return this.isEmpty()?d.Buffer.from([]):d.Buffer.from(this.valueHex,"hex")}isEmpty(){return!this.valueHex}equals(e){return e?this.valueHex==e.valueHex:!1}toString(){return this.bech32()}toJSON(){return{bech32:this.bech32(),pubkey:this.hex()}}static Zero(){return new t("0".repeat(64))}isContractAddress(){return this.hex().startsWith(uq)}};un.Address=Gm});var Lo=E(Bo=>{"use strict";l();Object.defineProperty(Bo,"__esModule",{value:!0});Bo.AddressValue=Bo.AddressType=void 0;var cq=ht(),uT=_t(),Uu=class t extends uT.PrimitiveType{constructor(){super("Address")}getClassName(){return t.ClassName}};Bo.AddressType=Uu;Uu.ClassName="AddressType";var Rf=class t extends uT.PrimitiveValue{constructor(e){super(new Uu),this.value=new cq.Address(e.bech32())}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Bo.AddressValue=Rf;Rf.ClassName="AddressValue"});var Lf=E(Fo=>{"use strict";l();Object.defineProperty(Fo,"__esModule",{value:!0});Fo.OptionalValue=Fo.OptionalType=void 0;var lq=vr(),qu=_t(),Vu=class t extends qu.Type{constructor(e){super("Optional",[e],qu.TypeCardinality.variable(1))}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(qu.NullType.ClassName);return r||n}};Fo.OptionalType=Vu;Vu.ClassName="OptionalType";var Bf=class t extends qu.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Vu(new qu.NullType);return new t(e)}isSet(){return!!this.value}getTypedValue(){return lq.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};Fo.OptionalValue=Bf;Bf.ClassName="OptionalValue"});var Gu=E(Mo=>{"use strict";l();Object.defineProperty(Mo,"__esModule",{value:!0});Mo.BooleanValue=Mo.BooleanType=void 0;var cT=_t(),Hu=class t extends cT.PrimitiveType{constructor(){super("bool")}getClassName(){return t.ClassName}};Mo.BooleanType=Hu;Hu.ClassName="BooleanType";var Ff=class t extends cT.PrimitiveValue{constructor(e){super(new Hu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Mo.BooleanValue=Ff;Ff.ClassName="BooleanValue"});var vi=E(Uo=>{"use strict";l();Object.defineProperty(Uo,"__esModule",{value:!0});Uo.BytesValue=Uo.BytesType=void 0;var lT=_t(),ku=class t extends lT.PrimitiveType{constructor(){super("bytes")}getClassName(){return t.ClassName}};Uo.BytesType=ku;ku.ClassName="BytesType";var Mf=class t extends lT.PrimitiveValue{constructor(e){super(new ku),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){let r=d.Buffer.from(e,"utf-8");return new t(r)}static fromHex(e){let r=d.Buffer.from(e,"hex");return new t(r)}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value.equals(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Uo.BytesValue=Mf;Mf.ClassName="BytesValue"});var hT=E(qo=>{"use strict";l();Object.defineProperty(qo,"__esModule",{value:!0});qo.CodeMetadataValue=qo.CodeMetadataType=void 0;var fT=_t(),Uf=class extends fT.PrimitiveType{constructor(){super("CodeMetadata")}};qo.CodeMetadataType=Uf;var km=class extends fT.PrimitiveValue{constructor(e){super(new Uf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};qo.CodeMetadataValue=km});var Vf=E(Vo=>{"use strict";l();Object.defineProperty(Vo,"__esModule",{value:!0});Vo.CompositeValue=Vo.CompositeType=void 0;var fq=vr(),jm=_t(),ju=class t extends jm.Type{constructor(...e){super("Composite",e,jm.TypeCardinality.variable(e.length))}getClassName(){return t.ClassName}};Vo.CompositeType=ju;ju.ClassName="CompositeType";var qf=class t extends jm.TypedValue{constructor(e,r){super(e),fq.guardLength(r,e.getTypeParameters().length),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){let r=e.map(i=>i.getType()),n=new ju(...r);return new t(n,e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e?.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";l();Object.defineProperty(Hf,"__esModule",{value:!0});Hf.CollectionOfTypedValues=void 0;var Qm=class{constructor(e){this.items=e}getLength(){return this.items.length}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getLength()!=e.getLength())return!1;for(let r=0;r{"use strict";l();Object.defineProperty(cn,"__esModule",{value:!0});cn.List=cn.OptionValue=cn.ListType=cn.OptionType=void 0;var hq=vr(),dq=Wm(),xs=_t(),Cs=class t extends xs.Type{constructor(e){super("Option",[e])}getClassName(){return t.ClassName}isAssignableFrom(e){if(!e.hasExactClass(t.ClassName))return!1;let r=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),n=e.getFirstTypeParameter().hasExactClass(xs.NullType.ClassName);return r||n}};cn.OptionType=Cs;Cs.ClassName="OptionType";var Qu=class t extends xs.Type{constructor(e){super("List",[e])}getClassName(){return t.ClassName}};cn.ListType=Qu;Qu.ClassName="ListType";var Gf=class t extends xs.TypedValue{constructor(e,r=null){super(e),this.value=r}getClassName(){return t.ClassName}static newMissing(){let e=new Cs(new xs.NullType);return new t(e)}static newMissingTyped(e){return new t(new Cs(e))}static newProvided(e){let r=new Cs(e.getType());return new t(r,e)}isSet(){return!!this.value}getTypedValue(){return hq.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var r;return((r=this.value)===null||r===void 0?void 0:r.equals(e.value))||!1}};cn.OptionValue=Gf;Gf.ClassName="OptionValue";var kf=class t extends xs.TypedValue{constructor(e,r){super(e),this.backingCollection=new dq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length==0)return new t(new xs.TypePlaceholder,[]);let r=e[0].getType(),n=new Qu(r);return new t(n,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};cn.List=kf;kf.ClassName="List"});var Wf=E(Ho=>{"use strict";l();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.ArrayVec=Ho.ArrayVecType=void 0;var dT=vr(),pq=Wm(),pT=_t(),jf=class t extends pT.Type{constructor(e,r){super("Array",[r]),dT.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return t.ClassName}};Ho.ArrayVecType=jf;jf.ClassName="ArrayVecType";var Qf=class t extends pT.TypedValue{constructor(e,r){super(e),dT.guardLength(r,e.length),this.backingCollection=new pq.CollectionOfTypedValues(r)}getClassName(){return t.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Ho.ArrayVec=Qf;Qf.ClassName="ArrayVec"});var $u=E(Go=>{"use strict";l();Object.defineProperty(Go,"__esModule",{value:!0});Go.H256Value=Go.H256Type=void 0;var gT=_t(),zu=class t extends gT.PrimitiveType{constructor(){super("H256")}getClassName(){return t.ClassName}};Go.H256Type=zu;zu.ClassName="H256Type";var zf=class t extends gT.PrimitiveValue{constructor(e){super(new zu),this.value=e}getClassName(){return t.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Go.H256Value=zf;zf.ClassName="H256Value"});var Kf=E(ko=>{"use strict";l();Object.defineProperty(ko,"__esModule",{value:!0});ko.NothingValue=ko.NothingType=void 0;var yT=_t(),Ku=class t extends yT.PrimitiveType{constructor(){super("nothing")}getClassName(){return t.ClassName}};ko.NothingType=Ku;Ku.ClassName="NothingType";var $f=class t extends yT.PrimitiveValue{constructor(){super(new Ku)}getClassName(){return t.ClassName}equals(e){return!1}valueOf(){return{}}};ko.NothingValue=$f;$f.ClassName="NothingValue"});var oc=E(_e=>{"use strict";l();var gq=_e&&_e.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yq=_e&&_e.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mq=_e&&_e.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&gq(e,t,r);return yq(e,t),e},wq=_e&&_e.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_e,"__esModule",{value:!0});_e.BigIntValue=_e.BigUIntValue=_e.I64Value=_e.U64Value=_e.I32Value=_e.U32Value=_e.I16Value=_e.U16Value=_e.I8Value=_e.U8Value=_e.NumericalValue=_e.BigIntType=_e.BigUIntType=_e.I64Type=_e.U64Type=_e.I32Type=_e.U32Type=_e.I16Type=_e.U16Type=_e.I8Type=_e.U8Type=_e.NumericalType=void 0;var mT=mq(Be()),wT=_t(),Ns=wq(kt()),lr=class t extends wT.PrimitiveType{constructor(e,r,n){super(e),this.sizeInBytes=r,this.withSign=n}getClassName(){return t.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};_e.NumericalType=lr;lr.ClassName="NumericalType";var Yu=class t extends lr{constructor(){super("u8",1,!1)}getClassName(){return t.ClassName}};_e.U8Type=Yu;Yu.ClassName="U8Type";var Ju=class t extends lr{constructor(){super("i8",1,!0)}getClassName(){return t.ClassName}};_e.I8Type=Ju;Ju.ClassName="I8Type";var Xu=class t extends lr{constructor(){super("u16",2,!1)}getClassName(){return t.ClassName}};_e.U16Type=Xu;Xu.ClassName="U16Type";var Zu=class t extends lr{constructor(){super("i16",2,!0)}getClassName(){return t.ClassName}};_e.I16Type=Zu;Zu.ClassName="I16Type";var ec=class t extends lr{constructor(){super("u32",4,!1)}getClassName(){return t.ClassName}};_e.U32Type=ec;ec.ClassName="U32Type";var tc=class t extends lr{constructor(){super("i32",4,!0)}getClassName(){return t.ClassName}};_e.I32Type=tc;tc.ClassName="I32Type";var rc=class t extends lr{constructor(){super("u64",8,!1)}getClassName(){return t.ClassName}};_e.U64Type=rc;rc.ClassName="U64Type";var nc=class t extends lr{constructor(){super("i64",8,!0)}getClassName(){return t.ClassName}};_e.I64Type=nc;nc.ClassName="I64Type";var ic=class t extends lr{constructor(){super("BigUint",0,!1)}getClassName(){return t.ClassName}};_e.BigUIntType=ic;ic.ClassName="BigUIntType";var sc=class t extends lr{constructor(){super("Bigint",0,!0)}getClassName(){return t.ClassName}};_e.BigIntType=sc;sc.ClassName="BigIntType";var fr=class t extends wT.PrimitiveValue{constructor(e,r){if(super(e),this.value=new Ns.default(r),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new mT.ErrInvalidArgument(`not a number: ${r}`);if(!this.withSign&&this.value.isNegative())throw new mT.ErrInvalidArgument(`negative, but type is unsigned: ${r}`)}getClassName(){return t.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};_e.NumericalValue=fr;fr.ClassName="NumericalValue";var Yf=class t extends fr{constructor(e){super(new Yu,new Ns.default(e))}getClassName(){return t.ClassName}};_e.U8Value=Yf;Yf.ClassName="U8Value";var Jf=class t extends fr{constructor(e){super(new Ju,new Ns.default(e))}getClassName(){return t.ClassName}};_e.I8Value=Jf;Jf.ClassName="I8Value";var Xf=class t extends fr{constructor(e){super(new Xu,new Ns.default(e))}getClassName(){return t.ClassName}};_e.U16Value=Xf;Xf.ClassName="U16Value";var Zf=class t extends fr{constructor(e){super(new Zu,new Ns.default(e))}getClassName(){return t.ClassName}};_e.I16Value=Zf;Zf.ClassName="I16Value";var eh=class t extends fr{constructor(e){super(new ec,new Ns.default(e))}getClassName(){return t.ClassName}};_e.U32Value=eh;eh.ClassName="U32Value";var th=class t extends fr{constructor(e){super(new tc,new Ns.default(e))}getClassName(){return t.ClassName}};_e.I32Value=th;th.ClassName="I32Value";var rh=class t extends fr{constructor(e){super(new rc,e)}getClassName(){return t.ClassName}};_e.U64Value=rh;rh.ClassName="U64Value";var nh=class t extends fr{constructor(e){super(new nc,e)}getClassName(){return t.ClassName}};_e.I64Value=nh;nh.ClassName="I64Value";var ih=class t extends fr{constructor(e){super(new ic,e)}getClassName(){return t.ClassName}};_e.BigUIntValue=ih;ih.ClassName="BigUIntValue";var sh=class t extends fr{constructor(e){super(new sc,e)}getClassName(){return t.ClassName}};_e.BigIntValue=sh;sh.ClassName="BigIntValue"});var ah=E(jo=>{"use strict";l();Object.defineProperty(jo,"__esModule",{value:!0});jo.StringValue=jo.StringType=void 0;var ET=_t(),ac=class t extends ET.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return t.ClassName}};jo.StringType=ac;ac.ClassName="StringType";var oh=class t extends ET.PrimitiveValue{constructor(e){super(new ac),this.value=e}getClassName(){return t.ClassName}static fromUTF8(e){return new t(e)}static fromHex(e){let r=d.Buffer.from(e,"hex").toString();return new t(r)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};jo.StringValue=oh;oh.ClassName="StringValue"});var Wo=E(Qo=>{"use strict";l();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.TokenIdentifierValue=Qo.TokenIdentifierType=void 0;var vT=_t(),Eq="EGLD",uc=class t extends vT.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return t.ClassName}};Qo.TokenIdentifierType=uc;uc.ClassName="TokenIdentifierType";var uh=class t extends vT.PrimitiveValue{constructor(e){super(new uc),this.value=e}static egld(){return new t(Eq)}static esdtTokenIdentifier(e){return new t(e)}getClassName(){return t.ClassName}getLength(){return this.value.length}equals(e){return this.getLength()!=e.getLength()?!1:this.value==e.value}valueOf(){return this.value}toString(){return this.value.toString()}};Qo.TokenIdentifierValue=uh;uh.ClassName="TokenIdentifierValue"});var lh=E(Cr=>{"use strict";l();var vq=Cr&&Cr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Aq=Cr&&Cr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bq=Cr&&Cr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vq(e,t,r);return Aq(e,t),e};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.Tuple=Cr.TupleType=void 0;var Iq=bq(Be()),AT=xo(),bT=Do(),cc=class t extends bT.StructType{constructor(...e){super(t.prepareName(e),t.prepareFieldDefinitions(e))}getClassName(){return t.ClassName}static prepareName(e){return`tuple<${e.map(i=>i.toString()).join(", ")}>`}static prepareFieldDefinitions(e){return e.map((n,i)=>new AT.FieldDefinition(IT(i),"anonymous tuple field",n))}};Cr.TupleType=cc;cc.ClassName="TupleType";function IT(t){return`field${t}`}var ch=class t extends bT.Struct{constructor(e,r){super(e,r)}getClassName(){return t.ClassName}static fromItems(e){if(e.length<1)throw new Iq.ErrTypingSystem("bad tuple items");let r=e.map(s=>s.getType()),n=new cc(...r),i=e.map((s,o)=>new AT.Field(s,IT(o)));return new t(n,i)}};Cr.Tuple=ch;ch.ClassName="Tuple"});var dh=E(Ai=>{"use strict";l();Object.defineProperty(Ai,"__esModule",{value:!0});Ai.VariadicValue=Ai.CountedVariadicType=Ai.VariadicType=void 0;var zo=_t(),Os=class t extends zo.Type{constructor(e,r=!1){super("Variadic",[e],zo.TypeCardinality.variable()),this.isCounted=r}getClassName(){return t.ClassName}};Ai.VariadicType=Os;Os.ClassName="VariadicType";var fh=class extends zo.Type{constructor(e){super("Variadic",[e],zo.TypeCardinality.variable())}getClassName(){return Os.ClassName}};Ai.CountedVariadicType=fh;fh.ClassName="VariadicType";var hh=class t extends zo.TypedValue{constructor(e,r){super(e),this.items=r}getClassName(){return t.ClassName}static fromItems(...e){return this.createFromItems(e,!1)}static fromItemsCounted(...e){return this.createFromItems(e,!0)}static createFromItems(e,r){if(e.length==0)return new t(new Os(new zo.TypePlaceholder,r),[]);let n=e[0].getType();return new t(new Os(n,r),e)}getItems(){return this.items}valueOf(){return this.items.map(e=>e.valueOf())}equals(e){if(this.getType().differs(e.getType()))return!1;for(let r=0;r{"use strict";l();var _q=fn&&fn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Sq=fn&&fn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Tq=fn&&fn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&_q(e,t,r);return Sq(e,t),e};Object.defineProperty(fn,"__esModule",{value:!0});fn.TypeMapper=void 0;var _T=Tq(Be()),Cq=Lo(),zm=Lf(),xq=Gu(),Nq=vi(),Oq=hT(),ph=Vf(),$m=Fu(),Dq=xo(),ST=Wu(),ln=Wf(),Pq=$u(),TT=Kf(),xr=oc(),Rq=ah(),CT=Do(),xT=Wo(),bi=lh(),gh=dh(),Km=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...r)=>new ST.OptionType(r[0])],["List",(...r)=>new ST.ListType(r[0])],["VarArgs",(...r)=>new gh.VariadicType(r[0])],["MultiResultVec",(...r)=>new gh.VariadicType(r[0])],["variadic",(...r)=>new gh.VariadicType(r[0])],["counted-variadic",(...r)=>new gh.VariadicType(r[0],!0)],["OptionalArg",(...r)=>new zm.OptionalType(r[0])],["optional",(...r)=>new zm.OptionalType(r[0])],["OptionalResult",(...r)=>new zm.OptionalType(r[0])],["multi",(...r)=>new ph.CompositeType(...r)],["MultiArg",(...r)=>new ph.CompositeType(...r)],["MultiResult",(...r)=>new ph.CompositeType(...r)],["multi",(...r)=>new ph.CompositeType(...r)],["tuple",(...r)=>new bi.TupleType(...r)],["tuple2",(...r)=>new bi.TupleType(...r)],["tuple3",(...r)=>new bi.TupleType(...r)],["tuple4",(...r)=>new bi.TupleType(...r)],["tuple5",(...r)=>new bi.TupleType(...r)],["tuple6",(...r)=>new bi.TupleType(...r)],["tuple7",(...r)=>new bi.TupleType(...r)],["tuple8",(...r)=>new bi.TupleType(...r)],["array2",(...r)=>new ln.ArrayVecType(2,r[0])],["array8",(...r)=>new ln.ArrayVecType(8,r[0])],["array16",(...r)=>new ln.ArrayVecType(16,r[0])],["array20",(...r)=>new ln.ArrayVecType(20,r[0])],["array32",(...r)=>new ln.ArrayVecType(32,r[0])],["array46",(...r)=>new ln.ArrayVecType(46,r[0])],["array48",(...r)=>new ln.ArrayVecType(48,r[0])],["array64",(...r)=>new ln.ArrayVecType(64,r[0])],["array128",(...r)=>new ln.ArrayVecType(128,r[0])],["array256",(...r)=>new ln.ArrayVecType(256,r[0])]]),this.closedTypesMap=new Map([["u8",new xr.U8Type],["u16",new xr.U16Type],["u32",new xr.U32Type],["u64",new xr.U64Type],["U64",new xr.U64Type],["BigUint",new xr.BigUIntType],["i8",new xr.I8Type],["i16",new xr.I16Type],["i32",new xr.I32Type],["i64",new xr.I64Type],["Bigint",new xr.BigIntType],["BigInt",new xr.BigIntType],["bool",new xq.BooleanType],["bytes",new Nq.BytesType],["Address",new Cq.AddressType],["H256",new Pq.H256Type],["utf-8 string",new Rq.StringType],["TokenIdentifier",new xT.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new xT.TokenIdentifierType],["CodeMetadata",new Oq.CodeMetadataType],["nothing",new TT.NothingType],["AsyncCall",new TT.NothingType]]),this.learnedTypesMap=new Map;for(let r of e)this.learnedTypesMap.set(r.getName(),r)}mapType(e){let r=this.mapTypeRecursively(e);if(r)return r.isGenericType()||this.learnType(r),r;throw new _T.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let r=e.isGenericType(),n=this.learnedTypesMap.get(e.getName());if(n)return n;let i=this.closedTypesMap.get(e.getName());return i||(e.hasExactClass($m.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(CT.StructType.ClassName)?this.mapStructType(e):r?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let r=this.mappedFields(e.getFieldsDefinitions());return new CT.StructType(e.getName(),r)}mapEnumType(e){let r=e.variants.map(i=>new $m.EnumVariantDefinition(i.name,i.discriminant,this.mappedFields(i.getFieldsDefinitions())));return new $m.EnumType(e.getName(),r)}mappedFields(e){return e.map(r=>new Dq.FieldDefinition(r.name,r.description,this.mapType(r.type)))}mapGenericType(e){let n=e.getTypeParameters().map(s=>this.mapType(s)),i=this.openTypesFactories.get(e.getName());if(!i)throw new _T.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return i(...n)}};fn.TypeMapper=Km});var RT=E(hn=>{"use strict";l();var Bq=hn&&hn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Lq=hn&&hn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Fq=hn&&hn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Bq(e,t,r);return Lq(e,t),e};Object.defineProperty(hn,"__esModule",{value:!0});hn.AbiRegistry=void 0;var NT=Fq(Be()),lc=vr(),fc=Dm(),OT=Fu(),Jm=rT(),DT=Do(),Mq=Ym(),Uq="?",Xm=class t{constructor(e){this.endpoints=[],this.customTypes=[],this.events=[],this.name=e.name,this.constructorDefinition=e.constructorDefinition,this.endpoints=e.endpoints,this.customTypes=e.customTypes,this.events=e.events||[]}static create(e){let r=e.name||Uq,n=e.constructor||{},i=e.endpoints||[],s=e.types||{},o=e.events||[],a=fc.EndpointDefinition.fromJSON(Object.assign({name:"constructor"},n)),u=i.map(y=>fc.EndpointDefinition.fromJSON(y)),c=[];for(let y in s){let m=s[y];if(m.type=="struct")c.push(DT.StructType.fromJSON({name:y,fields:m.fields}));else if(m.type=="enum")c.push(OT.EnumType.fromJSON({name:y,variants:m.variants}));else throw new NT.ErrTypingSystem(`Cannot handle custom type: ${y}`)}let f=o.map(y=>Jm.EventDefinition.fromJSON(y));return new t({name:r,constructorDefinition:a,endpoints:u,customTypes:c,events:f}).remapToKnownTypes()}getCustomType(e){let r=this.customTypes.find(n=>n.getName()==e);return lc.guardValueIsSetWithMessage(`custom type [${e}] not found`,r),r}getStruct(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(DT.StructType.ClassName));return lc.guardValueIsSetWithMessage(`struct [${e}] not found`,r),r}getStructs(e){return e.map(r=>this.getStruct(r))}getEnum(e){let r=this.customTypes.find(n=>n.getName()==e&&n.hasExactClass(OT.EnumType.ClassName));return lc.guardValueIsSetWithMessage(`enum [${e}] not found`,r),r}getEnums(e){return e.map(r=>this.getEnum(r))}getEndpoints(){return this.endpoints}getEndpoint(e){let r=this.endpoints.find(n=>n.name==e);return lc.guardValueIsSetWithMessage(`endpoint [${e}] not found`,r),r}getEvent(e){let r=this.events.find(n=>n.identifier==e);return lc.guardValueIsSetWithMessage(`event [${e}] not found`,r),r}remapToKnownTypes(){let e=new Mq.TypeMapper([]),r=[];for(let a of this.customTypes)this.mapCustomTypeDepthFirst(a,this.customTypes,e,r);if(this.customTypes.length!=r.length)throw new NT.ErrTypingSystem("Did not re-map all custom types");let n=PT(this.constructorDefinition,e),i=[];for(let a of this.endpoints)i.push(PT(a,e));let s=this.events.map(a=>qq(a,e));return new t({name:this.name,constructorDefinition:n,endpoints:i,customTypes:r,events:s})}mapCustomTypeDepthFirst(e,r,n,i){if(i.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=r.find(c=>c.getName()==a);u&&this.mapCustomTypeDepthFirst(u,r,n,i)}let o=n.mapType(e);i.push(o)}};hn.AbiRegistry=Xm;function PT(t,e){let r=t.input.map(i=>new fc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type))),n=t.output.map(i=>new fc.EndpointParameterDefinition(i.name,i.description,e.mapType(i.type)));return new fc.EndpointDefinition(t.name,r,n,t.modifiers)}function qq(t,e){let r=t.inputs.map(n=>new Jm.EventTopicDefinition({name:n.name,type:e.mapType(n.type),indexed:n.indexed}));return new Jm.EventDefinition(t.identifier,r)}});var LT=E($o=>{"use strict";l();Object.defineProperty($o,"__esModule",{value:!0});$o.createListOfTokenIdentifiers=$o.createListOfAddresses=void 0;var Vq=Lo(),BT=Wu(),Hq=Wo();function Gq(t){let e=t.map(n=>new Vq.AddressValue(n));return BT.List.fromItems(e)}$o.createListOfAddresses=Gq;function kq(t){let e=t.map(n=>new Hq.TokenIdentifierValue(n));return BT.List.fromItems(e)}$o.createListOfTokenIdentifiers=kq});var KT=E(Kt=>{"use strict";l();var jq=Kt&&Kt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Qq=Kt&&Kt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wq=Kt&&Kt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jq(e,t,r);return Qq(e,t),e};Object.defineProperty(Kt,"__esModule",{value:!0});Kt.onPrimitiveTypeSelect=Kt.onPrimitiveValueSelect=Kt.onTypedValueSelect=Kt.onTypeSelect=void 0;var mh=Wq(Be()),FT=Lo(),MT=Gu(),UT=vi(),qT=Fu(),yh=Wu(),VT=$u(),HT=oc(),GT=Kf(),kT=Do(),jT=Wo(),QT=lh(),WT=_t(),zT=Wf(),$T=ah();function zq(t,e){if(t.hasExactClass(yh.OptionType.ClassName))return e.onOption();if(t.hasExactClass(yh.ListType.ClassName))return e.onList();if(t.hasExactClass(zT.ArrayVecType.ClassName))return e.onArray();if(t.hasClassOrSuperclass(WT.PrimitiveType.ClassName))return e.onPrimitive();if(t.hasExactClass(kT.StructType.ClassName))return e.onStruct();if(t.hasExactClass(QT.TupleType.ClassName))return e.onTuple();if(t.hasExactClass(qT.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`type isn't known: ${t}`)}Kt.onTypeSelect=zq;function $q(t,e){if(t.hasClassOrSuperclass(WT.PrimitiveValue.ClassName))return e.onPrimitive();if(t.hasExactClass(yh.OptionValue.ClassName))return e.onOption();if(t.hasExactClass(yh.List.ClassName))return e.onList();if(t.hasExactClass(zT.ArrayVec.ClassName))return e.onArray();if(t.hasExactClass(kT.Struct.ClassName))return e.onStruct();if(t.hasExactClass(QT.Tuple.ClassName))return e.onTuple();if(t.hasExactClass(qT.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`value isn't typed: ${t}`)}Kt.onTypedValueSelect=$q;function Kq(t,e){if(t.hasExactClass(MT.BooleanValue.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(HT.NumericalValue.ClassName))return e.onNumerical();if(t.hasExactClass(FT.AddressValue.ClassName))return e.onAddress();if(t.hasExactClass(UT.BytesValue.ClassName))return e.onBytes();if(t.hasExactClass($T.StringValue.ClassName))return e.onString();if(t.hasExactClass(VT.H256Value.ClassName))return e.onH256();if(t.hasExactClass(jT.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(t.hasExactClass(GT.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`value isn't a primitive: ${t.getType()}`)}Kt.onPrimitiveValueSelect=Kq;function Yq(t,e){if(t.hasExactClass(MT.BooleanType.ClassName))return e.onBoolean();if(t.hasClassOrSuperclass(HT.NumericalType.ClassName))return e.onNumerical();if(t.hasExactClass(FT.AddressType.ClassName))return e.onAddress();if(t.hasExactClass(UT.BytesType.ClassName))return e.onBytes();if(t.hasExactClass($T.StringType.ClassName))return e.onString();if(t.hasExactClass(VT.H256Type.ClassName))return e.onH256();if(t.hasExactClass(jT.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(t.hasExactClass(GT.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mh.ErrTypingSystem(`type isn't a known primitive: ${t}`)}Kt.onPrimitiveTypeSelect=Yq});var St=E(qe=>{"use strict";l();var Jq=qe&&qe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),it=qe&&qe.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Jq(e,t,r)};Object.defineProperty(qe,"__esModule",{value:!0});it(RT(),qe);it(Lo(),qe);it(Lf(),qe);it(Gu(),qe);it(vi(),qe);it(Vf(),qe);it(Dm(),qe);it(Fu(),qe);it(LT(),qe);it(xo(),qe);it(Wu(),qe);it(Wf(),qe);it($u(),qe);it(KT(),qe);it(Kf(),qe);it(oc(),qe);it(ah(),qe);it(Do(),qe);it(Wo(),qe);it(lh(),qe);it(Bu(),qe);it(Ym(),qe);it(_t(),qe);it(dh(),qe)});var JT=E(dn=>{"use strict";l();var Xq=dn&&dn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Zq=dn&&dn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),eV=dn&&dn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Xq(e,t,r);return Zq(e,t),e};Object.defineProperty(dn,"__esModule",{value:!0});dn.OptionValueBinaryCodec=void 0;var YT=eV(Be()),wh=St(),Zm=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){if(e[0]==0)return[wh.OptionValue.newMissingTyped(r),1];if(e[0]!=1)throw new YT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return[wh.OptionValue.newProvided(n),i+1]}decodeTopLevel(e,r){if(e.length==0)return new wh.OptionValue(r);if(e[0]!=1)throw new YT.ErrCodec("invalid buffer for optional value");let[n,i]=this.binaryCodec.decodeNested(e.slice(1),r);return new wh.OptionValue(r,n)}encodeNested(e){return e.isSet()?d.Buffer.concat([d.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):d.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?d.Buffer.concat([d.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):d.Buffer.from([])}};dn.OptionValueBinaryCodec=Zm});var XT=E(Eh=>{"use strict";l();Object.defineProperty(Eh,"__esModule",{value:!0});Eh.AddressBinaryCodec=void 0;var tV=ht(),rV=St(),ew=class{decodeNested(e){let r=e.slice(0,32),n=new tV.Address(r);return[new rV.AddressValue(n),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};Eh.AddressBinaryCodec=ew});var eC=E(pn=>{"use strict";l();var nV=pn&&pn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),iV=pn&&pn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),sV=pn&&pn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&nV(e,t,r);return iV(e,t),e};Object.defineProperty(pn,"__esModule",{value:!0});pn.BooleanBinaryCodec=void 0;var oV=sV(Be()),ZT=St(),hc=class t{decodeNested(e){let r=e.readUInt8(0);return[new ZT.BooleanValue(r==t.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new oV.ErrInvalidArgument("buffer should be of size <= 1");let r=e[0];return new ZT.BooleanValue(r==t.TRUE)}encodeNested(e){return e.isTrue()?d.Buffer.from([t.TRUE]):d.Buffer.from([t.FALSE])}encodeTopLevel(e){return e.isTrue()?d.Buffer.from([t.TRUE]):d.Buffer.from([])}};pn.BooleanBinaryCodec=hc;hc.TRUE=1;hc.FALSE=0});var Ah=E(vh=>{"use strict";l();Object.defineProperty(vh,"__esModule",{value:!0});vh.SizeOfU32=void 0;vh.SizeOfU32=4});var bh=E(gn=>{"use strict";l();var aV=gn&&gn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(gn,"__esModule",{value:!0});gn.zeroPadStringIfOddLength=gn.isPaddedHex=gn.numberToPaddedHex=void 0;var uV=aV(kt());function cV(t){let e=new uV.default(t).toString(16);return tC(e)}gn.numberToPaddedHex=cV;function lV(t){t=t||"";let e=d.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}gn.isPaddedHex=lV;function tC(t){return t=t||"",t.length%2==1?"0"+t:t}gn.zeroPadStringIfOddLength=tC});var dc=E(Tt=>{"use strict";l();var fV=Tt&&Tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.prependByteToBuffer=Tt.flipBufferBitsInPlace=Tt.getHexMagnitudeOfBigInt=Tt.bigIntToBuffer=Tt.bufferToBigInt=Tt.cloneBuffer=Tt.isMsbZero=Tt.isMsbOne=void 0;var tw=fV(kt()),hV=bh();function rC(t,e=0){return t[e]>>7==1}Tt.isMsbOne=rC;function dV(t,e=0){return!rC(t,e)}Tt.isMsbZero=dV;function pV(t){let e=d.Buffer.alloc(t.length);return t.copy(e),e}Tt.cloneBuffer=pV;function gV(t){let e=t.toString("hex");return new tw.default(`0x${e}`,16)}Tt.bufferToBigInt=gV;function yV(t){let e=nC(t);return d.Buffer.from(e,"hex")}Tt.bigIntToBuffer=yV;function nC(t){return t=new tw.default(t),t?(t.isNegative()&&(t=t.multipliedBy(new tw.default(-1))),hV.numberToPaddedHex(t)):""}Tt.getHexMagnitudeOfBigInt=nC;function mV(t){for(let e=0;e{"use strict";l();var EV=Ko&&Ko.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ko,"__esModule",{value:!0});Ko.NumericalBinaryCodec=void 0;var pc=EV(kt()),rw=St(),iC=Ah(),wt=dc(),nw=class{decodeNested(e,r){let n=0,i=r.sizeInBytes;i||(n=iC.SizeOfU32,i=e.readUInt32BE(0));let s=e.slice(n,n+i),o=this.decodeTopLevel(s,r),a=i+n;return[o,a]}decodeTopLevel(e,r){let n=wt.cloneBuffer(e);if(e.length==0)return new rw.NumericalValue(r,new pc.default(0));if(!r.withSign||wt.isMsbZero(n)){let c=wt.bufferToBigInt(n);return new rw.NumericalValue(r,c)}wt.flipBufferBitsInPlace(n);let u=wt.bufferToBigInt(n).multipliedBy(new pc.default(-1)).minus(new pc.default(1));return new rw.NumericalValue(r,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let r=this.encodeTopLevel(e),n=d.Buffer.alloc(iC.SizeOfU32);return n.writeUInt32BE(r.length),d.Buffer.concat([n,r])}encodeNestedFixedSize(e,r){if(e.value.isZero())return d.Buffer.alloc(r,0);if(!e.withSign){let o=wt.bigIntToBuffer(e.value),a=d.Buffer.alloc(r-o.length,0);return d.Buffer.concat([a,o])}if(e.value.isPositive()){let o=wt.bigIntToBuffer(e.value);wt.isMsbOne(o)&&(o=wt.prependByteToBuffer(o,0));let a=d.Buffer.alloc(r-o.length,0);return d.Buffer.concat([a,o])}let n=e.value.plus(new pc.default(1)),i=wt.bigIntToBuffer(n);wt.flipBufferBitsInPlace(i),wt.isMsbZero(i)&&(i=wt.prependByteToBuffer(i,255));let s=d.Buffer.alloc(r-i.length,255);return d.Buffer.concat([s,i])}encodeTopLevel(e){let r=e.withSign;return e.value.isZero()?d.Buffer.alloc(0):r?this.encodePrimitive(e):wt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let i=wt.bigIntToBuffer(e.value);return wt.isMsbOne(i)&&(i=wt.prependByteToBuffer(i,0)),i}let r=e.value.plus(new pc.default(1)),n=wt.bigIntToBuffer(r);return wt.flipBufferBitsInPlace(n),wt.isMsbZero(n)&&(n=wt.prependByteToBuffer(n,255)),n}};Ko.NumericalBinaryCodec=nw});var oC=E(Ih=>{"use strict";l();Object.defineProperty(Ih,"__esModule",{value:!0});Ih.H256BinaryCodec=void 0;var vV=$u(),iw=class{decodeNested(e){let r=e.slice(0,32);return[new vV.H256Value(r),32]}decodeTopLevel(e){let[r,n]=this.decodeNested(e);return r}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};Ih.H256BinaryCodec=iw});var Th=E(Sh=>{"use strict";l();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.BytesBinaryCodec=void 0;var aC=vi(),_h=Ah(),sw=class{decodeNested(e){let r=e.readUInt32BE(0),n=e.slice(_h.SizeOfU32,_h.SizeOfU32+r);return[new aC.BytesValue(n),_h.SizeOfU32+r]}decodeTopLevel(e){return new aC.BytesValue(e)}encodeNested(e){let r=d.Buffer.alloc(_h.SizeOfU32);return r.writeUInt32BE(e.getLength()),d.Buffer.concat([r,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};Sh.BytesBinaryCodec=sw});var cC=E(Ch=>{"use strict";l();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.TokenIdentifierCodec=void 0;var AV=vi(),uC=Wo(),bV=Th(),ow=class{constructor(){this.bytesCodec=new bV.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesCodec.decodeNested(e);return[new uC.TokenIdentifierValue(r.toString()),n]}decodeTopLevel(e){let r=this.bytesCodec.decodeTopLevel(e);return new uC.TokenIdentifierValue(r.toString())}encodeNested(e){let r=AV.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(r)}encodeTopLevel(e){return d.Buffer.from(e.valueOf())}};Ch.TokenIdentifierCodec=ow});var fC=E(xh=>{"use strict";l();Object.defineProperty(xh,"__esModule",{value:!0});xh.NothingCodec=void 0;var lC=St(),aw=class{decodeNested(){return[new lC.NothingValue,0]}decodeTopLevel(){return new lC.NothingValue}encodeNested(){return d.Buffer.from([])}encodeTopLevel(){return d.Buffer.from([])}};xh.NothingCodec=aw});var dC=E(Nh=>{"use strict";l();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.StringBinaryCodec=void 0;var hC=St(),IV=vi(),_V=Th(),uw=class{constructor(){this.bytesBinaryCodec=new _V.BytesBinaryCodec}decodeNested(e){let[r,n]=this.bytesBinaryCodec.decodeNested(e);return[new hC.StringValue(r.valueOf().toString()),n]}decodeTopLevel(e){return new hC.StringValue(e.toString())}encodeNested(e){let r=IV.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(r)}encodeTopLevel(e){return d.Buffer.from(e.valueOf())}};Nh.StringBinaryCodec=uw});var pC=E(Dh=>{"use strict";l();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.PrimitiveBinaryCodec=void 0;var Oh=St(),SV=XT(),TV=eC(),CV=sC(),xV=oC(),NV=Th(),OV=cC(),DV=fC(),PV=dC(),cw=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new TV.BooleanBinaryCodec,this.numericalCodec=new CV.NumericalBinaryCodec,this.addressCodec=new SV.AddressBinaryCodec,this.h256Codec=new xV.H256BinaryCodec,this.bytesCodec=new NV.BytesBinaryCodec,this.stringCodec=new PV.StringBinaryCodec,this.tokenIdentifierCodec=new OV.TokenIdentifierCodec,this.nothingCodec=new DV.NothingCodec}decodeNested(e,r){return Oh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,r),onAddress:()=>this.addressCodec.decodeNested(e),onBytes:()=>this.bytesCodec.decodeNested(e),onString:()=>this.stringCodec.decodeNested(e),onH256:()=>this.h256Codec.decodeNested(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeNested(e),onNothing:()=>this.nothingCodec.decodeNested()})}decodeTopLevel(e,r){return Oh.onPrimitiveTypeSelect(r,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,r),onAddress:()=>this.addressCodec.decodeTopLevel(e),onBytes:()=>this.bytesCodec.decodeTopLevel(e),onString:()=>this.stringCodec.decodeTopLevel(e),onH256:()=>this.h256Codec.decodeTopLevel(e),onTokenIndetifier:()=>this.tokenIdentifierCodec.decodeTopLevel(e),onNothing:()=>this.nothingCodec.decodeTopLevel()})}encodeNested(e){return Oh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeNested(e),onNumerical:()=>this.numericalCodec.encodeNested(e),onAddress:()=>this.addressCodec.encodeNested(e),onBytes:()=>this.bytesCodec.encodeNested(e),onString:()=>this.stringCodec.encodeNested(e),onH256:()=>this.h256Codec.encodeNested(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeNested(e),onNothing:()=>this.nothingCodec.encodeNested()})}encodeTopLevel(e){return Oh.onPrimitiveValueSelect(e,{onBoolean:()=>this.booleanCodec.encodeTopLevel(e),onNumerical:()=>this.numericalCodec.encodeTopLevel(e),onAddress:()=>this.addressCodec.encodeTopLevel(e),onBytes:()=>this.bytesCodec.encodeTopLevel(e),onString:()=>this.stringCodec.encodeTopLevel(e),onH256:()=>this.h256Codec.encodeTopLevel(e),onTypeIdentifier:()=>this.tokenIdentifierCodec.encodeTopLevel(e),onNothing:()=>this.nothingCodec.encodeTopLevel()})}};Dh.PrimitiveBinaryCodec=cw});var mC=E(Ph=>{"use strict";l();Object.defineProperty(Ph,"__esModule",{value:!0});Ph.ListBinaryCodec=void 0;var gC=St(),yC=Ah(),lw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.getFirstTypeParameter(),i=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=yC.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,n);i.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(i.length)}return new gC.List(r,i)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=d.Buffer.alloc(yC.SizeOfU32);r.writeUInt32BE(e.getLength());let n=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);n.push(o)}return d.Buffer.concat([r,...n])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let r=[];for(let i of e.getItems()){let s=this.binaryCodec.encodeNested(i);r.push(s)}return d.Buffer.concat(r)}};Ph.ListBinaryCodec=lw});var hw=E(Rh=>{"use strict";l();Object.defineProperty(Rh,"__esModule",{value:!0});Rh.FieldsBinaryCodec=void 0;var RV=St(),fw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=[],i=0;for(let s of r){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),i+=a;let u=new RV.Field(o,s.name);n.push(u)}return[n,i]}encodeNested(e){let r=[];for(let n of e){let i=this.binaryCodec.encodeNested(n.value);r.push(i)}return d.Buffer.concat(r)}};Rh.FieldsBinaryCodec=fw});var pw=E(Bh=>{"use strict";l();Object.defineProperty(Bh,"__esModule",{value:!0});Bh.StructBinaryCodec=void 0;var BV=St(),LV=hw(),dw=class{constructor(e){this.fieldsCodec=new LV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let n=r.getFieldsDefinitions(),[i,s]=this.fieldsCodec.decodeNested(e,n);return[new BV.Struct(r,i),s]}encodeNested(e){let r=e.getFields();return this.fieldsCodec.encodeNested(r)}encodeTopLevel(e){return this.encodeNested(e)}};Bh.StructBinaryCodec=dw});var wC=E(Fh=>{"use strict";l();Object.defineProperty(Fh,"__esModule",{value:!0});Fh.EnumBinaryCodec=void 0;var Lh=St(),FV=hw(),gw=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new FV.FieldsBinaryCodec(e)}decodeTopLevel(e,r){let[n]=this.decodeNested(e,r);return n}decodeNested(e,r){let[n,i]=this.readDiscriminant(e);e=e.slice(i);let s=r.getVariantByDiscriminant(n),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Lh.EnumValue(r,s,a),i+u]}readDiscriminant(e){let[r,n]=this.binaryCodec.decodeNested(e,new Lh.U8Type);return[r.valueOf(),n]}encodeNested(e){let r=new Lh.U8Value(e.discriminant),n=this.binaryCodec.encodeNested(r),i=e.getFields(),s=this.fieldsCodec.encodeNested(i);return d.Buffer.concat([n,s])}encodeTopLevel(e){let r=e.getFields(),n=r.length>0,i=this.fieldsCodec.encodeNested(r),s=new Lh.U8Value(e.discriminant),o=n?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return d.Buffer.concat([o,i])}};Fh.EnumBinaryCodec=gw});var EC=E(Mh=>{"use strict";l();Object.defineProperty(Mh,"__esModule",{value:!0});Mh.TupleBinaryCodec=void 0;var MV=pw(),yw=class{constructor(e){this.structCodec=new MV.StructBinaryCodec(e)}decodeTopLevel(e,r){return this.structCodec.decodeTopLevel(e,r)}decodeNested(e,r){return this.structCodec.decodeNested(e,r)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Mh.TupleBinaryCodec=yw});var vC=E(Uh=>{"use strict";l();Object.defineProperty(Uh,"__esModule",{value:!0});Uh.ArrayVecBinaryCodec=void 0;var UV=St(),mw=class{constructor(e){this.binaryCodec=e}decodeNested(e,r){let n=r.length,i=r.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";l();var qV=Nr&&Nr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),VV=Nr&&Nr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HV=Nr&&Nr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&qV(e,t,r);return VV(e,t),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.BinaryCodecConstraints=Nr.BinaryCodec=void 0;var AC=HV(Be()),qh=St(),bC=vr(),GV=JT(),kV=pC(),jV=mC(),QV=pw(),WV=wC(),zV=EC(),$V=vC(),ww=class{constructor(e=null){this.constraints=e||new Vh,this.optionCodec=new GV.OptionValueBinaryCodec(this),this.listCodec=new jV.ListBinaryCodec(this),this.arrayCodec=new $V.ArrayVecBinaryCodec(this),this.primitiveCodec=new kV.PrimitiveBinaryCodec(this),this.structCodec=new QV.StructBinaryCodec(this),this.tupleCodec=new zV.TupleBinaryCodec(this),this.enumCodec=new WV.EnumBinaryCodec(this)}decodeTopLevel(e,r){return this.constraints.checkBufferLength(e),qh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeTopLevel(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,r),onArray:()=>this.arrayCodec.decodeTopLevel(e,r),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,r),onStruct:()=>this.structCodec.decodeTopLevel(e,r),onTuple:()=>this.tupleCodec.decodeTopLevel(e,r),onEnum:()=>this.enumCodec.decodeTopLevel(e,r)})}decodeNested(e,r){this.constraints.checkBufferLength(e);let[n,i]=qh.onTypeSelect(r,{onOption:()=>this.optionCodec.decodeNested(e,r.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,r),onArray:()=>this.arrayCodec.decodeNested(e,r),onPrimitive:()=>this.primitiveCodec.decodeNested(e,r),onStruct:()=>this.structCodec.decodeNested(e,r),onTuple:()=>this.tupleCodec.decodeNested(e,r),onEnum:()=>this.enumCodec.decodeNested(e,r)});return[n,i]}encodeNested(e){return bC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeNested(e),onOption:()=>this.optionCodec.encodeNested(e),onList:()=>this.listCodec.encodeNested(e),onArray:()=>this.arrayCodec.encodeNested(e),onStruct:()=>this.structCodec.encodeNested(e),onTuple:()=>this.tupleCodec.encodeNested(e),onEnum:()=>this.enumCodec.encodeNested(e)})}encodeTopLevel(e){return bC.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),qh.onTypedValueSelect(e,{onPrimitive:()=>this.primitiveCodec.encodeTopLevel(e),onOption:()=>this.optionCodec.encodeTopLevel(e),onList:()=>this.listCodec.encodeTopLevel(e),onArray:()=>this.arrayCodec.encodeTopLevel(e),onStruct:()=>this.structCodec.encodeTopLevel(e),onTuple:()=>this.tupleCodec.encodeTopLevel(e),onEnum:()=>this.enumCodec.encodeTopLevel(e)})}};Nr.BinaryCodec=ww;var Vh=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||256e3,this.maxListLength=e?.maxListLength||128e3}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new AC.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new AC.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Nr.BinaryCodecConstraints=Vh});var IC=E(Or=>{"use strict";l();var KV=Or&&Or.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Or,"__esModule",{value:!0});Or.decodeBigNumber=Or.decodeString=Or.decodeBool=Or.decodeUnsignedNumber=void 0;var YV=KV(kt()),Hh=St(),JV=Ew(),Gh=new JV.BinaryCodec;function XV(t){let e=Gh.decodeTopLevel(t,new Hh.BigUIntType);return Number(e.valueOf())}Or.decodeUnsignedNumber=XV;function ZV(t){return!!Gh.decodeTopLevel(t,new Hh.BooleanType).valueOf()}Or.decodeBool=ZV;function eH(t){let e=Gh.decodeTopLevel(t,new Hh.BytesType);return String(e.valueOf())}Or.decodeString=eH;function tH(t){let e=Gh.decodeTopLevel(t,new Hh.BigUIntType);return new YV.default(e.valueOf())}Or.decodeBigNumber=tH});var vw=E(Ii=>{"use strict";l();var rH=Ii&&Ii.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_C=Ii&&Ii.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&rH(e,t,r)};Object.defineProperty(Ii,"__esModule",{value:!0});_C(Ew(),Ii);_C(IC(),Ii)});var Yo=E(kh=>{"use strict";l();Object.defineProperty(kh,"__esModule",{value:!0});kh.ArgSerializer=void 0;var SC=Ss(),nH=vw(),TC=St(),Aw=Lf(),bw=Vf(),Iw=dh(),iH={codec:new nH.BinaryCodec},_w=class{constructor(e){e=Object.assign(Object.assign({},iH),e),this.codec=e.codec}stringToValues(e,r){let n=this.stringToBuffers(e);return this.buffersToValues(n,r)}stringToBuffers(e){return e.split(SC.ARGUMENTS_SEPARATOR).map(r=>d.Buffer.from(r,"hex"))}buffersToValues(e,r){let n=this;e=e||[];let i=[],s=0,o=e.length;for(let h=0;h=o}return i}valuesToString(e){let r=this.valuesToStrings(e),n=r.join(SC.ARGUMENTS_SEPARATOR),i=r.length;return{argumentsString:n,count:i}}valuesToStrings(e){return this.valuesToBuffers(e).map(i=>i.toString("hex"))}valuesToBuffers(e){let r=this,n=[];for(let o of e)i(o);function i(o){if(o.hasExactClass(Aw.OptionalValue.ClassName)){let u=o;u.isSet()&&i(u.getTypedValue());return}if(o.hasExactClass(Iw.VariadicValue.ClassName)){s(o);return}if(o.hasExactClass(bw.CompositeValue.ClassName)){let u=o;for(let c of u.getItems())i(c);return}let a=r.codec.encodeTopLevel(o);n.push(a)}function s(o){if(o.getType().isCounted){let u=new TC.U32Value(o.getItems().length);n.push(r.codec.encodeTopLevel(u))}for(let u of o.getItems())i(u)}return n}};kh.ArgSerializer=_w});var Wh=E(Qh=>{"use strict";l();Object.defineProperty(Qh,"__esModule",{value:!0});Qh.Compatibility=void 0;var sH=ht(),jh=class{static guardAddressIsSetAndNonZero(e,r,n){this.areWarningsEnabled&&(!e||e.bech32()==""?console.warn(`${r}: address should be set; ${n}. In the future, this will throw an exception instead of emitting a WARN.`):e.bech32()==sH.Address.Zero().bech32()&&console.warn(`${r}: address should not be the 'zero' address (also known as the 'contracts deployment address'); ${n}. In the future, this will throw an exception instead of emitting a WARN.`))}};Qh.Compatibility=jh;jh.areWarningsEnabled=!0});var CC=E(yn=>{"use strict";l();var oH=yn&&yn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),aH=yn&&yn.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),uH=yn&&yn.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&oH(e,t,r);return aH(e,t),e};Object.defineProperty(yn,"__esModule",{value:!0});yn.Hash=void 0;var cH=uH(Be()),Sw=class t{constructor(e){if(!e)this.hash=d.Buffer.from([]);else if(e instanceof d.Buffer)this.hash=e;else if(typeof e=="string")this.hash=d.Buffer.from(e,"hex");else throw new cH.ErrBadType("hash","buffer | string",e)}static empty(){return new t(d.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};yn.Hash=Sw});var gc=E(Dr=>{"use strict";l();var lH=Dr&&Dr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),fH=Dr&&Dr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hH=Dr&&Dr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&lH(e,t,r);return fH(e,t),e};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.TransactionOptions=Dr.TransactionVersion=void 0;var Wr=Ss(),xC=hH(Be()),Tw=class t{constructor(e){if(e=Number(e),e<1)throw new xC.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new t(Wr.TRANSACTION_VERSION_DEFAULT)}static withTxOptions(){return new t(Wr.TRANSACTION_VERSION_WITH_OPTIONS)}valueOf(){return this.value}};Dr.TransactionVersion=Tw;var Cw=class t{constructor(e){if(e=Number(e),e<0)throw new xC.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new t(Wr.TRANSACTION_OPTIONS_DEFAULT)}static withOptions(e){let r=0;return e.hashSign&&(r|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN),e.guarded&&(r|=Wr.TRANSACTION_OPTIONS_TX_GUARDED),new t(r)}isWithHashSign(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN)==Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}isWithGuardian(){return(this.value&Wr.TRANSACTION_OPTIONS_TX_GUARDED)==Wr.TRANSACTION_OPTIONS_TX_GUARDED}setWithHashSign(){this.value|=Wr.TRANSACTION_OPTIONS_TX_HASH_SIGN}setWithGuardian(){this.value|=Wr.TRANSACTION_OPTIONS_TX_GUARDED}valueOf(){return this.value}};Dr.TransactionOptions=Cw});var OC=E((Bae,NC)=>{"use strict";l();NC.exports=dH;function dH(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i{"use strict";l();var zh=RC;zh.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var Jo=new Array(64),PC=new Array(123);for(zr=0;zr<64;)PC[Jo[zr]=zr<26?zr+65:zr<52?zr+71:zr<62?zr-4:zr-59|43]=zr++;var zr;zh.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,u;r>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=Jo[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=Jo[u|c>>6],s[o++]=Jo[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Jo[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var DC="invalid encoding";zh.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a1)break;if((u=PC[u])===void 0)throw Error(DC);switch(s){case 0:o=u,s=1;break;case 1:r[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:r[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:r[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(DC);return n-i};zh.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var FC=E((Uae,LC)=>{"use strict";l();LC.exports=$h;function $h(){this._listeners={}}$h.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};$h.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i{"use strict";l();GC.exports=MC(MC);function MC(t){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3]}function s(u,c,f){e[0]=u,c[f]=r[3],c[f+1]=r[2],c[f+2]=r[1],c[f+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],e[0]}function a(u,c){return r[3]=u[c],r[2]=u[c+1],r[1]=u[c+2],r[0]=u[c+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o}():function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}t.writeFloatLE=e.bind(null,UC),t.writeFloatBE=e.bind(null,qC);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}t.readFloatLE=r.bind(null,VC),t.readFloatBE=r.bind(null,HC)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(u,c,f){e[0]=u,c[f]=r[0],c[f+1]=r[1],c[f+2]=r[2],c[f+3]=r[3],c[f+4]=r[4],c[f+5]=r[5],c[f+6]=r[6],c[f+7]=r[7]}function s(u,c,f){e[0]=u,c[f]=r[7],c[f+1]=r[6],c[f+2]=r[5],c[f+3]=r[4],c[f+4]=r[3],c[f+5]=r[2],c[f+6]=r[1],c[f+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(u,c){return r[0]=u[c],r[1]=u[c+1],r[2]=u[c+2],r[3]=u[c+3],r[4]=u[c+4],r[5]=u[c+5],r[6]=u[c+6],r[7]=u[c+7],e[0]}function a(u,c){return r[7]=u[c],r[6]=u[c+1],r[5]=u[c+2],r[4]=u[c+3],r[3]=u[c+4],r[2]=u[c+5],r[1]=u[c+6],r[0]=u[c+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o}():function(){function e(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((c<<31|2146435072)>>>0,a,u+s);else{var f;if(o<22250738585072014e-324)f=o/5e-324,n(f>>>0,a,u+i),n((c<<31|f/4294967296)>>>0,a,u+s);else{var h=Math.floor(Math.log(o)/Math.LN2);h===1024&&(h=1023),f=o*Math.pow(2,-h),n(f*4503599627370496>>>0,a,u+i),n((c<<31|h+1023<<20|f*1048576&1048575)>>>0,a,u+s)}}}t.writeDoubleLE=e.bind(null,UC,0,4),t.writeDoubleBE=e.bind(null,qC,4,0);function r(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),f=(c>>31)*2+1,h=c>>>20&2047,g=4294967296*(c&1048575)+u;return h===2047?g?NaN:f*(1/0):h===0?f*5e-324*g:f*Math.pow(2,h-1075)*(g+4503599627370496)}t.readDoubleLE=r.bind(null,VC,0,4),t.readDoubleBE=r.bind(null,HC,4,0)}(),t}function UC(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function qC(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function VC(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function HC(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var jC=E((exports,module)=>{"use strict";l();module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var WC=E(QC=>{"use strict";l();var xw=QC;xw.length=function(e){for(var r=0,n=0,i=0;i191&&u<224?o[a++]=(u&31)<<6|e[r++]&63:u>239&&u<365?(u=((u&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[r++]&63)<<6|e[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};xw.write=function(e,r,n){for(var i=n,s,o,a=0;a>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var $C=E((Qae,zC)=>{"use strict";l();zC.exports=pH;function pH(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return t(u);o+u>n&&(s=t(n),o=0);var c=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var YC=E((zae,KC)=>{"use strict";l();KC.exports=Ft;var yc=Si();function Ft(t,e){this.lo=t>>>0,this.hi=e>>>0}var Ds=Ft.zero=new Ft(0,0);Ds.toNumber=function(){return 0};Ds.zzEncode=Ds.zzDecode=function(){return this};Ds.length=function(){return 1};var gH=Ft.zeroHash="\0\0\0\0\0\0\0\0";Ft.fromNumber=function(e){if(e===0)return Ds;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Ft(n,i)};Ft.from=function(e){if(typeof e=="number")return Ft.fromNumber(e);if(yc.isString(e))if(yc.Long)e=yc.Long.fromString(e);else return Ft.fromNumber(parseInt(e,10));return e.low||e.high?new Ft(e.low>>>0,e.high>>>0):Ds};Ft.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Ft.prototype.toLong=function(e){return yc.Long?new yc.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var _i=String.prototype.charCodeAt;Ft.fromHash=function(e){return e===gH?Ds:new Ft((_i.call(e,0)|_i.call(e,1)<<8|_i.call(e,2)<<16|_i.call(e,3)<<24)>>>0,(_i.call(e,4)|_i.call(e,5)<<8|_i.call(e,6)<<16|_i.call(e,7)<<24)>>>0)};Ft.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Ft.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Ft.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Ft.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var Si=E(Nw=>{"use strict";l();var Ee=Nw;Ee.asPromise=OC();Ee.base64=BC();Ee.EventEmitter=FC();Ee.float=kC();Ee.inquire=jC();Ee.utf8=WC();Ee.pool=$C();Ee.LongBits=YC();Ee.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Ee.global=Ee.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Nw;Ee.emptyArray=Object.freeze?Object.freeze([]):[];Ee.emptyObject=Object.freeze?Object.freeze({}):{};Ee.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Ee.isString=function(e){return typeof e=="string"||e instanceof String};Ee.isObject=function(e){return e&&typeof e=="object"};Ee.isset=Ee.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};Ee.Buffer=function(){try{var t=Ee.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch{return null}}();Ee._Buffer_from=null;Ee._Buffer_allocUnsafe=null;Ee.newBuffer=function(e){return typeof e=="number"?Ee.Buffer?Ee._Buffer_allocUnsafe(e):new Ee.Array(e):Ee.Buffer?Ee._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Ee.Array=typeof Uint8Array<"u"?Uint8Array:Array;Ee.Long=Ee.global.dcodeIO&&Ee.global.dcodeIO.Long||Ee.global.Long||Ee.inquire("long");Ee.key2Re=/^true|false|0|1$/;Ee.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Ee.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Ee.longToHash=function(e){return e?Ee.LongBits.from(e).toHash():Ee.LongBits.zeroHash};Ee.longFromHash=function(e,r){var n=Ee.LongBits.fromHash(e);return Ee.Long?Ee.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function JC(t,e,r){for(var n=Object.keys(e),i=0;i-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};Ee.oneOfSetter=function(e){return function(r){for(var n=0;n{"use strict";l();rx.exports=Fe;var Pr=Si(),Ow,Kh=Pr.LongBits,ZC=Pr.base64,ex=Pr.utf8;function mc(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Pw(){}function yH(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function Fe(){this.len=0,this.head=new mc(Pw,0,0),this.tail=this.head,this.states=null}var tx=function(){return Pr.Buffer?function(){return(Fe.create=function(){return new Ow})()}:function(){return new Fe}};Fe.create=tx();Fe.alloc=function(e){return new Pr.Array(e)};Pr.Array!==Array&&(Fe.alloc=Pr.pool(Fe.alloc,Pr.Array.prototype.subarray));Fe.prototype._push=function(e,r,n){return this.tail=this.tail.next=new mc(e,r,n),this.len+=r,this};function Rw(t,e,r){e[r]=t&255}function mH(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function Bw(t,e){this.len=t,this.next=void 0,this.val=e}Bw.prototype=Object.create(mc.prototype);Bw.prototype.fn=mH;Fe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new Bw((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};Fe.prototype.int32=function(e){return e<0?this._push(Lw,10,Kh.fromNumber(e)):this.uint32(e)};Fe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Lw(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}Fe.prototype.uint64=function(e){var r=Kh.from(e);return this._push(Lw,r.length(),r)};Fe.prototype.int64=Fe.prototype.uint64;Fe.prototype.sint64=function(e){var r=Kh.from(e).zzEncode();return this._push(Lw,r.length(),r)};Fe.prototype.bool=function(e){return this._push(Rw,1,e?1:0)};function Dw(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}Fe.prototype.fixed32=function(e){return this._push(Dw,4,e>>>0)};Fe.prototype.sfixed32=Fe.prototype.fixed32;Fe.prototype.fixed64=function(e){var r=Kh.from(e);return this._push(Dw,4,r.lo)._push(Dw,4,r.hi)};Fe.prototype.sfixed64=Fe.prototype.fixed64;Fe.prototype.float=function(e){return this._push(Pr.float.writeFloatLE,4,e)};Fe.prototype.double=function(e){return this._push(Pr.float.writeDoubleLE,8,e)};var wH=Pr.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i>>0;if(!r)return this._push(Rw,1,0);if(Pr.isString(e)){var n=Fe.alloc(r=ZC.length(e));ZC.decode(e,n,0),e=n}return this.uint32(r)._push(wH,r,e)};Fe.prototype.string=function(e){var r=ex.length(e);return r?this.uint32(r)._push(ex.write,r,e):this._push(Rw,1,0)};Fe.prototype.fork=function(){return this.states=new yH(this),this.head=this.tail=new mc(Pw,0,0),this.len=0,this};Fe.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new mc(Pw,0,0),this.len=0),this};Fe.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};Fe.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};Fe._configure=function(t){Ow=t,Fe.create=tx(),Ow._configure()}});var sx=E((Zae,ix)=>{"use strict";l();ix.exports=mn;var nx=Fw();(mn.prototype=Object.create(nx.prototype)).constructor=mn;var Ti=Si();function mn(){nx.call(this)}mn._configure=function(){mn.alloc=Ti._Buffer_allocUnsafe,mn.writeBytesBuffer=Ti.Buffer&&Ti.Buffer.prototype instanceof Uint8Array&&Ti.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i>>0;return this.uint32(r),r&&this._push(mn.writeBytesBuffer,r,e),this};function EH(t,e,r){t.length<40?Ti.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}mn.prototype.string=function(e){var r=Ti.Buffer.byteLength(e);return this.uint32(r),r&&this._push(EH,r,e),this};mn._configure()});var qw=E((tue,lx)=>{"use strict";l();lx.exports=Et;var wn=Si(),Uw,ux=wn.LongBits,vH=wn.utf8;function $r(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Et(t){this.buf=t,this.pos=0,this.len=t.length}var ox=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Et(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Et(e);throw Error("illegal buffer")},cx=function(){return wn.Buffer?function(r){return(Et.create=function(i){return wn.Buffer.isBuffer(i)?new Uw(i):ox(i)})(r)}:ox};Et.create=cx();Et.prototype._slice=wn.Array.prototype.subarray||wn.Array.prototype.slice;Et.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,$r(this,10);return e}}();Et.prototype.int32=function(){return this.uint32()|0};Et.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Mw(){var t=new ux(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Et.prototype.bool=function(){return this.uint32()!==0};function Yh(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Et.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Yh(this.buf,this.pos+=4)};Et.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Yh(this.buf,this.pos+=4)|0};function ax(){if(this.pos+8>this.len)throw $r(this,8);return new ux(Yh(this.buf,this.pos+=4),Yh(this.buf,this.pos+=4))}Et.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=wn.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Et.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=wn.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Et.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};Et.prototype.string=function(){var e=this.bytes();return vH.read(e,0,e.length)};Et.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw $r(this,e);this.pos+=e}else do if(this.pos>=this.len)throw $r(this);while(this.buf[this.pos++]&128);return this};Et.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Et._configure=function(t){Uw=t,Et.create=cx(),Uw._configure();var e=wn.Long?"toLong":"toNumber";wn.merge(Et.prototype,{int64:function(){return Mw.call(this)[e](!1)},uint64:function(){return Mw.call(this)[e](!0)},sint64:function(){return Mw.call(this).zzDecode()[e](!1)},fixed64:function(){return ax.call(this)[e](!0)},sfixed64:function(){return ax.call(this)[e](!1)}})}});var px=E((nue,dx)=>{"use strict";l();dx.exports=Ps;var hx=qw();(Ps.prototype=Object.create(hx.prototype)).constructor=Ps;var fx=Si();function Ps(t){hx.call(this,t)}Ps._configure=function(){fx.Buffer&&(Ps.prototype._slice=fx.Buffer.prototype.slice)};Ps.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Ps._configure()});var yx=E((sue,gx)=>{"use strict";l();gx.exports=wc;var Vw=Si();(wc.prototype=Object.create(Vw.EventEmitter.prototype)).constructor=wc;function wc(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");Vw.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}wc.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Vw.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,c){if(u)return o.emit("error",u,e),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return o.emit("error",f,e),s(f)}return o.emit("data",c,e),s(null,c)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};wc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var wx=E(mx=>{"use strict";l();var AH=mx;AH.Service=yx()});var vx=E((cue,Ex)=>{"use strict";l();Ex.exports={}});var Ix=E(bx=>{"use strict";l();var hr=bx;hr.build="minimal";hr.Writer=Fw();hr.BufferWriter=sx();hr.Reader=qw();hr.BufferReader=px();hr.util=Si();hr.rpc=wx();hr.roots=vx();hr.configure=Ax;function Ax(){hr.util._configure(),hr.Writer._configure(hr.BufferWriter),hr.Reader._configure(hr.BufferReader)}Ax()});var Sx=E((due,_x)=>{"use strict";l();_x.exports=Ix()});var Cx=E((gue,Tx)=>{"use strict";l();var Xo=Sx(),Jh=Xo.Reader,bH=Xo.Writer,X=Xo.util,Ec=Xo.roots.default||(Xo.roots.default={});Ec.proto=function(){var t={};return t.Transaction=function(){function e(r){if(r)for(var n=Object.keys(r),i=0;i>>3){case 1:o.Nonce=n.uint64();break;case 2:o.Value=n.bytes();break;case 3:o.RcvAddr=n.bytes();break;case 4:o.RcvUserName=n.bytes();break;case 5:o.SndAddr=n.bytes();break;case 6:o.SndUserName=n.bytes();break;case 7:o.GasPrice=n.uint64();break;case 8:o.GasLimit=n.uint64();break;case 9:o.Data=n.bytes();break;case 10:o.ChainID=n.bytes();break;case 11:o.Version=n.uint32();break;case 12:o.Signature=n.bytes();break;case 13:o.Options=n.uint32();break;case 14:o.GuardAddr=n.bytes();break;case 15:o.GuardSignature=n.bytes();break;default:n.skipType(a&7);break}}return o},e.decodeDelimited=function(n){return n instanceof Jh||(n=new Jh(n)),this.decode(n,n.uint32())},e.verify=function(n){return typeof n!="object"||n===null?"object expected":n.Nonce!=null&&n.hasOwnProperty("Nonce")&&!X.isInteger(n.Nonce)&&!(n.Nonce&&X.isInteger(n.Nonce.low)&&X.isInteger(n.Nonce.high))?"Nonce: integer|Long expected":n.Value!=null&&n.hasOwnProperty("Value")&&!(n.Value&&typeof n.Value.length=="number"||X.isString(n.Value))?"Value: buffer expected":n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&!(n.RcvAddr&&typeof n.RcvAddr.length=="number"||X.isString(n.RcvAddr))?"RcvAddr: buffer expected":n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&!(n.RcvUserName&&typeof n.RcvUserName.length=="number"||X.isString(n.RcvUserName))?"RcvUserName: buffer expected":n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&!(n.SndAddr&&typeof n.SndAddr.length=="number"||X.isString(n.SndAddr))?"SndAddr: buffer expected":n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&!(n.SndUserName&&typeof n.SndUserName.length=="number"||X.isString(n.SndUserName))?"SndUserName: buffer expected":n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&!X.isInteger(n.GasPrice)&&!(n.GasPrice&&X.isInteger(n.GasPrice.low)&&X.isInteger(n.GasPrice.high))?"GasPrice: integer|Long expected":n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&!X.isInteger(n.GasLimit)&&!(n.GasLimit&&X.isInteger(n.GasLimit.low)&&X.isInteger(n.GasLimit.high))?"GasLimit: integer|Long expected":n.Data!=null&&n.hasOwnProperty("Data")&&!(n.Data&&typeof n.Data.length=="number"||X.isString(n.Data))?"Data: buffer expected":n.ChainID!=null&&n.hasOwnProperty("ChainID")&&!(n.ChainID&&typeof n.ChainID.length=="number"||X.isString(n.ChainID))?"ChainID: buffer expected":n.Version!=null&&n.hasOwnProperty("Version")&&!X.isInteger(n.Version)?"Version: integer expected":n.Signature!=null&&n.hasOwnProperty("Signature")&&!(n.Signature&&typeof n.Signature.length=="number"||X.isString(n.Signature))?"Signature: buffer expected":n.Options!=null&&n.hasOwnProperty("Options")&&!X.isInteger(n.Options)?"Options: integer expected":n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&!(n.GuardAddr&&typeof n.GuardAddr.length=="number"||X.isString(n.GuardAddr))?"GuardAddr: buffer expected":n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&!(n.GuardSignature&&typeof n.GuardSignature.length=="number"||X.isString(n.GuardSignature))?"GuardSignature: buffer expected":null},e.fromObject=function(n){if(n instanceof Ec.proto.Transaction)return n;var i=new Ec.proto.Transaction;return n.Nonce!=null&&(X.Long?(i.Nonce=X.Long.fromValue(n.Nonce)).unsigned=!0:typeof n.Nonce=="string"?i.Nonce=parseInt(n.Nonce,10):typeof n.Nonce=="number"?i.Nonce=n.Nonce:typeof n.Nonce=="object"&&(i.Nonce=new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0))),n.Value!=null&&(typeof n.Value=="string"?X.base64.decode(n.Value,i.Value=X.newBuffer(X.base64.length(n.Value)),0):n.Value.length&&(i.Value=n.Value)),n.RcvAddr!=null&&(typeof n.RcvAddr=="string"?X.base64.decode(n.RcvAddr,i.RcvAddr=X.newBuffer(X.base64.length(n.RcvAddr)),0):n.RcvAddr.length&&(i.RcvAddr=n.RcvAddr)),n.RcvUserName!=null&&(typeof n.RcvUserName=="string"?X.base64.decode(n.RcvUserName,i.RcvUserName=X.newBuffer(X.base64.length(n.RcvUserName)),0):n.RcvUserName.length&&(i.RcvUserName=n.RcvUserName)),n.SndAddr!=null&&(typeof n.SndAddr=="string"?X.base64.decode(n.SndAddr,i.SndAddr=X.newBuffer(X.base64.length(n.SndAddr)),0):n.SndAddr.length&&(i.SndAddr=n.SndAddr)),n.SndUserName!=null&&(typeof n.SndUserName=="string"?X.base64.decode(n.SndUserName,i.SndUserName=X.newBuffer(X.base64.length(n.SndUserName)),0):n.SndUserName.length&&(i.SndUserName=n.SndUserName)),n.GasPrice!=null&&(X.Long?(i.GasPrice=X.Long.fromValue(n.GasPrice)).unsigned=!0:typeof n.GasPrice=="string"?i.GasPrice=parseInt(n.GasPrice,10):typeof n.GasPrice=="number"?i.GasPrice=n.GasPrice:typeof n.GasPrice=="object"&&(i.GasPrice=new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0))),n.GasLimit!=null&&(X.Long?(i.GasLimit=X.Long.fromValue(n.GasLimit)).unsigned=!0:typeof n.GasLimit=="string"?i.GasLimit=parseInt(n.GasLimit,10):typeof n.GasLimit=="number"?i.GasLimit=n.GasLimit:typeof n.GasLimit=="object"&&(i.GasLimit=new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0))),n.Data!=null&&(typeof n.Data=="string"?X.base64.decode(n.Data,i.Data=X.newBuffer(X.base64.length(n.Data)),0):n.Data.length&&(i.Data=n.Data)),n.ChainID!=null&&(typeof n.ChainID=="string"?X.base64.decode(n.ChainID,i.ChainID=X.newBuffer(X.base64.length(n.ChainID)),0):n.ChainID.length&&(i.ChainID=n.ChainID)),n.Version!=null&&(i.Version=n.Version>>>0),n.Signature!=null&&(typeof n.Signature=="string"?X.base64.decode(n.Signature,i.Signature=X.newBuffer(X.base64.length(n.Signature)),0):n.Signature.length&&(i.Signature=n.Signature)),n.Options!=null&&(i.Options=n.Options>>>0),n.GuardAddr!=null&&(typeof n.GuardAddr=="string"?X.base64.decode(n.GuardAddr,i.GuardAddr=X.newBuffer(X.base64.length(n.GuardAddr)),0):n.GuardAddr.length&&(i.GuardAddr=n.GuardAddr)),n.GuardSignature!=null&&(typeof n.GuardSignature=="string"?X.base64.decode(n.GuardSignature,i.GuardSignature=X.newBuffer(X.base64.length(n.GuardSignature)),0):n.GuardSignature.length&&(i.GuardSignature=n.GuardSignature)),i},e.toObject=function(n,i){i||(i={});var s={};if(i.defaults){if(X.Long){var o=new X.Long(0,0,!0);s.Nonce=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.Nonce=i.longs===String?"0":0;if(i.bytes===String?s.Value="":(s.Value=[],i.bytes!==Array&&(s.Value=X.newBuffer(s.Value))),i.bytes===String?s.RcvAddr="":(s.RcvAddr=[],i.bytes!==Array&&(s.RcvAddr=X.newBuffer(s.RcvAddr))),i.bytes===String?s.RcvUserName="":(s.RcvUserName=[],i.bytes!==Array&&(s.RcvUserName=X.newBuffer(s.RcvUserName))),i.bytes===String?s.SndAddr="":(s.SndAddr=[],i.bytes!==Array&&(s.SndAddr=X.newBuffer(s.SndAddr))),i.bytes===String?s.SndUserName="":(s.SndUserName=[],i.bytes!==Array&&(s.SndUserName=X.newBuffer(s.SndUserName))),X.Long){var o=new X.Long(0,0,!0);s.GasPrice=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasPrice=i.longs===String?"0":0;if(X.Long){var o=new X.Long(0,0,!0);s.GasLimit=i.longs===String?o.toString():i.longs===Number?o.toNumber():o}else s.GasLimit=i.longs===String?"0":0;i.bytes===String?s.Data="":(s.Data=[],i.bytes!==Array&&(s.Data=X.newBuffer(s.Data))),i.bytes===String?s.ChainID="":(s.ChainID=[],i.bytes!==Array&&(s.ChainID=X.newBuffer(s.ChainID))),s.Version=0,i.bytes===String?s.Signature="":(s.Signature=[],i.bytes!==Array&&(s.Signature=X.newBuffer(s.Signature))),s.Options=0,i.bytes===String?s.GuardAddr="":(s.GuardAddr=[],i.bytes!==Array&&(s.GuardAddr=X.newBuffer(s.GuardAddr))),i.bytes===String?s.GuardSignature="":(s.GuardSignature=[],i.bytes!==Array&&(s.GuardSignature=X.newBuffer(s.GuardSignature)))}return n.Nonce!=null&&n.hasOwnProperty("Nonce")&&(typeof n.Nonce=="number"?s.Nonce=i.longs===String?String(n.Nonce):n.Nonce:s.Nonce=i.longs===String?X.Long.prototype.toString.call(n.Nonce):i.longs===Number?new X.LongBits(n.Nonce.low>>>0,n.Nonce.high>>>0).toNumber(!0):n.Nonce),n.Value!=null&&n.hasOwnProperty("Value")&&(s.Value=i.bytes===String?X.base64.encode(n.Value,0,n.Value.length):i.bytes===Array?Array.prototype.slice.call(n.Value):n.Value),n.RcvAddr!=null&&n.hasOwnProperty("RcvAddr")&&(s.RcvAddr=i.bytes===String?X.base64.encode(n.RcvAddr,0,n.RcvAddr.length):i.bytes===Array?Array.prototype.slice.call(n.RcvAddr):n.RcvAddr),n.RcvUserName!=null&&n.hasOwnProperty("RcvUserName")&&(s.RcvUserName=i.bytes===String?X.base64.encode(n.RcvUserName,0,n.RcvUserName.length):i.bytes===Array?Array.prototype.slice.call(n.RcvUserName):n.RcvUserName),n.SndAddr!=null&&n.hasOwnProperty("SndAddr")&&(s.SndAddr=i.bytes===String?X.base64.encode(n.SndAddr,0,n.SndAddr.length):i.bytes===Array?Array.prototype.slice.call(n.SndAddr):n.SndAddr),n.SndUserName!=null&&n.hasOwnProperty("SndUserName")&&(s.SndUserName=i.bytes===String?X.base64.encode(n.SndUserName,0,n.SndUserName.length):i.bytes===Array?Array.prototype.slice.call(n.SndUserName):n.SndUserName),n.GasPrice!=null&&n.hasOwnProperty("GasPrice")&&(typeof n.GasPrice=="number"?s.GasPrice=i.longs===String?String(n.GasPrice):n.GasPrice:s.GasPrice=i.longs===String?X.Long.prototype.toString.call(n.GasPrice):i.longs===Number?new X.LongBits(n.GasPrice.low>>>0,n.GasPrice.high>>>0).toNumber(!0):n.GasPrice),n.GasLimit!=null&&n.hasOwnProperty("GasLimit")&&(typeof n.GasLimit=="number"?s.GasLimit=i.longs===String?String(n.GasLimit):n.GasLimit:s.GasLimit=i.longs===String?X.Long.prototype.toString.call(n.GasLimit):i.longs===Number?new X.LongBits(n.GasLimit.low>>>0,n.GasLimit.high>>>0).toNumber(!0):n.GasLimit),n.Data!=null&&n.hasOwnProperty("Data")&&(s.Data=i.bytes===String?X.base64.encode(n.Data,0,n.Data.length):i.bytes===Array?Array.prototype.slice.call(n.Data):n.Data),n.ChainID!=null&&n.hasOwnProperty("ChainID")&&(s.ChainID=i.bytes===String?X.base64.encode(n.ChainID,0,n.ChainID.length):i.bytes===Array?Array.prototype.slice.call(n.ChainID):n.ChainID),n.Version!=null&&n.hasOwnProperty("Version")&&(s.Version=n.Version),n.Signature!=null&&n.hasOwnProperty("Signature")&&(s.Signature=i.bytes===String?X.base64.encode(n.Signature,0,n.Signature.length):i.bytes===Array?Array.prototype.slice.call(n.Signature):n.Signature),n.Options!=null&&n.hasOwnProperty("Options")&&(s.Options=n.Options),n.GuardAddr!=null&&n.hasOwnProperty("GuardAddr")&&(s.GuardAddr=i.bytes===String?X.base64.encode(n.GuardAddr,0,n.GuardAddr.length):i.bytes===Array?Array.prototype.slice.call(n.GuardAddr):n.GuardAddr),n.GuardSignature!=null&&n.hasOwnProperty("GuardSignature")&&(s.GuardSignature=i.bytes===String?X.base64.encode(n.GuardSignature,0,n.GuardSignature.length):i.bytes===Array?Array.prototype.slice.call(n.GuardSignature):n.GuardSignature),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Xo.util.toJSONOptions)},e}(),t}();Tx.exports=Ec});var xx=E(Rr=>{"use strict";l();var IH=Rr&&Rr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),_H=Rr&&Rr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),SH=Rr&&Rr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&IH(e,t,r);return _H(e,t),e},TH=Rr&&Rr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var CH=TH(kt()),Hw=ht(),xH=Ss(),NH=SH(Be()),OH=dc(),Gw=class{serializeTransaction(e){let r=Cx().proto,n=new Hw.Address(e.getReceiver().bech32()).pubkey(),i=new Hw.Address(e.getSender().bech32()).pubkey(),s=new r.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:n,RcvUserName:e.getReceiverUsername()?d.Buffer.from(e.getReceiverUsername()).toString("base64"):void 0,SndAddr:i,SndUserName:e.getSenderUsername()?d.Buffer.from(e.getSenderUsername()).toString("base64"):void 0,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:d.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:e.getSignature()});if(e.getOptions().valueOf()!==xH.TRANSACTION_OPTIONS_DEFAULT&&(s.Options=e.getOptions().valueOf()),e.isGuardedTransaction()){let u=e.getGuardian();s.GuardAddr=new Hw.Address(u.bech32()).pubkey(),s.GuardSignature=e.getGuardianSignature()}let o=r.Transaction.encode(s).finish();return d.Buffer.from(o)}serializeTransactionValue(e){let r=new CH.default(e.toString());if(r.isZero())return d.Buffer.from([0,0]);let n=OH.bigIntToBuffer(r);return n=d.Buffer.concat([d.Buffer.from([0]),n]),n}deserializeTransaction(e){throw new NH.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=Gw});var Nx=E(Rs=>{"use strict";l();var DH=Rs&&Rs.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),PH=Rs&&Rs.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&DH(e,t,r)};Object.defineProperty(Rs,"__esModule",{value:!0});PH(xx(),Rs)});var vc=E(Br=>{"use strict";l();var RH=Br&&Br.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BH=Br&&Br.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LH=Br&&Br.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RH(e,t,r);return BH(e,t),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.interpretSignatureAsBuffer=Br.Signature=void 0;var Ox=LH(Be()),Dx=64,kw=class t{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return t.fromHex(e);if(e instanceof d.Buffer)return t.fromBuffer(e)}}static empty(){return new t}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!t.isValidHex(e))throw new Ox.ErrSignatureCannotCreate(e);return t.fromValidHex(e)}static isValidHex(e){return d.Buffer.from(e,"hex").length==Dx}static fromValidHex(e){let r=new t;return r.valueHex=e,r}static fromBuffer(e){if(e.length!=Dx)throw new Ox.ErrSignatureCannotCreate(e);return t.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};Br.Signature=kw;function FH(t){if(ArrayBuffer.isView(t))return d.Buffer.from(t);if(t.hex!=null)return d.Buffer.from(t.hex(),"hex");throw new Error(`Object cannot be interpreted as a signature: ${t}`)}Br.interpretSignatureAsBuffer=FH});var zn=E(Xh=>{"use strict";l();Object.defineProperty(Xh,"__esModule",{value:!0});Xh.TransactionPayload=void 0;var jw=class t{constructor(e){this.data=d.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new t("");let r=d.Buffer.from(e,"base64").toString();return new t(r)}isEmpty(){return this.data.length==0}encoded(){return this.data.toString("base64")}valueOf(){return this.data}toString(){return this.data.toString()}getEncodedArguments(){return this.toString().split("@")}getRawArguments(){return this.getEncodedArguments().map(e=>d.Buffer.from(e,"hex"))}length(){return d.Buffer.from(this.data).length}};Xh.TransactionPayload=jw});var Qw=E((Sue,Px)=>{l();$n.notEqual=UH;$n.notOk=qH;$n.equal=MH;$n.ok=$n;Px.exports=$n;function MH(t,e,r){$n(t==e,r)}function UH(t,e,r){$n(t!=e,r)}function qH(t,e){$n(!t,e)}function $n(t,e){if(!t)throw new Error(e||"AssertionError")}});var Ls=E(ra=>{"use strict";l();var Ww=P0(),ea=B0(),Rx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ra.Buffer=z;ra.SlowBuffer=QH;ra.INSPECT_MAX_BYTES=50;var Zh=2147483647;ra.kMaxLength=Zh;z.TYPED_ARRAY_SUPPORT=VH();!z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function VH(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(z.prototype,"parent",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.buffer}});Object.defineProperty(z.prototype,"offset",{enumerable:!0,get:function(){if(z.isBuffer(this))return this.byteOffset}});function Kn(t){if(t>Zh)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,z.prototype),e}function z(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Yw(t)}return Mx(t,e,r)}z.poolSize=8192;function Mx(t,e,r){if(typeof t=="string")return GH(t,e);if(ArrayBuffer.isView(t))return kH(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(En(t,ArrayBuffer)||t&&En(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(En(t,SharedArrayBuffer)||t&&En(t.buffer,SharedArrayBuffer)))return $w(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return z.from(n,e,r);let i=jH(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return z.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}z.from=function(t,e,r){return Mx(t,e,r)};Object.setPrototypeOf(z.prototype,Uint8Array.prototype);Object.setPrototypeOf(z,Uint8Array);function Ux(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function HH(t,e,r){return Ux(t),t<=0?Kn(t):e!==void 0?typeof r=="string"?Kn(t).fill(e,r):Kn(t).fill(e):Kn(t)}z.alloc=function(t,e,r){return HH(t,e,r)};function Yw(t){return Ux(t),Kn(t<0?0:Jw(t)|0)}z.allocUnsafe=function(t){return Yw(t)};z.allocUnsafeSlow=function(t){return Yw(t)};function GH(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!z.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=qx(t,e)|0,n=Kn(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function zw(t){let e=t.length<0?0:Jw(t.length)|0,r=Kn(e);for(let n=0;n=Zh)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zh.toString(16)+" bytes");return t|0}function QH(t){return+t!=t&&(t=0),z.alloc(+t)}z.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==z.prototype};z.compare=function(e,r){if(En(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),En(r,Uint8Array)&&(r=z.from(r,r.offset,r.byteLength)),!z.isBuffer(e)||!z.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);si.length?(z.isBuffer(o)||(o=z.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(z.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function qx(t,e){if(z.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||En(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Kw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return $x(t).length;default:if(i)return n?-1:Kw(t).length;e=(""+e).toLowerCase(),i=!0}}z.byteLength=qx;function WH(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return rG(this,e,r);case"utf8":case"utf-8":return Hx(this,e,r);case"ascii":return eG(this,e,r);case"latin1":case"binary":return tG(this,e,r);case"base64":return XH(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nG(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}z.prototype._isBuffer=!0;function Bs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}z.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;rr&&(e+=" ... "),""};Rx&&(z.prototype[Rx]=z.prototype.inspect);z.prototype.compare=function(e,r,n,i,s){if(En(e,Uint8Array)&&(e=z.from(e,e.offset,e.byteLength)),!z.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,u=Math.min(o,a),c=this.slice(i,s),f=e.slice(r,n);for(let h=0;h2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Zw(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),z.isBuffer(e))return e.length===0?-1:Bx(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Bx(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Bx(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function u(f,h){return s===1?f[h]:f.readUInt16BE(h*s)}let c;if(i){let f=-1;for(c=r;co&&(r=o-a),c=r;c>=0;c--){let f=!0;for(let h=0;hi&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return zH(this,e,r,n);case"utf8":case"utf-8":return $H(this,e,r,n);case"ascii":case"latin1":case"binary":return KH(this,e,r,n);case"base64":return YH(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return JH(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function XH(t,e,r){return e===0&&r===t.length?Ww.fromByteArray(t):Ww.fromByteArray(t.slice(e,r))}function Hx(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i239?4:s>223?3:s>191?2:1;if(i+a<=r){let u,c,f,h;switch(a){case 1:s<128&&(o=s);break;case 2:u=t[i+1],(u&192)===128&&(h=(s&31)<<6|u&63,h>127&&(o=h));break;case 3:u=t[i+1],c=t[i+2],(u&192)===128&&(c&192)===128&&(h=(s&15)<<12|(u&63)<<6|c&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(h=(s&15)<<18|(u&63)<<12|(c&63)<<6|f&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return ZH(n)}var Lx=4096;function ZH(t){let e=t.length;if(e<=Lx)return String.fromCharCode.apply(String,t);let r="",n=0;for(;nn)&&(r=n);let i="";for(let s=e;sn&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}z.prototype.readUintLE=z.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};z.prototype.readUint8=z.prototype.readUInt8=function(e,r){return e=e>>>0,r||Mt(e,1,this.length),this[e]};z.prototype.readUint16LE=z.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Mt(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUint16BE=z.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Mt(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUint32LE=z.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUint32BE=z.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readBigUInt64LE=Ci(function(e){e=e>>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<>>0,r=r>>>0,n||Mt(e,r,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*r)),i};z.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||Mt(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};z.prototype.readInt8=function(e,r){return e=e>>>0,r||Mt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,r){e=e>>>0,r||Mt(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,r){e=e>>>0,r||Mt(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readBigInt64LE=Ci(function(e){e=e>>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<>>0,ta(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Ac(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,r||Mt(e,4,this.length),ea.read(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Mt(e,4,this.length),ea.read(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Mt(e,8,this.length),ea.read(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Mt(e,8,this.length),ea.read(this,e,!1,52,8)};function dr(t,e,r,n,i,s){if(!z.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}z.prototype.writeUintLE=z.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;dr(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;dr(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};z.prototype.writeUint8=z.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,1,255,0),this[r]=e&255,r+1};z.prototype.writeUint16LE=z.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeUint16BE=z.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeUint32LE=z.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};z.prototype.writeUint32BE=z.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Gx(t,e,r,n,i){zx(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function kx(t,e,r,n,i){zx(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}z.prototype.writeBigUInt64LE=Ci(function(e,r=0){return Gx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeBigUInt64BE=Ci(function(e,r=0){return kx(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});z.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);dr(this,e,r,n,u-1,-u)}let s=0,o=1,a=0;for(this[r]=e&255;++s>0)-a&255;return r+n};z.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);dr(this,e,r,n,u-1,-u)}let s=n-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};z.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};z.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};z.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};z.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};z.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||dr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};z.prototype.writeBigInt64LE=Ci(function(e,r=0){return Gx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});z.prototype.writeBigInt64BE=Ci(function(e,r=0){return kx(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function jx(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Qx(t,e,r,n,i){return e=+e,r=r>>>0,i||jx(t,e,r,4,34028234663852886e22,-34028234663852886e22),ea.write(t,e,r,n,23,4),r+4}z.prototype.writeFloatLE=function(e,r,n){return Qx(this,e,r,!0,n)};z.prototype.writeFloatBE=function(e,r,n){return Qx(this,e,r,!1,n)};function Wx(t,e,r,n,i){return e=+e,r=r>>>0,i||jx(t,e,r,8,17976931348623157e292,-17976931348623157e292),ea.write(t,e,r,n,52,8),r+8}z.prototype.writeDoubleLE=function(e,r,n){return Wx(this,e,r,!0,n)};z.prototype.writeDoubleBE=function(e,r,n){return Wx(this,e,r,!1,n)};z.prototype.copy=function(e,r,n,i){if(!z.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?i=Fx(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Fx(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Fx(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function iG(t,e,r){ta(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Ac(e,t.length-(r+1))}function zx(t,e,r,n,i,s){if(t>r||t3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new Zo.ERR_OUT_OF_RANGE("value",a,t)}iG(n,i,s)}function ta(t,e){if(typeof t!="number")throw new Zo.ERR_INVALID_ARG_TYPE(e,"number",t)}function Ac(t,e,r){throw Math.floor(t)!==t?(ta(t,r),new Zo.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Zo.ERR_BUFFER_OUT_OF_BOUNDS:new Zo.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var sG=/[^+/0-9A-Za-z-_]/g;function oG(t){if(t=t.split("=")[0],t=t.trim().replace(sG,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Kw(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function aG(t){let e=[];for(let r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function $x(t){return Ww.toByteArray(oG(t))}function ed(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function En(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Zw(t){return t!==t}var cG=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ci(t){return typeof BigInt>"u"?lG:t}function lG(){throw new Error("BigInt not supported")}});var Yx=E((Oue,Kx)=>{l();Kx.exports=eE;eE.supported=typeof WebAssembly<"u";function eE(t){if(!eE.supported)return null;var e=t&&t.imports,r=fG("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBN8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAUfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgFXx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBZ8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAXfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggGHx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBl8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAafHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgG3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBx8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAdfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHnx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB98fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAgfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgH3x8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBt8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAVfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGXx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBp8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAgfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggHnx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBd8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiASfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgHXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBF8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByATfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHHx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBh8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAWfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgFHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBx8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAZfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgHXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBF8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAWfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgE3x8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIICB8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAefHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgG3x8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB98fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAUfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgF3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBh8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCASfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgGnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBV8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAYfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgGnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBR8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiASfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgHnx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB18fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAcfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggH3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBN8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAXfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgFnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBt8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAVfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggEXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFICB8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAZfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgGnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBF8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAWfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgGHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBN8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAVfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggG3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIICB8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAffHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBx8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAdfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggF3x8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBl8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAUfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgHnx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBN8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAdfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgF3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBt8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByARfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgHHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBl8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAUfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgFXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB58fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAYfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgFnx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIICB8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAffHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgEnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBp8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAdfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgFnx8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBJ8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAgfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgH3x8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIB58fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCAVfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggG3x8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGIBF8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAYfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgF3x8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIBR8fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAafHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggE3x8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIBl8fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSAcfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgHnx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBx8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiAYfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgH3x8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIB18fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByASfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggFHx8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBp8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAWfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgEXx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHICB8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAVfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggGXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIBd8fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSATfHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgG3x8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIBd8fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAgfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgH3x8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBp8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAcfHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgFHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIBF8fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAZfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgHXx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIBN8fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByAefHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgGHx8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBJ8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAVfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgG3x8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBZ8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFIAEgBSAbfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgE3x8IQEgDSABhUIQiiENIAkgDXwhCSAFIAmFQj+KIQUgAiAGIBl8fCECIA4gAoVCIIohDiAKIA58IQogBiAKhUIYiiEGIAIgBiAVfHwhAiAOIAKFQhCKIQ4gCiAOfCEKIAYgCoVCP4ohBiADIAcgGHx8IQMgDyADhUIgiiEPIAsgD3whCyAHIAuFQhiKIQcgAyAHIBd8fCEDIA8gA4VCEIohDyALIA98IQsgByALhUI/iiEHIAQgCCASfHwhBCAQIASFQiCKIRAgDCAQfCEMIAggDIVCGIohCCAEIAggFnx8IQQgECAEhUIQiiEQIAwgEHwhDCAIIAyFQj+KIQggASAGICB8fCEBIBAgAYVCIIohECALIBB8IQsgBiALhUIYiiEGIAEgBiAcfHwhASAQIAGFQhCKIRAgCyAQfCELIAYgC4VCP4ohBiACIAcgGnx8IQIgDSAChUIgiiENIAwgDXwhDCAHIAyFQhiKIQcgAiAHIB98fCECIA0gAoVCEIohDSAMIA18IQwgByAMhUI/iiEHIAMgCCAUfHwhAyAOIAOFQiCKIQ4gCSAOfCEJIAggCYVCGIohCCADIAggHXx8IQMgDiADhUIQiiEOIAkgDnwhCSAIIAmFQj+KIQggBCAFIB58fCEEIA8gBIVCIIohDyAKIA98IQogBSAKhUIYiiEFIAQgBSARfHwhBCAPIASFQhCKIQ8gCiAPfCEKIAUgCoVCP4ohBSABIAUgEXx8IQEgDSABhUIgiiENIAkgDXwhCSAFIAmFQhiKIQUgASAFIBJ8fCEBIA0gAYVCEIohDSAJIA18IQkgBSAJhUI/iiEFIAIgBiATfHwhAiAOIAKFQiCKIQ4gCiAOfCEKIAYgCoVCGIohBiACIAYgFHx8IQIgDiAChUIQiiEOIAogDnwhCiAGIAqFQj+KIQYgAyAHIBV8fCEDIA8gA4VCIIohDyALIA98IQsgByALhUIYiiEHIAMgByAWfHwhAyAPIAOFQhCKIQ8gCyAPfCELIAcgC4VCP4ohByAEIAggF3x8IQQgECAEhUIgiiEQIAwgEHwhDCAIIAyFQhiKIQggBCAIIBh8fCEEIBAgBIVCEIohECAMIBB8IQwgCCAMhUI/iiEIIAEgBiAZfHwhASAQIAGFQiCKIRAgCyAQfCELIAYgC4VCGIohBiABIAYgGnx8IQEgECABhUIQiiEQIAsgEHwhCyAGIAuFQj+KIQYgAiAHIBt8fCECIA0gAoVCIIohDSAMIA18IQwgByAMhUIYiiEHIAIgByAcfHwhAiANIAKFQhCKIQ0gDCANfCEMIAcgDIVCP4ohByADIAggHXx8IQMgDiADhUIgiiEOIAkgDnwhCSAIIAmFQhiKIQggAyAIIB58fCEDIA4gA4VCEIohDiAJIA58IQkgCCAJhUI/iiEIIAQgBSAffHwhBCAPIASFQiCKIQ8gCiAPfCEKIAUgCoVCGIohBSAEIAUgIHx8IQQgDyAEhUIQiiEPIAogD3whCiAFIAqFQj+KIQUgASAFIB98fCEBIA0gAYVCIIohDSAJIA18IQkgBSAJhUIYiiEFIAEgBSAbfHwhASANIAGFQhCKIQ0gCSANfCEJIAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"),n=null,i={buffer:r,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),i;function s(u){i.exports.memory.grow(Math.ceil(Math.abs(u-i.memory.length)/65536)),i.memory=new Uint8Array(i.exports.memory.buffer)}function o(u){if(i.exports)return u();if(n){n.then(u.bind(null,null)).catch(u);return}try{if(t&&t.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(r),e)})}catch{n=WebAssembly.instantiate(r,e).then(a)}o(u)}function a(u){i.exports=u.instance.exports,i.memory=i.exports.memory&&i.exports.memory.buffer&&new Uint8Array(i.exports.memory.buffer)}}function fG(t){return typeof atob=="function"?new Uint8Array(atob(t).split("").map(hG)):new(Ls()).Buffer(t,"base64")}function hG(t){return t.charCodeAt(0)}});var nN=E((Bue,An)=>{l();var vn=Qw(),Ke=Yx()(),Yn=64,td=[];An.exports=Lr;var Jx=An.exports.BYTES_MIN=16,Xx=An.exports.BYTES_MAX=64,Pue=An.exports.BYTES=32,Zx=An.exports.KEYBYTES_MIN=16,eN=An.exports.KEYBYTES_MAX=64,Rue=An.exports.KEYBYTES=32,tN=An.exports.SALTBYTES=16,rN=An.exports.PERSONALBYTES=16;function Lr(t,e,r,n,i){if(!(this instanceof Lr))return new Lr(t,e,r,n,i);if(!(Ke&&Ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");t||(t=32),i!==!0&&(vn(t>=Jx,"digestLength must be at least "+Jx+", was given "+t),vn(t<=Xx,"digestLength must be at most "+Xx+", was given "+t),e!=null&&vn(e.length>=Zx,"key must be at least "+Zx+", was given "+e.length),e!=null&&vn(e.length<=eN,"key must be at least "+eN+", was given "+e.length),r!=null&&vn(r.length===tN,"salt must be exactly "+tN+", was given "+r.length),n!=null&&vn(n.length===rN,"personal must be exactly "+rN+", was given "+n.length)),td.length||(td.push(Yn),Yn+=216),this.digestLength=t,this.finalized=!1,this.pointer=td.pop(),Ke.memory.fill(0,0,64),Ke.memory[0]=this.digestLength,Ke.memory[1]=e?e.length:0,Ke.memory[2]=1,Ke.memory[3]=1,r&&Ke.memory.set(r,32),n&&Ke.memory.set(n,48),this.pointer+216>Ke.memory.length&&Ke.realloc(this.pointer+216),Ke.exports.blake2b_init(this.pointer,this.digestLength),e&&(this.update(e),Ke.memory.fill(0,Yn,Yn+e.length),Ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(t){return vn(this.finalized===!1,"Hash instance finalized"),vn(t,"input must be TypedArray or Buffer"),Yn+t.length>Ke.memory.length&&Ke.realloc(Yn+t.length),Ke.memory.set(t,Yn),Ke.exports.blake2b_update(this.pointer,Yn,Yn+t.length),this};Lr.prototype.digest=function(t){if(vn(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,td.push(this.pointer),Ke.exports.blake2b_final(this.pointer),!t||t==="binary")return Ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(t==="hex")return pG(Ke.memory,this.pointer+128,this.digestLength);vn(t.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{l();var Oi=Qw(),Ic=nN();function rd(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function iN(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var s=t[e+1]+n;i>=4294967296&&s++,t[e]=i,t[e+1]=s}function fN(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function xi(t,e,r,n,i,s){var o=bc[i],a=bc[i+1],u=bc[s],c=bc[s+1];rd(Ce,t,e),iN(Ce,t,o,a);var f=Ce[n]^Ce[t],h=Ce[n+1]^Ce[t+1];Ce[n]=h,Ce[n+1]=f,rd(Ce,r,n),f=Ce[e]^Ce[r],h=Ce[e+1]^Ce[r+1],Ce[e]=f>>>24^h<<8,Ce[e+1]=h>>>24^f<<8,rd(Ce,t,e),iN(Ce,t,u,c),f=Ce[n]^Ce[t],h=Ce[n+1]^Ce[t+1],Ce[n]=f>>>16^h<<16,Ce[n+1]=h>>>16^f<<16,rd(Ce,r,n),f=Ce[e]^Ce[r],h=Ce[e+1]^Ce[r+1],Ce[e]=h>>>31^f<<1,Ce[e+1]=f>>>31^h<<1}var hN=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),yG=[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],Yt=new Uint8Array(yG.map(function(t){return t*2})),Ce=new Uint32Array(32),bc=new Uint32Array(32);function dN(t,e){var r=0;for(r=0;r<16;r++)Ce[r]=t.h[r],Ce[r+16]=hN[r];for(Ce[24]=Ce[24]^t.t,Ce[25]=Ce[25]^t.t/4294967296,e&&(Ce[28]=~Ce[28],Ce[29]=~Ce[29]),r=0;r<32;r++)bc[r]=fN(t.b,4*r);for(r=0;r<12;r++)xi(0,8,16,24,Yt[r*16+0],Yt[r*16+1]),xi(2,10,18,26,Yt[r*16+2],Yt[r*16+3]),xi(4,12,20,28,Yt[r*16+4],Yt[r*16+5]),xi(6,14,22,30,Yt[r*16+6],Yt[r*16+7]),xi(0,10,20,30,Yt[r*16+8],Yt[r*16+9]),xi(2,12,22,24,Yt[r*16+10],Yt[r*16+11]),xi(4,14,16,26,Yt[r*16+12],Yt[r*16+13]),xi(6,8,18,28,Yt[r*16+14],Yt[r*16+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^Ce[r]^Ce[r+16]}var Ni=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function na(t,e,r,n){Ni.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,Ni[0]=t,e&&(Ni[1]=e.length),Ni[2]=1,Ni[3]=1,r&&Ni.set(r,32),n&&Ni.set(n,48);for(var i=0;i<16;i++)this.h[i]=hN[i]^fN(Ni,i*4);e&&(pN(this,e),this.c=128)}na.prototype.update=function(t){return Oi(t!=null,"input must be Uint8Array or Buffer"),pN(this,t),this};na.prototype.digest=function(t){var e=!t||t==="binary"||t==="hex"?new Uint8Array(this.outlen):t;return Oi(e.length>=this.outlen,"out must have at least outlen bytes of space"),mG(this,e),t==="hex"?wG(e):e};na.prototype.final=na.prototype.digest;na.ready=function(t){Ic.ready(function(){t()})};function pN(t,e){for(var r=0;r>2]>>8*(r&3);return e}function wG(t){for(var e="",r=0;r=sN,"outlen must be at least "+sN+", was given "+e),Oi(e<=oN,"outlen must be at most "+oN+", was given "+e),r!=null&&Oi(r.length>=aN,"key must be at least "+aN+", was given "+r.length),r!=null&&Oi(r.length<=uN,"key must be at most "+uN+", was given "+r.length),n!=null&&Oi(n.length===cN,"salt must be exactly "+cN+", was given "+n.length),i!=null&&Oi(i.length===lN,"personal must be exactly "+lN+", was given "+i.length)),new gN(e,r,n,i)};pr.exports.ready=function(t){Ic.ready(function(){t()})};pr.exports.WASM_SUPPORTED=Ic.SUPPORTED;pr.exports.WASM_LOADED=!1;var sN=pr.exports.BYTES_MIN=16,oN=pr.exports.BYTES_MAX=64,Fue=pr.exports.BYTES=32,aN=pr.exports.KEYBYTES_MIN=16,uN=pr.exports.KEYBYTES_MAX=64,Mue=pr.exports.KEYBYTES=32,cN=pr.exports.SALTBYTES=16,lN=pr.exports.PERSONALBYTES=16;Ic.ready(function(t){t||(pr.exports.WASM_LOADED=!0,gN=Ic)})});var bn=E(Fr=>{"use strict";l();var vG=Fr&&Fr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),AG=Fr&&Fr.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),bG=Fr&&Fr.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vG(e,t,r);return AG(e,t),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var ia=kt(),_c=ht(),IG=Wh(),_G=Ss(),SG=bG(Be()),TG=CC(),Jn=gc(),CG=Nx(),nd=vc(),mN=zn(),xG=vr(),NG=yN(),OG=32,tE=class t{constructor({nonce:e,value:r,sender:n,receiver:i,senderUsername:s,receiverUsername:o,gasPrice:a,gasLimit:u,data:c,chainID:f,version:h,options:g,guardian:y}){this.nonce=e||0,this.value=r?new ia.BigNumber(r.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.senderUsername=s||"",this.receiverUsername=o||"",this.gasPrice=a||_G.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=u,this.data=c||new mN.TransactionPayload,this.chainID=f,this.version=h?new Jn.TransactionVersion(h.valueOf()):Jn.TransactionVersion.withDefaultVersion(),this.options=g?new Jn.TransactionOptions(g.valueOf()):Jn.TransactionOptions.withDefaultOptions(),this.guardian=y||_c.Address.empty(),this.signature=d.Buffer.from([]),this.guardianSignature=d.Buffer.from([]),this.hash=sa.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}setSender(e){this.sender=e}getReceiver(){return this.receiver}getSenderUsername(){return this.senderUsername}setSenderUsername(e){this.senderUsername=e}getReceiverUsername(){return this.receiverUsername}setReceiverUsername(e){this.receiverUsername=e}getGuardian(){return this.guardian}getGasPrice(){return this.gasPrice}setGasPrice(e){this.gasPrice=e}getGasLimit(){return this.gasLimit}setGasLimit(e){this.gasLimit=e}getData(){return this.data}getChainID(){return this.chainID}setChainID(e){this.chainID=e}getVersion(){return this.version}setVersion(e){this.version=new Jn.TransactionVersion(e.valueOf())}getOptions(){return new Jn.TransactionOptions(this.options.valueOf())}setOptions(e){this.options=new Jn.TransactionOptions(e.valueOf())}getSignature(){return this.signature}getGuardianSignature(){return this.guardianSignature}setGuardian(e){this.guardian=e}getHash(){return xG.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(){let e=this.toPlainObject();e.signature&&delete e.signature,e.guardianSignature&&delete e.guardianSignature,e.guardian||delete e.guardian;let r=JSON.stringify(e);return d.Buffer.from(r)}isGuardedTransaction(){let e=this.guardian.bech32().length>0,r=this.guardianSignature.length>0;return this.getOptions().isWithGuardian()&&e&&r}toPlainObject(){var e;let r={nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:this.sender.bech32(),senderUsername:this.senderUsername?d.Buffer.from(this.senderUsername).toString("base64"):void 0,receiverUsername:this.receiverUsername?d.Buffer.from(this.receiverUsername).toString("base64"):void 0,gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.getVersion().valueOf(),options:this.getOptions().valueOf()==0?void 0:this.getOptions().valueOf(),guardian:!((e=this.guardian)===null||e===void 0)&&e.bech32()?this.guardian.bech32()==""?void 0:this.guardian.bech32():void 0,signature:this.signature.toString("hex")?this.signature.toString("hex"):void 0,guardianSignature:this.guardianSignature.toString("hex")?this.guardianSignature.toString("hex"):void 0};return IG.Compatibility.guardAddressIsSetAndNonZero(new _c.Address(r.sender),"'sender' of transaction","pass the actual sender to the Transaction constructor"),r}static fromPlainObject(e){let r=new t({nonce:Number(e.nonce),value:new ia.BigNumber(e.value).toFixed(0),receiver:_c.Address.fromString(e.receiver),receiverUsername:e.receiverUsername?d.Buffer.from(e.receiverUsername,"base64").toString():void 0,sender:_c.Address.fromString(e.sender),senderUsername:e.senderUsername?d.Buffer.from(e.senderUsername,"base64").toString():void 0,guardian:e.guardian?_c.Address.fromString(e.guardian):void 0,gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new mN.TransactionPayload(d.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Jn.TransactionVersion(e.version),options:e.options!=null?new Jn.TransactionOptions(e.options):void 0});return e.signature&&r.applySignature(new nd.Signature(e.signature)),e.guardianSignature&&r.applyGuardianSignature(new nd.Signature(e.guardianSignature)),r}applySignature(e){this.signature=nd.interpretSignatureAsBuffer(e),this.hash=sa.compute(this)}applyGuardianSignature(e){this.guardianSignature=nd.interpretSignatureAsBuffer(e),this.hash=sa.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let r=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(r>this.gasLimit.valueOf())throw new SG.ErrNotEnoughGas(this.gasLimit.valueOf());let n=new ia.BigNumber(this.gasPrice.valueOf()),i=new ia.BigNumber(r).multipliedBy(n);if(r===this.gasLimit.valueOf())return i;let s=new ia.BigNumber(this.gasLimit.valueOf()-r),o=n.multipliedBy(new ia.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return i.plus(a)}};Fr.Transaction=tE;var sa=class t extends TG.Hash{constructor(e){super(e)}static compute(e){let n=new CG.ProtoSerializer().serializeTransaction(e),i=NG(OG).update(n).digest("hex");return new t(i)}};Fr.TransactionHash=sa});var sE=E(sd=>{"use strict";l();Object.defineProperty(sd,"__esModule",{value:!0});sd.TransferTransactionsFactory=void 0;var rE=Yo(),Kr=St(),id=bn(),nE=zn(),iE=class{constructor(e){this.gasEstimator=e}createEGLDTransfer(e){var r;let n=((r=e.data)===null||r===void 0?void 0:r.length())||0,i=this.gasEstimator.forEGLDTransfer(n);return new id.Transaction({nonce:e.nonce,value:e.value,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||i,data:e.data,chainID:e.chainID})}createESDTTransfer(e){let{argumentsString:r}=new rE.ArgSerializer().valuesToString([Kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Kr.BigUIntValue(e.tokenTransfer.valueOf())]),n=`ESDTTransfer@${r}`,i=new nE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTTransfer(s);return new id.Transaction({nonce:e.nonce,receiver:e.receiver,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createESDTNFTTransfer(e){let{argumentsString:r}=new rE.ArgSerializer().valuesToString([Kr.BytesValue.fromUTF8(e.tokenTransfer.tokenIdentifier),new Kr.U64Value(e.tokenTransfer.nonce),new Kr.BigUIntValue(e.tokenTransfer.valueOf()),new Kr.AddressValue(e.destination)]),n=`ESDTNFTTransfer@${r}`,i=new nE.TransactionPayload(n),s=i.length()||0,o=this.gasEstimator.forESDTNFTTransfer(s);return new id.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||o,data:i,chainID:e.chainID})}createMultiESDTNFTTransfer(e){let r=[new Kr.AddressValue(e.destination),new Kr.U16Value(e.tokenTransfers.length)];for(let u of e.tokenTransfers)r.push(Kr.BytesValue.fromUTF8(u.tokenIdentifier),new Kr.U64Value(u.nonce),new Kr.BigUIntValue(u.valueOf()));let{argumentsString:n}=new rE.ArgSerializer().valuesToString(r),i=`MultiESDTNFTTransfer@${n}`,s=new nE.TransactionPayload(i),o=s.length()||0,a=this.gasEstimator.forMultiESDTNFTTransfer(o,e.tokenTransfers.length);return new id.Transaction({nonce:e.nonce,receiver:e.sender,sender:e.sender,gasPrice:e.gasPrice,gasLimit:e.gasLimit||a,data:s,chainID:e.chainID})}};sd.TransferTransactionsFactory=iE});var aE=E(Fs=>{"use strict";l();Object.defineProperty(Fs,"__esModule",{value:!0});Fs.GasEstimator=Fs.DefaultGasConfiguration=void 0;Fs.DefaultGasConfiguration={minGasLimit:5e4,gasPerDataByte:1500,gasCostESDTTransfer:2e5,gasCostESDTNFTTransfer:2e5,gasCostESDTNFTMultiTransfer:2e5};var DG=1e5,wN=8e5,oE=class{constructor(e){this.gasConfiguration=e||Fs.DefaultGasConfiguration}forEGLDTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasPerDataByte*e}forESDTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTTransfer+this.gasConfiguration.gasPerDataByte*e+DG}forESDTNFTTransfer(e){return this.gasConfiguration.minGasLimit+this.gasConfiguration.gasCostESDTNFTTransfer+this.gasConfiguration.gasPerDataByte*e+wN}forMultiESDTNFTTransfer(e,r){return this.gasConfiguration.minGasLimit+(this.gasConfiguration.gasCostESDTNFTMultiTransfer+wN)*r+this.gasConfiguration.gasPerDataByte*e}};Fs.GasEstimator=oE});var oa=E(od=>{"use strict";l();Object.defineProperty(od,"__esModule",{value:!0});od.Account=void 0;var PG=ht(),uE=class{constructor(e){this.address=new PG.Address,this.nonce=0,this.balance="0",this.address=e}update(e){this.nonce=e.nonce,this.balance=e.balance}incrementNonce(){this.nonce=this.nonce.valueOf()+1}getNonceThenIncrement(){let e=this.nonce;return this.nonce=this.nonce.valueOf()+1,e}toJSON(){return{address:this.address.bech32(),nonce:this.nonce.valueOf(),balance:this.balance.toString()}}};od.Account=uE});var aa=E(Us=>{"use strict";l();Object.defineProperty(Us,"__esModule",{value:!0});Us.Logger=Us.LogLevel=void 0;var Ms;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Info=2]="Info",t[t.Warn=3]="Warn",t[t.Error=4]="Error",t[t.None=5]="None"})(Ms=Us.LogLevel||(Us.LogLevel={}));var ad=class t{static setLevel(e){t.logLevel=e}static trace(e,...r){t.logLevel>=Ms.Debug||console.debug(e,r)}static debug(e,...r){t.logLevel>=Ms.Debug||console.debug(e,r)}static info(e,...r){t.logLevel>=Ms.Info||console.log(e,r)}static warn(e,...r){t.logLevel>=Ms.Warn||console.warn(e,r)}static error(e,...r){t.logLevel>=Ms.Error||console.error(e,r)}};Us.Logger=ad;ad.logLevel=Ms.Debug});var fE=E(In=>{"use strict";l();var RG=In&&In.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),BG=In&&In.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),LG=In&&In.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&RG(e,t,r);return BG(e,t),e};Object.defineProperty(In,"__esModule",{value:!0});In.AsyncTimer=void 0;var FG=LG(Be()),MG=Be(),cE=aa(),lE=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new FG.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,cE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((r,n)=>{this.rejectionFunc=n;let i=()=>{this.rejectionFunc=null,this.stop(),r()};this.timeoutHandle=setTimeout(i,e)})}abort(){cE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new MG.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(cE.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};In.AsyncTimer=lE});var ud=E(ua=>{"use strict";l();var Mr=ua&&ua.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(ua,"__esModule",{value:!0});ua.TransactionWatcher=void 0;var hE=fE(),Di=Be(),EN=aa(),Pi=class t{constructor(e,r={}){this.fetcher=new dE(e),this.pollingIntervalMilliseconds=r.pollingIntervalMilliseconds||t.DefaultPollingInterval,this.timeoutMilliseconds=r.timeoutMilliseconds||t.DefaultTimeout,this.patienceMilliseconds=r.patienceMilliseconds||t.DefaultPatience}awaitPending(e){return Mr(this,void 0,void 0,function*(){let r=s=>s.status.isPending(),n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Di.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitCompleted(e){return Mr(this,void 0,void 0,function*(){let r=s=>{if(s.isCompleted===void 0)throw new Di.ErrIsCompletedFieldIsMissingOnTransaction;return s.isCompleted},n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Di.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitAllEvents(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.every(c=>a.includes(c))},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Di.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitAnyEvent(e,r){return Mr(this,void 0,void 0,function*(){let n=o=>{let a=this.getAllTransactionEvents(o).map(c=>c.identifier);return r.find(c=>a.includes(c))!=null},i=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Di.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(n,i,s)})}awaitOnCondition(e,r){return Mr(this,void 0,void 0,function*(){let n=()=>Mr(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),i=()=>new Di.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(r,n,i)})}awaitConditionally(e,r,n){return Mr(this,void 0,void 0,function*(){let i=new hE.AsyncTimer("watcher:periodic"),s=new hE.AsyncTimer("watcher:patience"),o=new hE.AsyncTimer("watcher:timeout"),a=!1,u,c=!1;for(o.start(this.timeoutMilliseconds).finally(()=>{o.stop(),a=!0});!a;){yield i.start(this.pollingIntervalMilliseconds);try{if(u=yield r(),c=e(u),c||a)break}catch(f){if(EN.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),f instanceof Di.ErrIsCompletedFieldIsMissingOnTransaction||!(f instanceof Di.Err))throw f}}if(c&&(yield s.start(this.patienceMilliseconds)),o.isStopped()||o.stop(),!u||!c)throw n();return u})}getAllTransactionEvents(e){let r=[...e.logs.events];for(let n of e.contractResults.items)r.push(...n.logs.events);return r}};ua.TransactionWatcher=Pi;Pi.DefaultPollingInterval=6e3;Pi.DefaultTimeout=Pi.DefaultPollingInterval*15;Pi.DefaultPatience=0;Pi.NoopOnStatusReceived=t=>{};var dE=class{constructor(e){this.fetcher=e}getTransaction(e){return Mr(this,void 0,void 0,function*(){return EN.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var gE=E(fd=>{"use strict";l();Object.defineProperty(fd,"__esModule",{value:!0});fd.CodeMetadata=void 0;var pE=class{constructor(e=!0,r=!1,n=!1,i=!1){this.upgradeable=e,this.readable=r,this.payable=n,this.payableBySc=i}toggleUpgradeable(e){this.upgradeable=e}toggleReadable(e){this.readable=e}togglePayable(e){this.payable=e}togglePayableBySc(e){this.payableBySc=e}toBuffer(){let e=0,r=0;return this.upgradeable&&(e|=cd.Upgradeable),this.readable&&(e|=cd.Readable),this.payable&&(r|=ld.Payable),this.payableBySc&&(r|=ld.PayableBySc),d.Buffer.from([e,r])}toString(){return this.toBuffer().toString("hex")}toJSON(){return{upgradeable:this.upgradeable,readable:this.readable,payable:this.payable,payableBySc:this.payableBySc}}equals(e){return this.upgradeable==e.upgradeable&&this.readable==e.readable&&this.payable==e.payable&&this.payableBySc==e.payableBySc}};fd.CodeMetadata=pE;var cd;(function(t){t[t.Upgradeable=1]="Upgradeable",t[t.Reserved2=2]="Reserved2",t[t.Readable=4]="Readable"})(cd||(cd={}));var ld;(function(t){t[t.Reserved1=1]="Reserved1",t[t.Payable=2]="Payable",t[t.PayableBySc=4]="PayableBySc"})(ld||(ld={}))});var Sc=E(_n=>{"use strict";l();var UG=_n&&_n.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),qG=_n&&_n.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),VG=_n&&_n.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&UG(e,t,r);return qG(e,t),e};Object.defineProperty(_n,"__esModule",{value:!0});_n.ContractFunction=void 0;var HG=VG(Be()),yE=class t{constructor(e){if(this.name=e,e==null)throw new HG.ErrInvalidFunctionName}static none(){return new t("untitled")}toString(){return this.name}valueOf(){return this.name}};_n.ContractFunction=yE});var EE=E(Ur=>{"use strict";l();var GG=Ur&&Ur.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kG=Ur&&Ur.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jG=Ur&&Ur.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&GG(e,t,r);return kG(e,t),e},QG=Ur&&Ur.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ur,"__esModule",{value:!0});Ur.InteractionChecker=void 0;var mE=jG(Be()),WG=QG(kt()),wE=class{checkInteraction(e,r){this.checkPayable(e,r),this.checkArguments(e,r)}checkPayable(e,r){let n=!new WG.default(e.getValue().toString()).isZero(),i=r.modifiers.isPayableInEGLD();if(n&&!i)throw new mE.ErrContractInteraction("cannot send EGLD value to non-payable")}checkArguments(e,r){let n=r.input,i=e.getArguments(),s=n.length,o=i.length;if(s!=o)throw new mE.ErrContractInteraction(`bad arguments, expected: ${s}, got: ${o}`);for(let a=0;a{"use strict";l();Object.defineProperty(hd,"__esModule",{value:!0});hd.Query=void 0;var zG=ht(),$G=Yo(),vE=class{constructor(e){this.caller=e.caller||new zG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new $G.ArgSerializer().valuesToStrings(this.args)}};hd.Query=vE});var _E=E(dd=>{"use strict";l();Object.defineProperty(dd,"__esModule",{value:!0});dd.Interaction=void 0;var vN=ht(),KG=Wh(),AE=Ss(),bE=Sc(),YG=EE(),JG=Tc(),ca=St(),IE=class{constructor(e,r,n){this.nonce=0,this.value="0",this.gasLimit=0,this.gasPrice=void 0,this.chainID="",this.querent=new vN.Address,this.sender=new vN.Address,this.isWithSingleESDTTransfer=!1,this.isWithSingleESDTNFTTransfer=!1,this.isWithMultiESDTNFTTransfer=!1,this.contract=e,this.function=r,this.args=n,this.tokenTransfers=new la([],this)}getContractAddress(){return this.contract.getAddress()}getFunction(){return this.function}getEndpoint(){return this.contract.getEndpoint(this.function)}getArguments(){return this.args}getValue(){return this.value}getTokenTransfers(){return this.tokenTransfers.getTransfers()}getGasLimit(){return this.gasLimit}getExplicitReceiver(){return this.explicitReceiver}buildTransaction(){KG.Compatibility.guardAddressIsSetAndNonZero(this.sender,"'sender' of interaction","use interaction.withSender()");let e=this.explicitReceiver||this.contract.getAddress(),r=this.function,n=this.args;this.isWithSingleESDTTransfer?(r=new bE.ContractFunction(AE.ESDT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTTransfer()):this.isWithSingleESDTNFTTransfer?(e=this.sender,r=new bE.ContractFunction(AE.ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForSingleESDTNFTTransfer()):this.isWithMultiESDTNFTTransfer&&(e=this.sender,r=new bE.ContractFunction(AE.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME),n=this.tokenTransfers.buildArgsForMultiESDTNFTTransfer());let i=this.contract.call({func:r,gasLimit:this.gasLimit,gasPrice:this.gasPrice,args:n,value:this.value,receiver:e,chainID:this.chainID,caller:this.sender});return i.setNonce(this.nonce),i}buildQuery(){return new JG.Query({address:this.contract.getAddress(),func:this.function,args:this.args,value:this.value,caller:this.querent})}withValue(e){return this.value=e,this}withSingleESDTTransfer(e){return this.isWithSingleESDTTransfer=!0,this.tokenTransfers=new la([e],this),this}withSingleESDTNFTTransfer(e,r){return this.isWithSingleESDTNFTTransfer=!0,this.tokenTransfers=new la([e],this),r&&(this.sender=r),this}withMultiESDTNFTTransfer(e,r){return this.isWithMultiESDTNFTTransfer=!0,this.tokenTransfers=new la(e,this),r&&(this.sender=r),this}withGasLimit(e){return this.gasLimit=e,this}withGasPrice(e){return this.gasPrice=e,this}withNonce(e){return this.nonce=e,this}useThenIncrementNonceOf(e){return this.withNonce(e.getNonceThenIncrement())}withChainID(e){return this.chainID=e,this}withSender(e){return this.sender=e,this}withQuerent(e){return this.querent=e,this}withExplicitReceiver(e){return this.explicitReceiver=e,this}check(){return new YG.InteractionChecker().checkInteraction(this,this.getEndpoint()),this}};dd.Interaction=IE;var la=class{constructor(e,r){this.transfers=e,this.interaction=r}getTransfers(){return this.transfers}buildArgsForSingleESDTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenQuantity(e),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForSingleESDTNFTTransfer(){let e=this.transfers[0];return[this.getTypedTokenIdentifier(e),this.getTypedTokenNonce(e),this.getTypedTokenQuantity(e),this.getTypedTokensReceiver(),this.getTypedInteractionFunction(),...this.getInteractionArguments()]}buildArgsForMultiESDTNFTTransfer(){let e=[];e.push(this.getTypedTokensReceiver()),e.push(this.getTypedNumberOfTransfers());for(let r of this.transfers)e.push(this.getTypedTokenIdentifier(r)),e.push(this.getTypedTokenNonce(r)),e.push(this.getTypedTokenQuantity(r));return e.push(this.getTypedInteractionFunction()),e.push(...this.getInteractionArguments()),e}getTypedNumberOfTransfers(){return new ca.U8Value(this.transfers.length)}getTypedTokenIdentifier(e){return ca.BytesValue.fromUTF8(e.tokenIdentifier)}getTypedTokenNonce(e){return new ca.U64Value(e.nonce)}getTypedTokenQuantity(e){return new ca.BigUIntValue(e.amountAsBigInteger)}getTypedTokensReceiver(){return new ca.AddressValue(this.interaction.getContractAddress())}getTypedInteractionFunction(){return ca.BytesValue.fromUTF8(this.interaction.getFunction().valueOf())}getInteractionArguments(){return this.interaction.getArguments()}}});var AN=E(pd=>{"use strict";l();Object.defineProperty(pd,"__esModule",{value:!0});pd.ArgumentErrorContext=void 0;var XG=Be(),SE=class{constructor(e,r,n){this.endpointName=e,this.argumentIndex=r,this.parameterDefinition=n}throwError(e){throw new XG.ErrInvalidArgument(`Error when converting arguments for endpoint (endpoint name: ${this.endpointName}, argument index: ${this.argumentIndex}, name: ${this.parameterDefinition.name}, type: ${this.parameterDefinition.type}) +Nested error: ${e}`)}convertError(e,r){this.throwError(`Can't convert argument (argument: ${e}, type ${typeof e}), wanted type: ${r})`)}unhandledType(e,r){this.throwError(`Unhandled type (function: ${e}, type: ${r})`)}guardSameLength(e,r){e=e||[],e.length!=r.length&&this.throwError(`Incorrect composite type length: have ${e.length}, expected ${r.length} (argument: ${e})`)}guardHasField(e,r){e=e||{},r in e||this.throwError(`Struct argument does not contain a field named "${r}" (argument: ${JSON.stringify(e)})`)}};pd.ArgumentErrorContext=SE});var CE=E(qs=>{"use strict";l();var ZG=qs&&qs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qs,"__esModule",{value:!0});qs.NativeSerializer=void 0;var ek=ZG(kt()),tk=ht(),TE=Be(),rk=bh(),nk=AN(),ve=St(),ik;(function(t){function e(A,_){A=A||[],r(A,_),n(_)&&(A=i(A,_));let N=_.input,I=[];for(let S=0;S0&&_[0].type.getCardinality().isComposite()&&(I=1/0,S=!0);for(let R of _){if(R.type.getCardinality().isSingular())break;N-=1}return{min:N,max:I,variadic:S}}function o(A,_,N){if(A&&A.belongsToTypesystem)return A;if(_ instanceof ve.OptionType)return a(A,_,N);if(_ instanceof ve.OptionalType)return u(A,_,N);if(_ instanceof ve.VariadicType)return c(A,_,N);if(_ instanceof ve.CompositeType)return h(A,_,N);if(_ instanceof ve.TupleType)return g(A,_,N);if(_ instanceof ve.StructType)return y(A,_,N);if(_ instanceof ve.ListType)return f(A,_,N);if(_ instanceof ve.PrimitiveType)return m(A,_,N);if(_ instanceof ve.EnumType)return T(A,_,N);N.throwError(`convertToTypedValue: unhandled type ${_}`)}function a(A,_,N){if(A==null)return ve.OptionValue.newMissing();let I=o(A,_.getFirstTypeParameter(),N);return ve.OptionValue.newProvided(I)}function u(A,_,N){if(A==null)return new ve.OptionalValue(_);let I=o(A,_.getFirstTypeParameter(),N);return new ve.OptionalValue(_,I)}function c(A,_,N){if(_.isCounted)throw new TE.ErrInvalidArgument('Counted variadic arguments must be explicitly typed. E.g. use "VariadicValue.fromItemsCounted()" or "new VariadicValue()"');A==null&&(A=[]),A.map===void 0&&N.convertError(A,"Variadic");let I=A.map(function(S){return o(S,_.getFirstTypeParameter(),N)});return new ve.VariadicValue(_,I)}function f(A,_,N){A.map===void 0&&N.convertError(A,"List");let I=A.map(function(S){return o(S,_.getFirstTypeParameter(),N)});return new ve.List(_,I)}function h(A,_,N){let I=[],S=_.getTypeParameters();N.guardSameLength(A,S);for(let R=0;R{"use strict";l();Object.defineProperty(Yr,"__esModule",{value:!0});Yr.ContractCallPayloadBuilder=Yr.ContractUpgradePayloadBuilder=Yr.ContractDeployPayloadBuilder=Yr.ArwenVirtualMachine=void 0;var DE=zn(),PE=vr(),sk=Yo();Yr.ArwenVirtualMachine="0500";var xE=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){PE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`${e}@${Yr.ArwenVirtualMachine}@${r}`;return n=RE(n,this.arguments),new DE.TransactionPayload(n)}};Yr.ContractDeployPayloadBuilder=xE;var NE=class{constructor(){this.code=null,this.codeMetadata="",this.arguments=[]}setCode(e){return this.code=e,this}setCodeMetadata(e){return this.codeMetadata=e,this}addInitArg(e){return this.arguments.push(e),this}setInitArgs(e){return this.arguments=e,this}build(){PE.guardValueIsSet("code",this.code);let e=this.code.toString(),r=this.codeMetadata.toString(),n=`upgradeContract@${e}@${r}`;return n=RE(n,this.arguments),new DE.TransactionPayload(n)}};Yr.ContractUpgradePayloadBuilder=NE;var OE=class{constructor(){this.contractFunction=null,this.arguments=[]}setFunction(e){return this.contractFunction=e,this}addArg(e){return this.arguments.push(e),this}setArgs(e){return this.arguments=e,this}build(){PE.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.toString();return e=RE(e,this.arguments),new DE.TransactionPayload(e)}};Yr.ContractCallPayloadBuilder=OE;function RE(t,e){let{argumentsString:r,count:n}=new sk.ArgSerializer().valuesToString(e);return n==0?t:`${t}@${r}`}});var Xn=E((yce,LE)=>{"use strict";l();var fa=typeof Reflect=="object"?Reflect:null,bN=fa&&typeof fa.apply=="function"?fa.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},gd;fa&&typeof fa.ownKeys=="function"?gd=fa.ownKeys:Object.getOwnPropertySymbols?gd=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:gd=function(e){return Object.getOwnPropertyNames(e)};function ok(t){console&&console.warn&&console.warn(t)}var _N=Number.isNaN||function(e){return e!==e};function ke(){ke.init.call(this)}LE.exports=ke;LE.exports.once=lk;ke.EventEmitter=ke;ke.prototype._events=void 0;ke.prototype._eventsCount=0;ke.prototype._maxListeners=void 0;var IN=10;function yd(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ke,"defaultMaxListeners",{enumerable:!0,get:function(){return IN},set:function(t){if(typeof t!="number"||t<0||_N(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");IN=t}});ke.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ke.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||_N(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};function SN(t){return t._maxListeners===void 0?ke.defaultMaxListeners:t._maxListeners}ke.prototype.getMaxListeners=function(){return SN(this)};ke.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")bN(u,this,r);else for(var c=u.length,f=ON(u,c),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,ok(a)}return t}ke.prototype.addListener=function(e,r){return TN(this,e,r,!1)};ke.prototype.on=ke.prototype.addListener;ke.prototype.prependListener=function(e,r){return TN(this,e,r,!0)};function ak(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function CN(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ak.bind(n);return i.listener=r,n.wrapFn=i,i}ke.prototype.once=function(e,r){return yd(r),this.on(e,CN(this,e,r)),this};ke.prototype.prependOnceListener=function(e,r){return yd(r),this.prependListener(e,CN(this,e,r)),this};ke.prototype.removeListener=function(e,r){var n,i,s,o,a;if(yd(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():uk(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};ke.prototype.off=ke.prototype.removeListener;ke.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function xN(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?ck(i):ON(i,i.length)}ke.prototype.listeners=function(e){return xN(this,e,!0)};ke.prototype.rawListeners=function(e){return xN(this,e,!1)};ke.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):NN.call(t,e)};ke.prototype.listenerCount=NN;function NN(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ke.prototype.eventNames=function(){return this._eventsCount>0?gd(this._events):[]};function ON(t,e){for(var r=new Array(e),n=0;n{l();PN.exports=Xn().EventEmitter});var ME=E(()=>{l()});var UN=E((Ice,MN)=>{"use strict";l();function RN(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function BN(t){for(var e=1;e0?this.tail.next=n:this.head=n,this.tail=n,++this.length}},{key:"unshift",value:function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i}},{key:"concat",value:function(r){if(this.length===0)return md.alloc(0);for(var n=md.allocUnsafe(r>>>0),i=this.head,s=0;i;)Ek(i.data,n,s),s+=i.data.length,i=i.next;return n}},{key:"consume",value:function(r,n){var i;return ro.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++i}return this.length-=i,s}},{key:"_getBuffer",value:function(r){var n=md.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,a),r-=a,r===0){a===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++s}return this.length-=s,n}},{key:wk,value:function(r,n){return UE(this,BN(BN({},n),{},{depth:0,customInspect:!1}))}}]),t}()});var VE=E((Sce,VN)=>{"use strict";l();function vk(t,e){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,p.default.nextTick(qE,this,t)):p.default.nextTick(qE,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?p.default.nextTick(wd,r):(r._writableState.errorEmitted=!0,p.default.nextTick(qN,r,s)):p.default.nextTick(qN,r,s):e?(p.default.nextTick(wd,r),e(s)):p.default.nextTick(wd,r)}),this)}function qN(t,e){qE(t,e),wd(t)}function wd(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function Ak(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function qE(t,e){t.emit("error",e)}function bk(t,e){var r=t._readableState,n=t._writableState;r&&r.autoDestroy||n&&n.autoDestroy?t.destroy(e):t.emit("error",e)}VN.exports={destroy:vk,undestroy:Ak,errorOrDestroy:bk}});var Vs=E((Cce,kN)=>{"use strict";l();function Ik(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var GN={};function qr(t,e,r){r||(r=Error);function n(s,o,a){return typeof e=="string"?e:e(s,o,a)}var i=function(s){Ik(o,s);function o(a,u,c){return s.call(this,n(a,u,c))||this}return o}(r);i.prototype.name=r.name,i.prototype.code=t,GN[t]=i}function HN(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map(function(n){return String(n)}),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:r===2?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}else return"of ".concat(e," ").concat(String(t))}function _k(t,e,r){return t.substr(!r||r<0?0:+r,e.length)===e}function Sk(t,e,r){return(r===void 0||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}function Tk(t,e,r){return typeof r!="number"&&(r=0),r+e.length>t.length?!1:t.indexOf(e,r)!==-1}qr("ERR_INVALID_OPT_VALUE",function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'},TypeError);qr("ERR_INVALID_ARG_TYPE",function(t,e,r){var n;typeof e=="string"&&_k(e,"not ")?(n="must not be",e=e.replace(/^not /,"")):n="must be";var i;if(Sk(t," argument"))i="The ".concat(t," ").concat(n," ").concat(HN(e,"type"));else{var s=Tk(t,".")?"property":"argument";i='The "'.concat(t,'" ').concat(s," ").concat(n," ").concat(HN(e,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);qr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");qr("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"});qr("ERR_STREAM_PREMATURE_CLOSE","Premature close");qr("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"});qr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");qr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");qr("ERR_STREAM_WRITE_AFTER_END","write after end");qr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);qr("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError);qr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");kN.exports.codes=GN});var HE=E((Nce,jN)=>{"use strict";l();var Ck=Vs().codes.ERR_INVALID_OPT_VALUE;function xk(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Nk(t,e,r,n){var i=xk(e,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new Ck(s,i)}return Math.floor(i)}return t.objectMode?16:16*1024}jN.exports={getHighWaterMark:Nk}});var ha=E((Dce,GE)=>{l();typeof Object.create=="function"?GE.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:GE.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}});var WN=E((Rce,QN)=>{l();QN.exports=Ok;function Ok(t,e){if(kE("noDeprecation"))return t;var r=!1;function n(){if(!r){if(kE("throwDeprecation"))throw new Error(e);kE("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}return n}function kE(t){try{if(!global.localStorage)return!1}catch{return!1}var e=global.localStorage[t];return e==null?!1:String(e).toLowerCase()==="true"}});var WE=E((Lce,XN)=>{"use strict";l();XN.exports=dt;function $N(t){var e=this;this.next=null,this.entry=null,this.finish=function(){nj(e,t)}}var da;dt.WritableState=xc;var Dk={deprecate:WN()},KN=FE(),vd=Ls().Buffer,Pk=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Rk(t){return vd.from(t)}function Bk(t){return vd.isBuffer(t)||t instanceof Pk}var QE=VE(),Lk=HE(),Fk=Lk.getHighWaterMark,Ri=Vs().codes,Mk=Ri.ERR_INVALID_ARG_TYPE,Uk=Ri.ERR_METHOD_NOT_IMPLEMENTED,qk=Ri.ERR_MULTIPLE_CALLBACK,Vk=Ri.ERR_STREAM_CANNOT_PIPE,Hk=Ri.ERR_STREAM_DESTROYED,Gk=Ri.ERR_STREAM_NULL_VALUES,kk=Ri.ERR_STREAM_WRITE_AFTER_END,jk=Ri.ERR_UNKNOWN_ENCODING,pa=QE.errorOrDestroy;ha()(dt,KN);function Qk(){}function xc(t,e,r){da=da||Hs(),t=t||{},typeof r!="boolean"&&(r=e instanceof da),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=Fk(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=t.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){Xk(e,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new $N(this)}xc.prototype.getBuffer=function(){for(var e=this.bufferedRequest,r=[];e;)r.push(e),e=e.next;return r};(function(){try{Object.defineProperty(xc.prototype,"buffer",{get:Dk.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ed;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ed=Function.prototype[Symbol.hasInstance],Object.defineProperty(dt,Symbol.hasInstance,{value:function(e){return Ed.call(this,e)?!0:this!==dt?!1:e&&e._writableState instanceof xc}})):Ed=function(e){return e instanceof this};function dt(t){da=da||Hs();var e=this instanceof da;if(!e&&!Ed.call(dt,this))return new dt(t);this._writableState=new xc(t,this,e),this.writable=!0,t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final)),KN.call(this)}dt.prototype.pipe=function(){pa(this,new Vk)};function Wk(t,e){var r=new kk;pa(t,r),p.default.nextTick(e,r)}function zk(t,e,r,n){var i;return r===null?i=new Gk:typeof r!="string"&&!e.objectMode&&(i=new Mk("chunk",["string","Buffer"],r)),i?(pa(t,i),p.default.nextTick(n,i),!1):!0}dt.prototype.write=function(t,e,r){var n=this._writableState,i=!1,s=!n.objectMode&&Bk(t);return s&&!vd.isBuffer(t)&&(t=Rk(t)),typeof e=="function"&&(r=e,e=null),s?e="buffer":e||(e=n.defaultEncoding),typeof r!="function"&&(r=Qk),n.ending?Wk(this,r):(s||zk(this,n,t,r))&&(n.pendingcb++,i=Kk(this,n,s,t,e,r)),i};dt.prototype.cork=function(){this._writableState.corked++};dt.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,!t.writing&&!t.corked&&!t.bufferProcessing&&t.bufferedRequest&&YN(this,t))};dt.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new jk(e);return this._writableState.defaultEncoding=e,this};Object.defineProperty(dt.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function $k(t,e,r){return!t.objectMode&&t.decodeStrings!==!1&&typeof e=="string"&&(e=vd.from(e,r)),e}Object.defineProperty(dt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Kk(t,e,r,n,i,s){if(!r){var o=$k(e,n,i);n!==o&&(r=!0,i="buffer",n=o)}var a=e.objectMode?1:n.length;e.length+=a;var u=e.length{"use strict";l();var ij=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};eO.exports=Sn;var ZN=KE(),$E=WE();ha()(Sn,ZN);for(zE=ij($E.prototype),Ad=0;Ad{l();var Id=Ls(),Tn=Id.Buffer;function tO(t,e){for(var r in t)e[r]=t[r]}Tn.from&&Tn.alloc&&Tn.allocUnsafe&&Tn.allocUnsafeSlow?rO.exports=Id:(tO(Id,YE),YE.Buffer=Gs);function Gs(t,e,r){return Tn(t,e,r)}Gs.prototype=Object.create(Tn.prototype);tO(Tn,Gs);Gs.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Tn(t,e,r)};Gs.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Tn(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Gs.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Tn(t)};Gs.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Id.SlowBuffer(t)}});var ZE=E(sO=>{"use strict";l();var XE=nO().Buffer,iO=XE.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function aj(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function uj(t){var e=aj(t);if(typeof e!="string"&&(XE.isEncoding===iO||!iO(t)))throw new Error("Unknown encoding: "+t);return e||t}sO.StringDecoder=Nc;function Nc(t){this.encoding=uj(t);var e;switch(this.encoding){case"utf16le":this.text=pj,this.end=gj,e=4;break;case"utf8":this.fillLast=fj,e=4;break;case"base64":this.text=yj,this.end=mj,e=3;break;default:this.write=wj,this.end=Ej;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=XE.allocUnsafe(e)}Nc.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function cj(t,e,r){var n=e.length-1;if(n=0?(i>0&&(t.lastNeed=i-1),i):--n=0?(i>0&&(t.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function lj(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function fj(t){var e=this.lastTotal-this.lastNeed,r=lj(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function hj(t,e){var r=cj(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function dj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function pj(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function gj(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function yj(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function mj(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function wj(t){return t.toString(this.encoding)}function Ej(t){return t&&t.length?this.write(t):""}});var _d=E((Gce,uO)=>{"use strict";l();var oO=Vs().codes.ERR_STREAM_PREMATURE_CLOSE;function vj(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,n=new Array(r),i=0;i{"use strict";l();var Sd;function Bi(t,e,r){return e=Ij(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ij(t){var e=_j(t,"string");return typeof e=="symbol"?e:String(e)}function _j(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Sj=_d(),Li=Symbol("lastResolve"),ks=Symbol("lastReject"),Oc=Symbol("error"),Td=Symbol("ended"),js=Symbol("lastPromise"),ev=Symbol("handlePromise"),Qs=Symbol("stream");function Fi(t,e){return{value:t,done:e}}function Tj(t){var e=t[Li];if(e!==null){var r=t[Qs].read();r!==null&&(t[js]=null,t[Li]=null,t[ks]=null,e(Fi(r,!1)))}}function Cj(t){p.default.nextTick(Tj,t)}function xj(t,e){return function(r,n){t.then(function(){if(e[Td]){r(Fi(void 0,!0));return}e[ev](r,n)},n)}}var Nj=Object.getPrototypeOf(function(){}),Oj=Object.setPrototypeOf((Sd={get stream(){return this[Qs]},next:function(){var e=this,r=this[Oc];if(r!==null)return Promise.reject(r);if(this[Td])return Promise.resolve(Fi(void 0,!0));if(this[Qs].destroyed)return new Promise(function(o,a){p.default.nextTick(function(){e[Oc]?a(e[Oc]):o(Fi(void 0,!0))})});var n=this[js],i;if(n)i=new Promise(xj(n,this));else{var s=this[Qs].read();if(s!==null)return Promise.resolve(Fi(s,!1));i=new Promise(this[ev])}return this[js]=i,i}},Bi(Sd,Symbol.asyncIterator,function(){return this}),Bi(Sd,"return",function(){var e=this;return new Promise(function(r,n){e[Qs].destroy(null,function(i){if(i){n(i);return}r(Fi(void 0,!0))})})}),Sd),Nj),Dj=function(e){var r,n=Object.create(Oj,(r={},Bi(r,Qs,{value:e,writable:!0}),Bi(r,Li,{value:null,writable:!0}),Bi(r,ks,{value:null,writable:!0}),Bi(r,Oc,{value:null,writable:!0}),Bi(r,Td,{value:e._readableState.endEmitted,writable:!0}),Bi(r,ev,{value:function(s,o){var a=n[Qs].read();a?(n[js]=null,n[Li]=null,n[ks]=null,s(Fi(a,!1))):(n[Li]=s,n[ks]=o)},writable:!0}),r));return n[js]=null,Sj(e,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[ks];s!==null&&(n[js]=null,n[Li]=null,n[ks]=null,s(i)),n[Oc]=i;return}var o=n[Li];o!==null&&(n[js]=null,n[Li]=null,n[ks]=null,o(Fi(void 0,!0))),n[Td]=!0}),e.on("readable",Cj.bind(null,n)),n};cO.exports=Dj});var hO=E((Wce,fO)=>{l();fO.exports=function(){throw new Error("Readable.from is not available in the browser")}});var KE=E((Kce,bO)=>{"use strict";l();bO.exports=Me;var ga;Me.ReadableState=yO;var $ce=Xn().EventEmitter,gO=function(e,r){return e.listeners(r).length},Pc=FE(),Cd=Ls().Buffer,Pj=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Rj(t){return Cd.from(t)}function Bj(t){return Cd.isBuffer(t)||t instanceof Pj}var tv=ME(),xe;tv&&tv.debuglog?xe=tv.debuglog("stream"):xe=function(){};var Lj=UN(),uv=VE(),Fj=HE(),Mj=Fj.getHighWaterMark,xd=Vs().codes,Uj=xd.ERR_INVALID_ARG_TYPE,qj=xd.ERR_STREAM_PUSH_AFTER_EOF,Vj=xd.ERR_METHOD_NOT_IMPLEMENTED,Hj=xd.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,ya,rv,nv;ha()(Me,Pc);var Dc=uv.errorOrDestroy,iv=["error","close","destroy","pause","resume"];function Gj(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}function yO(t,e,r){ga=ga||Hs(),t=t||{},typeof r!="boolean"&&(r=e instanceof ga),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=Mj(this,t,"readableHighWaterMark",r),this.buffer=new Lj,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=t.emitClose!==!1,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(ya||(ya=ZE().StringDecoder),this.decoder=new ya(t.encoding),this.encoding=t.encoding)}function Me(t){if(ga=ga||Hs(),!(this instanceof Me))return new Me(t);var e=this instanceof ga;this._readableState=new yO(t,this,e),this.readable=!0,t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy)),Pc.call(this)}Object.defineProperty(Me.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});Me.prototype.destroy=uv.destroy;Me.prototype._undestroy=uv.undestroy;Me.prototype._destroy=function(t,e){e(t)};Me.prototype.push=function(t,e){var r=this._readableState,n;return r.objectMode?n=!0:typeof t=="string"&&(e=e||r.defaultEncoding,e!==r.encoding&&(t=Cd.from(t,e),e=""),n=!0),mO(this,t,e,!1,n)};Me.prototype.unshift=function(t){return mO(this,t,null,!0,!1)};function mO(t,e,r,n,i){xe("readableAddChunk",e);var s=t._readableState;if(e===null)s.reading=!1,Qj(t,s);else{var o;if(i||(o=kj(s,e)),o)Dc(t,o);else if(s.objectMode||e&&e.length>0)if(typeof e!="string"&&!s.objectMode&&Object.getPrototypeOf(e)!==Cd.prototype&&(e=Rj(e)),n)s.endEmitted?Dc(t,new Hj):sv(t,s,e,!0);else if(s.ended)Dc(t,new qj);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||e.length!==0?sv(t,s,e,!1):av(t,s)):sv(t,s,e,!1)}else n||(s.reading=!1,av(t,s))}return!s.ended&&(s.length=dO?t=dO:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function pO(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:t!==t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=jj(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}Me.prototype.read=function(t){xe("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return xe("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ov(this):Nd(this),null;if(t=pO(t,e),t===0&&e.ended)return e.length===0&&ov(this),null;var n=e.needReadable;xe("need readable",n),(e.length===0||e.length-t0?i=vO(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&ov(this)),i!==null&&this.emit("data",i),i};function Qj(t,e){if(xe("onEofChunk"),!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Nd(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,wO(t)))}}function Nd(t){var e=t._readableState;xe("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(xe("emitReadable",e.flowing),e.emittedReadable=!0,p.default.nextTick(wO,t))}function wO(t){var e=t._readableState;xe("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,cv(t)}function av(t,e){e.readingMore||(e.readingMore=!0,p.default.nextTick(Wj,t,e))}function Wj(t,e){for(;!e.reading&&!e.ended&&(e.length1&&AO(n.pipes,t)!==-1)&&!c&&(xe("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function g(O){xe("onerror",O),T(),t.removeListener("error",g),gO(t,"error")===0&&Dc(t,O)}Gj(t,"error",g);function y(){t.removeListener("finish",m),T()}t.once("close",y);function m(){xe("onfinish"),t.removeListener("close",y),T()}t.once("finish",m);function T(){xe("unpipe"),r.unpipe(t)}return t.emit("pipe",r),n.flowing||(xe("pipe resume"),r.resume()),t};function zj(t){return function(){var r=t._readableState;xe("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&gO(t,"data")&&(r.flowing=!0,cv(t))}}Me.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(e.pipesCount===0)return this;if(e.pipesCount===1)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,xe("on readable",n.length,n.reading),n.length?Nd(this):n.reading||p.default.nextTick($j,this)),r};Me.prototype.addListener=Me.prototype.on;Me.prototype.removeListener=function(t,e){var r=Pc.prototype.removeListener.call(this,t,e);return t==="readable"&&p.default.nextTick(EO,this),r};Me.prototype.removeAllListeners=function(t){var e=Pc.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&p.default.nextTick(EO,this),e};function EO(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function $j(t){xe("readable nexttick read 0"),t.read(0)}Me.prototype.resume=function(){var t=this._readableState;return t.flowing||(xe("resume"),t.flowing=!t.readableListening,Kj(this,t)),t.paused=!1,this};function Kj(t,e){e.resumeScheduled||(e.resumeScheduled=!0,p.default.nextTick(Yj,t,e))}function Yj(t,e){xe("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),cv(t),e.flowing&&!e.reading&&t.read(0)}Me.prototype.pause=function(){return xe("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(xe("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function cv(t){var e=t._readableState;for(xe("flow",e.flowing);e.flowing&&t.read()!==null;);}Me.prototype.wrap=function(t){var e=this,r=this._readableState,n=!1;t.on("end",function(){if(xe("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&e.push(o)}e.push(null)}),t.on("data",function(o){if(xe("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var a=e.push(o);a||(n=!0,t.pause())}});for(var i in t)this[i]===void 0&&typeof t[i]=="function"&&(this[i]=function(a){return function(){return t[a].apply(t,arguments)}}(i));for(var s=0;s=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function ov(t){var e=t._readableState;xe("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,p.default.nextTick(Jj,e,t))}function Jj(t,e){if(xe("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&t.length===0&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}typeof Symbol=="function"&&(Me.from=function(t,e){return nv===void 0&&(nv=hO()),nv(Me,t,e)});function AO(t,e){for(var r=0,n=t.length;r{"use strict";l();_O.exports=Zn;var Od=Vs().codes,Xj=Od.ERR_METHOD_NOT_IMPLEMENTED,Zj=Od.ERR_MULTIPLE_CALLBACK,e7=Od.ERR_TRANSFORM_ALREADY_TRANSFORMING,t7=Od.ERR_TRANSFORM_WITH_LENGTH_0,Dd=Hs();ha()(Zn,Dd);function r7(t,e){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Zj);r.writechunk=null,r.writecb=null,e!=null&&this.push(e),n(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";l();TO.exports=Rc;var SO=lv();ha()(Rc,SO);function Rc(t){if(!(this instanceof Rc))return new Rc(t);SO.call(this,t)}Rc.prototype._transform=function(t,e,r){r(null,t)}});var PO=E((tle,DO)=>{"use strict";l();var fv;function i7(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}var OO=Vs().codes,s7=OO.ERR_MISSING_ARGS,o7=OO.ERR_STREAM_DESTROYED;function xO(t){if(t)throw t}function a7(t){return t.setHeader&&typeof t.abort=="function"}function u7(t,e,r,n){n=i7(n);var i=!1;t.on("close",function(){i=!0}),fv===void 0&&(fv=_d()),fv(t,{readable:e,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,a7(t))return t.abort();if(typeof t.destroy=="function")return t.destroy();n(o||new o7("pipe"))}}}function NO(t){t()}function c7(t,e){return t.pipe(e)}function l7(t){return!t.length||typeof t[t.length-1]!="function"?xO:t.pop()}function f7(){for(var t=arguments.length,e=new Array(t),r=0;r0;return u7(o,u,c,function(f){i||(i=f),f&&s.forEach(NO),!u&&(s.forEach(NO),n(i))})});return e.reduce(c7)}DO.exports=f7});var hv=E((Vr,RO)=>{l();Vr=RO.exports=KE();Vr.Stream=Vr;Vr.Readable=Vr;Vr.Writable=WE();Vr.Duplex=Hs();Vr.Transform=lv();Vr.PassThrough=CO();Vr.finished=_d();Vr.pipeline=PO()});var FO=E((ile,LO)=>{l();var{Transform:h7}=hv();LO.exports=t=>class BO extends h7{constructor(r,n,i,s,o){super(o),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=o,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!d.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return d.Buffer.isBuffer(r)||(r=d.Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new BO(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var qO=E((ole,UO)=>{l();var{Transform:d7}=hv();UO.exports=t=>class MO extends d7{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new t,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(o){s=o}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!d.Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return d.Buffer.isBuffer(r)||(r=d.Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){let r=new MO(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}}});var HO=E((ule,VO)=>{l();var p7=FO(),g7=qO();VO.exports=function(t){let e=p7(t),r=g7(t);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}}});var jO=E(kO=>{l();var GO=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];kO.p1600=function(t){for(let e=0;e<24;++e){let r=t[0]^t[10]^t[20]^t[30]^t[40],n=t[1]^t[11]^t[21]^t[31]^t[41],i=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],o=t[4]^t[14]^t[24]^t[34]^t[44],a=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],f=t[8]^t[18]^t[28]^t[38]^t[48],h=t[9]^t[19]^t[29]^t[39]^t[49],g=f^(i<<1|s>>>31),y=h^(s<<1|i>>>31),m=t[0]^g,T=t[1]^y,O=t[10]^g,B=t[11]^y,W=t[20]^g,U=t[21]^y,A=t[30]^g,_=t[31]^y,N=t[40]^g,I=t[41]^y;g=r^(o<<1|a>>>31),y=n^(a<<1|o>>>31);let S=t[2]^g,R=t[3]^y,J=t[12]^g,Q=t[13]^y,V=t[22]^g,k=t[23]^y,K=t[32]^g,ge=t[33]^y,ue=t[42]^g,re=t[43]^y;g=i^(u<<1|c>>>31),y=s^(c<<1|u>>>31);let Y=t[4]^g,se=t[5]^y,te=t[14]^g,ie=t[15]^y,M=t[24]^g,le=t[25]^y,ae=t[34]^g,he=t[35]^y,oe=t[44]^g,ce=t[45]^y;g=o^(f<<1|h>>>31),y=a^(h<<1|f>>>31);let w=t[6]^g,v=t[7]^y,b=t[16]^g,P=t[17]^y,C=t[26]^g,D=t[27]^y,L=t[36]^g,x=t[37]^y,F=t[46]^g,H=t[47]^y;g=u^(r<<1|n>>>31),y=c^(n<<1|r>>>31);let q=t[8]^g,Z=t[9]^y,we=t[18]^g,Ae=t[19]^y,Re=t[28]^g,tt=t[29]^y,lt=t[38]^g,Oe=t[39]^y,Ue=t[48]^g,Ot=t[49]^y,gi=m,vs=T,As=B<<4|O>>>28,ar=O<<4|B>>>28,Gn=W<<3|U>>>29,$t=U<<3|W>>>29,Dt=_<<9|A>>>23,ze=A<<9|_>>>23,ky=N<<18|I>>>14,jy=I<<18|N>>>14,Qy=S<<1|R>>>31,Wy=R<<1|S>>>31,zy=Q<<12|J>>>20,$y=J<<12|Q>>>20,Ky=V<<10|k>>>22,Yy=k<<10|V>>>22,Jy=ge<<13|K>>>19,Xy=K<<13|ge>>>19,Zy=ue<<2|re>>>30,e0=re<<2|ue>>>30,t0=se<<30|Y>>>2,r0=Y<<30|se>>>2,n0=te<<6|ie>>>26,i0=ie<<6|te>>>26,s0=le<<11|M>>>21,o0=M<<11|le>>>21,a0=ae<<15|he>>>17,u0=he<<15|ae>>>17,c0=ce<<29|oe>>>3,l0=oe<<29|ce>>>3,f0=w<<28|v>>>4,h0=v<<28|w>>>4,d0=P<<23|b>>>9,p0=b<<23|P>>>9,g0=C<<25|D>>>7,y0=D<<25|C>>>7,m0=L<<21|x>>>11,w0=x<<21|L>>>11,E0=H<<24|F>>>8,v0=F<<24|H>>>8,A0=q<<27|Z>>>5,b0=Z<<27|q>>>5,I0=we<<20|Ae>>>12,_0=Ae<<20|we>>>12,S0=tt<<7|Re>>>25,T0=Re<<7|tt>>>25,C0=lt<<8|Oe>>>24,x0=Oe<<8|lt>>>24,N0=Ue<<14|Ot>>>18,O0=Ot<<14|Ue>>>18;t[0]=gi^~zy&s0,t[1]=vs^~$y&o0,t[10]=f0^~I0&Gn,t[11]=h0^~_0&$t,t[20]=Qy^~n0&g0,t[21]=Wy^~i0&y0,t[30]=A0^~As&Ky,t[31]=b0^~ar&Yy,t[40]=t0^~d0&S0,t[41]=r0^~p0&T0,t[2]=zy^~s0&m0,t[3]=$y^~o0&w0,t[12]=I0^~Gn&Jy,t[13]=_0^~$t&Xy,t[22]=n0^~g0&C0,t[23]=i0^~y0&x0,t[32]=As^~Ky&a0,t[33]=ar^~Yy&u0,t[42]=d0^~S0&Dt,t[43]=p0^~T0&ze,t[4]=s0^~m0&N0,t[5]=o0^~w0&O0,t[14]=Gn^~Jy&c0,t[15]=$t^~Xy&l0,t[24]=g0^~C0&ky,t[25]=y0^~x0&jy,t[34]=Ky^~a0&E0,t[35]=Yy^~u0&v0,t[44]=S0^~Dt&Zy,t[45]=T0^~ze&e0,t[6]=m0^~N0&gi,t[7]=w0^~O0&vs,t[16]=Jy^~c0&f0,t[17]=Xy^~l0&h0,t[26]=C0^~ky&Qy,t[27]=x0^~jy&Wy,t[36]=a0^~E0&A0,t[37]=u0^~v0&b0,t[46]=Dt^~Zy&t0,t[47]=ze^~e0&r0,t[8]=N0^~gi&zy,t[9]=O0^~vs&$y,t[18]=c0^~f0&I0,t[19]=l0^~h0&_0,t[28]=ky^~Qy&n0,t[29]=jy^~Wy&i0,t[38]=E0^~A0&As,t[39]=v0^~b0&ar,t[48]=Zy^~t0&d0,t[49]=e0^~r0&p0,t[0]^=GO[e*2],t[1]^=GO[e*2+1]}}});var WO=E((hle,QO)=>{l();var Pd=jO();function ma(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}ma.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1};ma.prototype.absorb=function(t){for(let e=0;e>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Pd.p1600(this.state),this.count=0);return e};ma.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};QO.exports=ma});var dv=E((ple,zO)=>{l();zO.exports=HO()(WO())});var mv=E(wa=>{"use strict";l();var y7=wa&&wa.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wa,"__esModule",{value:!0});wa.SmartContract=void 0;var m7=y7(kt()),Bc=ht(),pv=Wh(),w7=Be(),gv=bn(),E7=vr(),v7=dc(),$O=gE(),KO=Sc(),YO=_E(),A7=CE(),b7=Tc(),Rd=BE(),I7=dv(),yv=class{constructor(e={}){this.address=new Bc.Address,this.methodsExplicit={},this.methods={},this.address=e.address||new Bc.Address,this.abi=e.abi,this.abi&&this.setupMethods()}setupMethods(){let e=this,r=this.getAbi();for(let n of r.getEndpoints()){let i=n.name;this.methodsExplicit[i]=function(s){let o=new KO.ContractFunction(i);return new YO.Interaction(e,o,s||[])},this.methods[i]=function(s){let o=new KO.ContractFunction(i),a=A7.NativeSerializer.nativeToTypedValues(s||[],n);return new YO.Interaction(e,o,a||[])}}}setAddress(e){this.address=e}getAddress(){return this.address}getAbi(){return E7.guardValueIsSet("abi",this.abi),this.abi}getEndpoint(e){return this.getAbi().getEndpoint(e)}deploy({deployer:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){pv.Compatibility.guardAddressIsSetAndNonZero(e,"'deployer' of SmartContract.deploy()","pass the actual address to deploy()"),n=n||new $O.CodeMetadata,i=i||[],s=s||0;let c=new Rd.ContractDeployPayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new gv.Transaction({receiver:Bc.Address.Zero(),sender:e,value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}upgrade({caller:e,code:r,codeMetadata:n,initArguments:i,value:s,gasLimit:o,gasPrice:a,chainID:u}){pv.Compatibility.guardAddressIsSetAndNonZero(e,"'caller' of SmartContract.upgrade()","pass the actual address to upgrade()"),this.ensureHasAddress(),n=n||new $O.CodeMetadata,i=i||[],s=s||0;let c=new Rd.ContractUpgradePayloadBuilder().setCode(r).setCodeMetadata(n).setInitArgs(i).build();return new gv.Transaction({sender:e,receiver:this.getAddress(),value:s,gasLimit:o,gasPrice:a,data:c,chainID:u})}call({func:e,args:r,value:n,gasLimit:i,receiver:s,gasPrice:o,chainID:a,caller:u}){pv.Compatibility.guardAddressIsSetAndNonZero(u,"'caller' of SmartContract.call()","pass the actual address to call()"),this.ensureHasAddress(),r=r||[],n=n||0;let c=new Rd.ContractCallPayloadBuilder().setFunction(e).setArgs(r).build();return new gv.Transaction({sender:u,receiver:s||this.getAddress(),value:n,gasLimit:i,gasPrice:o,data:c,chainID:a})}createQuery({func:e,args:r,value:n,caller:i}){return this.ensureHasAddress(),new b7.Query({address:this.getAddress(),func:e,args:r,value:n,caller:i})}ensureHasAddress(){if(!this.getAddress().bech32())throw new w7.ErrContractHasNoAddress}static computeAddress(e,r){let n=d.Buffer.alloc(8,0),i=new Bc.Address(e.bech32()).pubkey(),s=i.slice(30),o=d.Buffer.alloc(8),a=new m7.default(r.valueOf().toString(10)),u=v7.bigIntToBuffer(a);o.write(u.reverse().toString("hex"),"hex");let c=d.Buffer.concat([i,o]),f=I7("keccak256").update(c).digest(),h=d.Buffer.from(Rd.ArwenVirtualMachine,"hex"),g=d.Buffer.concat([n,h,f.slice(10,30),s]);return new Bc.Address(g)}};wa.SmartContract=yv});var Bd=E(Ws=>{"use strict";l();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.SignableMessage=Ws.MESSAGE_PREFIX=void 0;var _7=ht(),S7=vc(),T7=dv();Ws.MESSAGE_PREFIX=`Elrond Signed Message: +`;var wv=class{constructor(e){this.message=d.Buffer.from([]),this.signature=d.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new _7.Address,Object.assign(this,e)}serializeForSigning(){let e=d.Buffer.from(this.message.length.toString()),r=d.Buffer.concat([e,this.message]),n=d.Buffer.concat([d.Buffer.from(Ws.MESSAGE_PREFIX),r]);return T7("keccak256").update(n).digest()}serializeForSigningRaw(){return d.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){this.signature=S7.interpretSignatureAsBuffer(e)}getMessageSize(){let e=d.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};Ws.SignableMessage=wv});var JO=E(Mi=>{"use strict";l();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.ErrAccountNotConnected=Mi.ErrCannotSignSingleTransaction=Mi.Err=void 0;var Lc=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Mi.Err=Lc;var Ev=class extends Lc{constructor(){super("Cannot sign single transaction.")}};Mi.ErrCannotSignSingleTransaction=Ev;var vv=class extends Lc{constructor(){super("Account is not connected.")}};Mi.ErrAccountNotConnected=vv});var XO=E(Fc=>{"use strict";l();Object.defineProperty(Fc,"__esModule",{value:!0});Fc.Operation=void 0;var C7;(function(t){t.Connect="connect",t.Logout="logout",t.SignTransactions="signTransactions",t.SignMessage="signMessage",t.CancelAction="cancelAction"})(C7=Fc.Operation||(Fc.Operation={}))});var Av=E(Ea=>{"use strict";l();var Ui=Ea&&Ea.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.ExtensionProvider=void 0;var x7=bn(),ZO=JO(),Mc=XO(),Uc=class t{constructor(){if(this.account={address:""},this.initialized=!1,t._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");t._instance=this}static getInstance(){return t._instance}setAddress(e){return this.account.address=e,t._instance}init(){return Ui(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Ui(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:r}=e,n=r||"";return yield this.startBgrMsgChannel(Mc.Operation.Connect,n),this.account.address})}logout(){return Ui(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(Mc.Operation.Logout,this.account.address),this.disconnect()}catch(e){console.warn("Extension origin url is already cleared!",e)}return!0})}disconnect(){this.account={address:""}}getAddress(){return Ui(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");return this.account?this.account.address:""})}isInitialized(){return this.initialized}isConnected(){return Ui(this,void 0,void 0,function*(){return!!this.account.address})}signTransaction(e){return Ui(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.signTransactions([e]);if(r.length!=1)throw new ZO.ErrCannotSignSingleTransaction;return r[0]})}ensureConnected(){if(!this.account.address)throw new ZO.ErrAccountNotConnected}signTransactions(e){return Ui(this,void 0,void 0,function*(){this.ensureConnected();let r=yield this.startBgrMsgChannel(Mc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(n=>n.toPlainObject())});try{return r.map(i=>x7.Transaction.fromPlainObject(i))}catch(n){throw new Error(`Transaction canceled: ${n.message}.`)}})}signMessage(e){return Ui(this,void 0,void 0,function*(){this.ensureConnected();let r={account:this.account.address,message:e.message.toString()},i=(yield this.startBgrMsgChannel(Mc.Operation.SignMessage,r)).signature,s=d.Buffer.from(i,"hex");return e.applySignature(s),e})}cancelAction(){return this.startBgrMsgChannel(Mc.Operation.CancelAction,{})}startBgrMsgChannel(e,r){return new Promise(n=>{window.postMessage({target:"erdw-inpage",type:e,data:r},window.origin);let i=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&s.data.data.address&&(this.account=s.data.data),window.removeEventListener("message",i),n(s.data.data)):(window.removeEventListener("message",i),n(s.data.data)))};window.addEventListener("message",i,!1)})}};Ea.ExtensionProvider=Uc;Uc._instance=new Uc});function P7(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){R7(t);return}return e}function R7(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function qc(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let n=r.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!D7.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(N7.test(t)||O7.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,P7)}return JSON.parse(t)}catch(n){if(e.strict)throw n;return t}}var N7,O7,D7,i2=fe(()=>{l();N7=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,O7=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,D7=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/});function B7(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Pt(t,...e){try{return B7(t(...e))}catch(r){return Promise.reject(r)}}function L7(t){let e=typeof t;return t===null||e!=="object"&&e!=="function"}function F7(t){let e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Vc(t){if(L7(t))return String(t);if(F7(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Vc(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function s2(){if(typeof d.Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}function o2(t){if(typeof t=="string")return t;s2();let e=d.Buffer.from(t).toString("base64");return bv+e}function a2(t){return typeof t!="string"||!t.startsWith(bv)?t:(s2(),d.Buffer.from(t.slice(bv.length),"base64"))}function rr(t){return t?t.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function u2(...t){return rr(t.join(":"))}function Hc(t){return t=rr(t),t?t+":":""}var bv,c2=fe(()=>{l();bv="base64:"});function h2(t={}){let e={mounts:{"":t.driver||U7()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=c=>{for(let f of e.mountpoints)if(c.startsWith(f))return{base:f,relativeKey:c.slice(f.length),driver:e.mounts[f]};return{base:"",relativeKey:c,driver:e.mounts[""]}},n=(c,f)=>e.mountpoints.filter(h=>h.startsWith(c)||f&&c.startsWith(h)).map(h=>({relativeBase:c.length>h.length?c.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),i=(c,f)=>{if(e.watching){f=rr(f);for(let h of e.watchListeners)h(c,f)}},s=async()=>{if(!e.watching){e.watching=!0;for(let c in e.mounts)e.unwatch[c]=await l2(e.mounts[c],i,c)}},o=async()=>{if(e.watching){for(let c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,f,h)=>{let g=new Map,y=m=>{let T=g.get(m.base);return T||(T={driver:m.driver,base:m.base,items:[]},g.set(m.base,T)),T};for(let m of c){let T=typeof m=="string",O=rr(T?m:m.key),B=T?void 0:m.value,W=T||!m.options?f:{...f,...m.options},U=r(O);y(U).items.push({key:O,value:B,relativeKey:U.relativeKey,options:W})}return Promise.all([...g.values()].map(m=>h(m))).then(m=>m.flat())},u={hasItem(c,f={}){c=rr(c);let{relativeKey:h,driver:g}=r(c);return Pt(g.hasItem,h,f)},getItem(c,f={}){c=rr(c);let{relativeKey:h,driver:g}=r(c);return Pt(g.getItem,h,f).then(y=>qc(y))},getItems(c,f){return a(c,f,h=>h.driver.getItems?Pt(h.driver.getItems,h.items.map(g=>({key:g.relativeKey,options:g.options})),f).then(g=>g.map(y=>({key:u2(h.base,y.key),value:qc(y.value)}))):Promise.all(h.items.map(g=>Pt(h.driver.getItem,g.relativeKey,g.options).then(y=>({key:g.key,value:qc(y)})))))},getItemRaw(c,f={}){c=rr(c);let{relativeKey:h,driver:g}=r(c);return g.getItemRaw?Pt(g.getItemRaw,h,f):Pt(g.getItem,h,f).then(y=>a2(y))},async setItem(c,f,h={}){if(f===void 0)return u.removeItem(c);c=rr(c);let{relativeKey:g,driver:y}=r(c);y.setItem&&(await Pt(y.setItem,g,Vc(f),h),y.watch||i("update",c))},async setItems(c,f){await a(c,f,async h=>{h.driver.setItems&&await Pt(h.driver.setItems,h.items.map(g=>({key:g.relativeKey,value:Vc(g.value),options:g.options})),f),h.driver.setItem&&await Promise.all(h.items.map(g=>Pt(h.driver.setItem,g.relativeKey,Vc(g.value),g.options)))})},async setItemRaw(c,f,h={}){if(f===void 0)return u.removeItem(c,h);c=rr(c);let{relativeKey:g,driver:y}=r(c);if(y.setItemRaw)await Pt(y.setItemRaw,g,f,h);else if(y.setItem)await Pt(y.setItem,g,o2(f),h);else return;y.watch||i("update",c)},async removeItem(c,f={}){typeof f=="boolean"&&(f={removeMeta:f}),c=rr(c);let{relativeKey:h,driver:g}=r(c);g.removeItem&&(await Pt(g.removeItem,h,f),(f.removeMeta||f.removeMata)&&await Pt(g.removeItem,h+"$",f),g.watch||i("remove",c))},async getMeta(c,f={}){typeof f=="boolean"&&(f={nativeOnly:f}),c=rr(c);let{relativeKey:h,driver:g}=r(c),y=Object.create(null);if(g.getMeta&&Object.assign(y,await Pt(g.getMeta,h,f)),!f.nativeOnly){let m=await Pt(g.getItem,h+"$",f).then(T=>qc(T));m&&typeof m=="object"&&(typeof m.atime=="string"&&(m.atime=new Date(m.atime)),typeof m.mtime=="string"&&(m.mtime=new Date(m.mtime)),Object.assign(y,m))}return y},setMeta(c,f,h={}){return this.setItem(c+"$",f,h)},removeMeta(c,f={}){return this.removeItem(c+"$",f)},async getKeys(c,f={}){c=Hc(c);let h=n(c,!0),g=[],y=[];for(let m of h){let O=(await Pt(m.driver.getKeys,m.relativeBase,f)).map(B=>m.mountpoint+rr(B)).filter(B=>!g.some(W=>B.startsWith(W)));y.push(...O),g=[m.mountpoint,...g.filter(B=>!B.startsWith(m.mountpoint))]}return c?y.filter(m=>m.startsWith(c)&&!m.endsWith("$")):y.filter(m=>!m.endsWith("$"))},async clear(c,f={}){c=Hc(c),await Promise.all(n(c,!1).map(async h=>{if(h.driver.clear)return Pt(h.driver.clear,h.relativeBase,f);if(h.driver.removeItem){let g=await h.driver.getKeys(h.relativeBase||"",f);return Promise.all(g.map(y=>h.driver.removeItem(y,f)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>f2(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(f=>f!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,f){if(c=Hc(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((h,g)=>g.length-h.length)),e.mounts[c]=f,e.watching&&Promise.resolve(l2(f,i,c)).then(h=>{e.unwatch[c]=h}).catch(console.error),u},async unmount(c,f=!0){c=Hc(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&(e.unwatch[c](),delete e.unwatch[c]),f&&await f2(e.mounts[c]),e.mountpoints=e.mountpoints.filter(h=>h!==c),delete e.mounts[c])},getMount(c=""){c=rr(c)+":";let f=r(c);return{driver:f.driver,base:f.base}},getMounts(c="",f={}){return c=rr(c),n(c,f.parents).map(g=>({driver:g.driver,base:g.mountpoint}))}};return u}function l2(t,e,r){return t.watch?t.watch((n,i)=>e(n,r+i)):()=>{}}async function f2(t){typeof t.dispose=="function"&&await Pt(t.dispose)}var M7,U7,d2=fe(()=>{l();i2();c2();M7="memory",U7=()=>{let t=new Map;return{name:M7,options:{},hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return Array.from(t.keys())},clear(){t.clear()},dispose(){t.clear()}}}});function zs(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function _v(t,e){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);let n=zs(r);return(i,s)=>n.then(o=>s(o.transaction(e,i).objectStore(e)))}function Gc(){return Iv||(Iv=_v("keyval-store","keyval")),Iv}function Sv(t,e=Gc()){return e("readonly",r=>zs(r.get(t)))}function p2(t,e,r=Gc()){return r("readwrite",n=>(n.put(e,t),zs(n.transaction)))}function g2(t,e=Gc()){return e("readwrite",r=>(r.delete(t),zs(r.transaction)))}function y2(t=Gc()){return t("readwrite",e=>(e.clear(),zs(e.transaction)))}function q7(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},zs(t.transaction)}function m2(t=Gc()){return t("readonly",e=>{if(e.getAllKeys)return zs(e.getAllKeys());let r=[];return q7(e,n=>r.push(n.key)).then(()=>r)})}var Iv,w2=fe(()=>{l()});var E2={};ct(E2,{safeJsonParse:()=>Vi,safeJsonStringify:()=>Hi});function Vi(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return H7(t)}catch{return t}}function Hi(t){return typeof t=="string"?t:V7(t)||""}var V7,H7,kc=fe(()=>{l();V7=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),H7=t=>{let e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(n,i)=>typeof i=="string"&&i.match(/^\d+n$/)?BigInt(i.substring(0,i.length-1)):i)}});var A2={};ct(A2,{KeyValueStorage:()=>Nv,default:()=>Nv});function W7(t){var e;return[t[0],Vi((e=t[1])!=null?e:"")]}var G7,k7,j7,Q7,Cv,Tv,Ud,xv,z7,v2,$7,K7,Nv,b2=fe(()=>{l();d2();w2();kc();G7="idb-keyval",k7=(t={})=>{let e=t.base&&t.base.length>0?`${t.base}:`:"",r=i=>e+i,n;return t.dbName&&t.storeName&&(n=_v(t.dbName,t.storeName)),{name:G7,options:t,async hasItem(i){return!(typeof await Sv(r(i),n)>"u")},async getItem(i){return await Sv(r(i),n)??null},setItem(i,s){return p2(r(i),s,n)},removeItem(i){return g2(r(i),n)},getKeys(){return m2(n)},clear(){return y2(n)}}},j7="WALLET_CONNECT_V2_INDEXED_DB",Q7="keyvaluestorage",Cv=class{constructor(){this.indexedDb=h2({driver:k7({dbName:j7,storeName:Q7})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,Hi(r))}async removeItem(e){await this.indexedDb.removeItem(e)}},Tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ud={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,n){this[r]=String(n)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){let r=this;Object.keys(r).forEach(function(n){r[n]=void 0,delete r[n]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Tv<"u"&&Tv.localStorage?Ud.exports=Tv.localStorage:typeof window<"u"&&window.localStorage?Ud.exports=window.localStorage:Ud.exports=new e})();xv=class{constructor(){this.localStorage=Ud.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(W7)}async getItem(e){let r=this.localStorage.getItem(e);if(r!==null)return Vi(r)}async setItem(e,r){this.localStorage.setItem(e,Hi(r))}async removeItem(e){this.localStorage.removeItem(e)}},z7="wc_storage_version",v2=1,$7=async(t,e,r)=>{let n=z7,i=await e.getItem(n);if(i&&i>=v2){r(e);return}let s=await t.getKeys();if(!s.length){r(e);return}let o=[];for(;s.length;){let a=s.shift();if(!a)continue;let u=a.toLowerCase();if(u.includes("wc@")||u.includes("walletconnect")||u.includes("wc_")||u.includes("wallet_connect")){let c=await t.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(n,v2),r(e),K7(t,o)},K7=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})},Nv=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};let e=new xv;this.storage=e;try{let r=new Cv;$7(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}}});var Jr={};ct(Jr,{__assign:()=>Dv,__asyncDelegator:()=>uQ,__asyncGenerator:()=>aQ,__asyncValues:()=>cQ,__await:()=>jc,__awaiter:()=>tQ,__classPrivateFieldGet:()=>dQ,__classPrivateFieldSet:()=>pQ,__createBinding:()=>nQ,__decorate:()=>X7,__exportStar:()=>iQ,__extends:()=>Y7,__generator:()=>rQ,__importDefault:()=>hQ,__importStar:()=>fQ,__makeTemplateObject:()=>lQ,__metadata:()=>eQ,__param:()=>Z7,__read:()=>I2,__rest:()=>J7,__spread:()=>sQ,__spreadArrays:()=>oQ,__values:()=>Pv});function Y7(t,e){Ov(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function J7(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function Z7(t,e){return function(r,n){e(r,n,t)}}function eQ(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function tQ(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function rQ(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(f){return u([c,f])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I2(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function sQ(){for(var t=[],e=0;e1||a(g,y)})})}function a(g,y){try{u(n[g](y))}catch(m){h(s[0][3],m)}}function u(g){g.value instanceof jc?Promise.resolve(g.value.v).then(c,f):h(s[0][2],g)}function c(g){a("next",g)}function f(g){a("throw",g)}function h(g,y){g(y),s.shift(),s.length&&a(s[0][0],s[0][1])}}function uQ(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:jc(t[i](o)),done:i==="return"}:s?s(o):o}:s}}function cQ(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Pv=="function"?Pv(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}}function lQ(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function fQ(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function hQ(t){return t&&t.__esModule?t:{default:t}}function dQ(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function pQ(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}var Ov,Dv,Xr=fe(()=>{l();Ov=function(t,e){return Ov=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},Ov(t,e)};Dv=function(){return Dv=Object.assign||function(e){for(var r,n=1,i=arguments.length;n{"use strict";l();Object.defineProperty(qd,"__esModule",{value:!0});qd.delay=void 0;function gQ(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}qd.delay=gQ});var S2=E(va=>{"use strict";l();Object.defineProperty(va,"__esModule",{value:!0});va.ONE_THOUSAND=va.ONE_HUNDRED=void 0;va.ONE_HUNDRED=100;va.ONE_THOUSAND=1e3});var T2=E(pe=>{"use strict";l();Object.defineProperty(pe,"__esModule",{value:!0});pe.ONE_YEAR=pe.FOUR_WEEKS=pe.THREE_WEEKS=pe.TWO_WEEKS=pe.ONE_WEEK=pe.THIRTY_DAYS=pe.SEVEN_DAYS=pe.FIVE_DAYS=pe.THREE_DAYS=pe.ONE_DAY=pe.TWENTY_FOUR_HOURS=pe.TWELVE_HOURS=pe.SIX_HOURS=pe.THREE_HOURS=pe.ONE_HOUR=pe.SIXTY_MINUTES=pe.THIRTY_MINUTES=pe.TEN_MINUTES=pe.FIVE_MINUTES=pe.ONE_MINUTE=pe.SIXTY_SECONDS=pe.THIRTY_SECONDS=pe.TEN_SECONDS=pe.FIVE_SECONDS=pe.ONE_SECOND=void 0;pe.ONE_SECOND=1;pe.FIVE_SECONDS=5;pe.TEN_SECONDS=10;pe.THIRTY_SECONDS=30;pe.SIXTY_SECONDS=60;pe.ONE_MINUTE=pe.SIXTY_SECONDS;pe.FIVE_MINUTES=pe.ONE_MINUTE*5;pe.TEN_MINUTES=pe.ONE_MINUTE*10;pe.THIRTY_MINUTES=pe.ONE_MINUTE*30;pe.SIXTY_MINUTES=pe.ONE_MINUTE*60;pe.ONE_HOUR=pe.SIXTY_MINUTES;pe.THREE_HOURS=pe.ONE_HOUR*3;pe.SIX_HOURS=pe.ONE_HOUR*6;pe.TWELVE_HOURS=pe.ONE_HOUR*12;pe.TWENTY_FOUR_HOURS=pe.ONE_HOUR*24;pe.ONE_DAY=pe.TWENTY_FOUR_HOURS;pe.THREE_DAYS=pe.ONE_DAY*3;pe.FIVE_DAYS=pe.ONE_DAY*5;pe.SEVEN_DAYS=pe.ONE_DAY*7;pe.THIRTY_DAYS=pe.ONE_DAY*30;pe.ONE_WEEK=pe.SEVEN_DAYS;pe.TWO_WEEKS=pe.ONE_WEEK*2;pe.THREE_WEEKS=pe.ONE_WEEK*3;pe.FOUR_WEEKS=pe.ONE_WEEK*4;pe.ONE_YEAR=pe.ONE_DAY*365});var Rv=E(Vd=>{"use strict";l();Object.defineProperty(Vd,"__esModule",{value:!0});var C2=(Xr(),ft(Jr));C2.__exportStar(S2(),Vd);C2.__exportStar(T2(),Vd)});var N2=E(Aa=>{"use strict";l();Object.defineProperty(Aa,"__esModule",{value:!0});Aa.fromMiliseconds=Aa.toMiliseconds=void 0;var x2=Rv();function yQ(t){return t*x2.ONE_THOUSAND}Aa.toMiliseconds=yQ;function mQ(t){return Math.floor(t/x2.ONE_THOUSAND)}Aa.fromMiliseconds=mQ});var D2=E(Hd=>{"use strict";l();Object.defineProperty(Hd,"__esModule",{value:!0});var O2=(Xr(),ft(Jr));O2.__exportStar(_2(),Hd);O2.__exportStar(N2(),Hd)});var P2=E(Qc=>{"use strict";l();Object.defineProperty(Qc,"__esModule",{value:!0});Qc.Watch=void 0;var Gd=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let r=this.get(e);if(typeof r.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let n=Date.now()-r.started;this.timestamps.set(e,{started:r.started,elapsed:n})}get(e){let r=this.timestamps.get(e);if(typeof r>"u")throw new Error(`No timestamp found for label: ${e}`);return r}elapsed(e){let r=this.get(e);return r.elapsed||Date.now()-r.started}};Qc.Watch=Gd;Qc.default=Gd});var R2=E(kd=>{"use strict";l();Object.defineProperty(kd,"__esModule",{value:!0});kd.IWatch=void 0;var Bv=class{};kd.IWatch=Bv});var B2=E(Lv=>{"use strict";l();Object.defineProperty(Lv,"__esModule",{value:!0});var wQ=(Xr(),ft(Jr));wQ.__exportStar(R2(),Lv)});var $s=E(ba=>{"use strict";l();Object.defineProperty(ba,"__esModule",{value:!0});var jd=(Xr(),ft(Jr));jd.__exportStar(D2(),ba);jd.__exportStar(P2(),ba);jd.__exportStar(B2(),ba);jd.__exportStar(Rv(),ba)});var Fv,L2=fe(()=>{l();Fv=class{}});var Mv={};ct(Mv,{IEvents:()=>Fv});var Uv=fe(()=>{l();L2()});var F2=E(Qd=>{"use strict";l();Object.defineProperty(Qd,"__esModule",{value:!0});Qd.IHeartBeat=void 0;var EQ=(Uv(),ft(Mv)),qv=class extends EQ.IEvents{constructor(e){super()}};Qd.IHeartBeat=qv});var Hv=E(Vv=>{"use strict";l();Object.defineProperty(Vv,"__esModule",{value:!0});var vQ=(Xr(),ft(Jr));vQ.__exportStar(F2(),Vv)});var M2=E(Ia=>{"use strict";l();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.HEARTBEAT_EVENTS=Ia.HEARTBEAT_INTERVAL=void 0;var AQ=$s();Ia.HEARTBEAT_INTERVAL=AQ.FIVE_SECONDS;Ia.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var kv=E(Gv=>{"use strict";l();Object.defineProperty(Gv,"__esModule",{value:!0});var bQ=(Xr(),ft(Jr));bQ.__exportStar(M2(),Gv)});var U2=E(Wd=>{"use strict";l();Object.defineProperty(Wd,"__esModule",{value:!0});Wd.HeartBeat=void 0;var jv=(Xr(),ft(Jr)),IQ=Xn(),_Q=$s(),SQ=Hv(),Qv=kv(),Wv=class t extends SQ.IHeartBeat{constructor(e){super(e),this.events=new IQ.EventEmitter,this.interval=Qv.HEARTBEAT_INTERVAL,this.interval=e?.interval||Qv.HEARTBEAT_INTERVAL}static init(e){return jv.__awaiter(this,void 0,void 0,function*(){let r=new t(e);return yield r.init(),r})}init(){return jv.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}initialize(){return jv.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),_Q.toMiliseconds(this.interval))})}pulse(){this.events.emit(Qv.HEARTBEAT_EVENTS.pulse)}};Wd.HeartBeat=Wv});var q2=E(Wc=>{"use strict";l();Object.defineProperty(Wc,"__esModule",{value:!0});var zv=(Xr(),ft(Jr));zv.__exportStar(U2(),Wc);zv.__exportStar(Hv(),Wc);zv.__exportStar(kv(),Wc)});var H2=E((Pfe,V2)=>{"use strict";l();function TQ(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}V2.exports=CQ;function CQ(t,e,r){var n=r&&r.stringify||TQ,i=1;if(typeof t=="object"&&t!==null){var s=e.length+i;if(s===1)return t;var o=new Array(s);o[0]=n(t);for(var a=1;a-1?h:0,t.charCodeAt(y+1)){case 100:case 102:if(f>=u||e[f]==null)break;h=u||e[f]==null)break;h=u||e[f]===void 0)break;h",h=y+2,y++;break}c+=n(e[f]),h=y+2,y++;break;case 115:if(f>=u)break;h{"use strict";l();var G2=H2();Q2.exports=Cn;var zc=MQ().console||{},xQ={mapHttpRequest:zd,mapHttpResponse:zd,wrapRequestSerializer:$v,wrapResponseSerializer:$v,wrapErrorSerializer:$v,req:zd,res:zd,err:RQ};function NQ(t,e){return Array.isArray(t)?t.filter(function(n){return n!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function Cn(t){t=t||{},t.browser=t.browser||{};let e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let r=t.browser.write||zc;t.browser.write&&(t.browser.asObject=!0);let n=t.serializers||{},i=NQ(t.browser.serialize,n),s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");let a=t.level||"info",u=Object.create(r);u.log||(u.log=$c),Object.defineProperty(u,"levelVal",{get:f}),Object.defineProperty(u,"level",{get:h,set:g});let c={transmit:e,serialize:i,asObject:t.browser.asObject,levels:o,timestamp:BQ(t)};u.levels=Cn.levels,u.level=a,u.setMaxListeners=u.getMaxListeners=u.emit=u.addListener=u.on=u.prependListener=u.once=u.prependOnceListener=u.removeListener=u.removeAllListeners=u.listeners=u.listenerCount=u.eventNames=u.write=u.flush=$c,u.serializers=n,u._serialize=i,u._stdErrSerialize=s,u.child=y,e&&(u._logEvent=Kv());function f(){return this.level==="silent"?1/0:this.levels.values[this.level]}function h(){return this._level}function g(m){if(m!=="silent"&&!this.levels.values[m])throw Error("unknown level "+m);this._level=m,_a(c,u,"error","log"),_a(c,u,"fatal","error"),_a(c,u,"warn","error"),_a(c,u,"info","log"),_a(c,u,"debug","log"),_a(c,u,"trace","log")}function y(m,T){if(!m)throw new Error("missing bindings for child Pino");T=T||{},i&&m.serializers&&(T.serializers=m.serializers);let O=T.serializers;if(i&&O){var B=Object.assign({},n,O),W=t.browser.serialize===!0?Object.keys(B):i;delete m.serializers,$d([m],W,B,this._stdErrSerialize)}function U(A){this._childLevel=(A._childLevel|0)+1,this.error=Sa(A,m,"error"),this.fatal=Sa(A,m,"fatal"),this.warn=Sa(A,m,"warn"),this.info=Sa(A,m,"info"),this.debug=Sa(A,m,"debug"),this.trace=Sa(A,m,"trace"),B&&(this.serializers=B,this._serialize=W),e&&(this._logEvent=Kv([].concat(A._logEvent.bindings,m)))}return U.prototype=this,new U(this)}return u}Cn.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Cn.stdSerializers=xQ;Cn.stdTimeFunctions=Object.assign({},{nullTime:k2,epochTime:j2,unixTime:LQ,isoTime:FQ});function _a(t,e,r,n){let i=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?$c:i[r]?i[r]:zc[r]||zc[n]||$c,OQ(t,e,r)}function OQ(t,e,r){!t.transmit&&e[r]===$c||(e[r]=function(n){return function(){let s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===zc?zc:this;for(var u=0;u-1&&s in r&&(t[i][s]=r[s](t[i][s]))}function Sa(t,e,r){return function(){let n=new Array(1+arguments.length);n[0]=e;for(var i=1;i{"use strict";l();Object.defineProperty(Ta,"__esModule",{value:!0});Ta.PINO_CUSTOM_CONTEXT_KEY=Ta.PINO_LOGGER_DEFAULTS=void 0;Ta.PINO_LOGGER_DEFAULTS={level:"info"};Ta.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var J2=E(gr=>{"use strict";l();Object.defineProperty(gr,"__esModule",{value:!0});gr.generateChildLogger=gr.formatChildLoggerContext=gr.getLoggerContext=gr.setBrowserLoggerContext=gr.getBrowserLoggerContext=gr.getDefaultLoggerOptions=void 0;var Ca=Yv();function UQ(t){return Object.assign(Object.assign({},t),{level:t?.level||Ca.PINO_LOGGER_DEFAULTS.level})}gr.getDefaultLoggerOptions=UQ;function z2(t,e=Ca.PINO_CUSTOM_CONTEXT_KEY){return t[e]||""}gr.getBrowserLoggerContext=z2;function $2(t,e,r=Ca.PINO_CUSTOM_CONTEXT_KEY){return t[r]=e,t}gr.setBrowserLoggerContext=$2;function K2(t,e=Ca.PINO_CUSTOM_CONTEXT_KEY){let r="";return typeof t.bindings>"u"?r=z2(t,e):r=t.bindings().context||"",r}gr.getLoggerContext=K2;function Y2(t,e,r=Ca.PINO_CUSTOM_CONTEXT_KEY){let n=K2(t,r);return n.trim()?`${n}/${e}`:e}gr.formatChildLoggerContext=Y2;function qQ(t,e,r=Ca.PINO_CUSTOM_CONTEXT_KEY){let n=Y2(t,e,r),i=t.child({context:n});return $2(i,n,r)}gr.generateChildLogger=qQ});var Xv=E(xa=>{"use strict";l();Object.defineProperty(xa,"__esModule",{value:!0});xa.pino=void 0;var Jv=(Xr(),ft(Jr)),VQ=Jv.__importDefault(W2());Object.defineProperty(xa,"pino",{enumerable:!0,get:function(){return VQ.default}});Jv.__exportStar(Yv(),xa);Jv.__exportStar(J2(),xa)});var y1=E(Rt=>{"use strict";l();Object.defineProperty(Rt,"__esModule",{value:!0});var Na=(Uv(),ft(Mv)),X2=Xn();function HQ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var GQ=HQ(X2),Zv=class extends Na.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},e1=class{constructor(e,r,n){this.core=e,this.logger=r}},t1=class extends Na.IEvents{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},r1=class{constructor(e,r){this.logger=e,this.core=r}},n1=class extends Na.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},i1=class extends Na.IEvents{constructor(e){super()}},s1=class{constructor(e,r,n,i){this.core=e,this.logger=r,this.name=n}},o1=class{constructor(){this.map=new Map}},a1=class extends Na.IEvents{constructor(e,r){super(),this.relayer=e,this.logger=r}},u1=class{constructor(e,r){this.core=e,this.logger=r}},c1=class extends Na.IEvents{constructor(e,r){super(),this.core=e,this.logger=r}},l1=class{constructor(e,r){this.logger=e,this.core=r}},f1=class{constructor(e,r){this.projectId=e,this.logger=r}},h1=class extends GQ.default{constructor(){super()}},d1=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},p1=class extends X2.EventEmitter{constructor(){super()}},g1=class{constructor(e){this.client=e}};Rt.ICore=Zv,Rt.ICrypto=e1,Rt.IEngine=g1,Rt.IEngineEvents=p1,Rt.IExpirer=c1,Rt.IJsonRpcHistory=t1,Rt.IKeyChain=u1,Rt.IMessageTracker=r1,Rt.IPairing=l1,Rt.IPublisher=n1,Rt.IRelayer=i1,Rt.ISignClient=d1,Rt.ISignClientEvents=h1,Rt.IStore=s1,Rt.ISubscriber=a1,Rt.ISubscriberTopicMap=o1,Rt.IVerify=f1});var eD=E(Kd=>{"use strict";l();Object.defineProperty(Kd,"__esModule",{value:!0});Kd.BrowserRandomSource=void 0;var Z2=65536,m1=class{constructor(){this.isAvailable=!1,this.isInstantiated=!1;let e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");let r=new Uint8Array(e);for(let n=0;n{"use strict";l();Object.defineProperty(w1,"__esModule",{value:!0});function kQ(t){for(var e=0;e{l()});var rD=E(Yd=>{"use strict";l();Object.defineProperty(Yd,"__esModule",{value:!0});Yd.NodeRandomSource=void 0;var jQ=Hr(),E1=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof hS<"u"){let e=tD();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let n=new Uint8Array(e);for(let i=0;i{"use strict";l();Object.defineProperty(Jd,"__esModule",{value:!0});Jd.SystemRandomSource=void 0;var QQ=eD(),WQ=rD(),v1=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new QQ.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new WQ.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}};Jd.SystemRandomSource=v1});var iD=E(Ar=>{"use strict";l();Object.defineProperty(Ar,"__esModule",{value:!0});function zQ(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}Ar.mul=Math.imul||zQ;function $Q(t,e){return t+e|0}Ar.add=$Q;function KQ(t,e){return t-e|0}Ar.sub=KQ;function YQ(t,e){return t<>>32-e}Ar.rotl=YQ;function JQ(t,e){return t<<32-e|t>>>e}Ar.rotr=JQ;function XQ(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}Ar.isInteger=Number.isInteger||XQ;Ar.MAX_SAFE_INTEGER=9007199254740991;Ar.isSafeInteger=function(t){return Ar.isInteger(t)&&t>=-Ar.MAX_SAFE_INTEGER&&t<=Ar.MAX_SAFE_INTEGER}});var Oa=E(Ne=>{"use strict";l();Object.defineProperty(Ne,"__esModule",{value:!0});var sD=iD();function ZQ(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Ne.readInt16BE=ZQ;function e9(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Ne.readUint16BE=e9;function t9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Ne.readInt16LE=t9;function r9(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Ne.readUint16LE=r9;function oD(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Ne.writeUint16BE=oD;Ne.writeInt16BE=oD;function aD(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Ne.writeUint16LE=aD;Ne.writeInt16LE=aD;function A1(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Ne.readInt32BE=A1;function b1(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Ne.readUint32BE=b1;function I1(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Ne.readInt32LE=I1;function _1(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Ne.readUint32LE=_1;function Xd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Ne.writeUint32BE=Xd;Ne.writeInt32BE=Xd;function Zd(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Ne.writeUint32LE=Zd;Ne.writeInt32LE=Zd;function n9(t,e){e===void 0&&(e=0);var r=A1(t,e),n=A1(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Ne.readInt64BE=n9;function i9(t,e){e===void 0&&(e=0);var r=b1(t,e),n=b1(t,e+4);return r*4294967296+n}Ne.readUint64BE=i9;function s9(t,e){e===void 0&&(e=0);var r=I1(t,e),n=I1(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Ne.readInt64LE=s9;function o9(t,e){e===void 0&&(e=0);var r=_1(t,e),n=_1(t,e+4);return n*4294967296+r}Ne.readUint64LE=o9;function uD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Xd(t/4294967296>>>0,e,r),Xd(t>>>0,e,r+4),e}Ne.writeUint64BE=uD;Ne.writeInt64BE=uD;function cD(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),Zd(t>>>0,e,r),Zd(t/4294967296>>>0,e,r+4),e}Ne.writeUint64LE=cD;Ne.writeInt64LE=cD;function a9(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Ne.readUintBE=a9;function u9(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s=n;s--)r[s]=e/i&255,i*=256;return r}Ne.writeUintBE=c9;function l9(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!sD.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s{"use strict";l();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.randomStringForEntropy=Xt.randomString=Xt.randomUint32=Xt.randomBytes=Xt.defaultRandomSource=void 0;var E9=nD(),v9=Oa(),lD=Hr();Xt.defaultRandomSource=new E9.SystemRandomSource;function S1(t,e=Xt.defaultRandomSource){return e.randomBytes(t)}Xt.randomBytes=S1;function A9(t=Xt.defaultRandomSource){let e=S1(4,t),r=(0,v9.readUint32LE)(e);return(0,lD.wipe)(e),r}Xt.randomUint32=A9;var fD="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function hD(t,e=fD,r=Xt.defaultRandomSource){if(e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");let n="",i=e.length,s=256-256%i;for(;t>0;){let o=S1(Math.ceil(t*256/s),r);for(let a=0;a0;a++){let u=o[a];u{"use strict";l();Object.defineProperty(ei,"__esModule",{value:!0});var Pa=Oa(),Da=Hr();ei.DIGEST_LENGTH=64;ei.BLOCK_SIZE=128;var pD=function(){function t(){this.digestLength=ei.DIGEST_LENGTH,this.blockSize=ei.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Da.wipe(this._buffer),Da.wipe(this._tempHi),Da.wipe(this._tempLo),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(T1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=T1(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%128<112?128:256;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Da.wipe(e.stateHi),Da.wipe(e.stateLo),e.buffer&&Da.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();ei.SHA512=pD;var dD=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function T1(t,e,r,n,i,s,o){for(var a=r[0],u=r[1],c=r[2],f=r[3],h=r[4],g=r[5],y=r[6],m=r[7],T=n[0],O=n[1],B=n[2],W=n[3],U=n[4],A=n[5],_=n[6],N=n[7],I,S,R,J,Q,V,k,K;o>=128;){for(var ge=0;ge<16;ge++){var ue=8*ge+s;t[ge]=Pa.readUint32BE(i,ue),e[ge]=Pa.readUint32BE(i,ue+4)}for(var ge=0;ge<80;ge++){var re=a,Y=u,se=c,te=f,ie=h,M=g,le=y,ae=m,he=T,oe=O,ce=B,w=W,v=U,b=A,P=_,C=N;if(I=m,S=N,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=(h>>>14|U<<18)^(h>>>18|U<<14)^(U>>>9|h<<23),S=(U>>>14|h<<18)^(U>>>18|h<<14)^(h>>>9|U<<23),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=h&g^~h&y,S=U&A^~U&_,Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=dD[ge*2],S=dD[ge*2+1],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=t[ge%16],S=e[ge%16],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,R=k&65535|K<<16,J=Q&65535|V<<16,I=R,S=J,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=(a>>>28|T<<4)^(T>>>2|a<<30)^(T>>>7|a<<25),S=(T>>>28|a<<4)^(a>>>2|T<<30)^(a>>>7|T<<25),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,I=a&u^a&c^u&c,S=T&O^T&B^O&B,Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,ae=k&65535|K<<16,C=Q&65535|V<<16,I=te,S=w,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=R,S=J,Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,te=k&65535|K<<16,w=Q&65535|V<<16,u=re,c=Y,f=se,h=te,g=ie,y=M,m=le,a=ae,O=he,B=oe,W=ce,U=w,A=v,_=b,N=P,T=C,ge%16===15)for(var ue=0;ue<16;ue++)I=t[ue],S=e[ue],Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=t[(ue+9)%16],S=e[(ue+9)%16],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,R=t[(ue+1)%16],J=e[(ue+1)%16],I=(R>>>1|J<<31)^(R>>>8|J<<24)^R>>>7,S=(J>>>1|R<<31)^(J>>>8|R<<24)^(J>>>7|R<<25),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,R=t[(ue+14)%16],J=e[(ue+14)%16],I=(R>>>19|J<<13)^(J>>>29|R<<3)^R>>>6,S=(J>>>19|R<<13)^(R>>>29|J<<3)^(J>>>6|R<<26),Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,t[ue]=k&65535|K<<16,e[ue]=Q&65535|V<<16}I=a,S=T,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[0],S=n[0],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[0]=a=k&65535|K<<16,n[0]=T=Q&65535|V<<16,I=u,S=O,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[1],S=n[1],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[1]=u=k&65535|K<<16,n[1]=O=Q&65535|V<<16,I=c,S=B,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[2],S=n[2],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[2]=c=k&65535|K<<16,n[2]=B=Q&65535|V<<16,I=f,S=W,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[3],S=n[3],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[3]=f=k&65535|K<<16,n[3]=W=Q&65535|V<<16,I=h,S=U,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[4],S=n[4],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[4]=h=k&65535|K<<16,n[4]=U=Q&65535|V<<16,I=g,S=A,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[5],S=n[5],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[5]=g=k&65535|K<<16,n[5]=A=Q&65535|V<<16,I=y,S=_,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[6],S=n[6],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[6]=y=k&65535|K<<16,n[6]=_=Q&65535|V<<16,I=m,S=N,Q=S&65535,V=S>>>16,k=I&65535,K=I>>>16,I=r[7],S=n[7],Q+=S&65535,V+=S>>>16,k+=I&65535,K+=I>>>16,V+=Q>>>16,k+=V>>>16,K+=k>>>16,r[7]=m=k&65535|K<<16,n[7]=N=Q&65535|V<<16,s+=128,o-=128}return s}function I9(t){var e=new pD;e.update(t);var r=e.digest();return e.clean(),r}ei.hash=I9});var ND=E(Ve=>{"use strict";l();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.convertSecretKeyToX25519=Ve.convertPublicKeyToX25519=Ve.verify=Ve.sign=Ve.extractPublicKeyFromSecretKey=Ve.generateKeyPair=Ve.generateKeyPairFromSeed=Ve.SEED_LENGTH=Ve.SECRET_KEY_LENGTH=Ve.PUBLIC_KEY_LENGTH=Ve.SIGNATURE_LENGTH=void 0;var _9=Kc(),Yc=gD(),vD=Hr();Ve.SIGNATURE_LENGTH=64;Ve.PUBLIC_KEY_LENGTH=32;Ve.SECRET_KEY_LENGTH=64;Ve.SEED_LENGTH=32;function Ie(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,AD(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function bD(t,e){let r=0;for(let n=0;n<32;n++)r|=t[n]^e[n];return(1&r-1>>>8)-1}function wD(t,e){let r=new Uint8Array(32),n=new Uint8Array(32);return Jc(r,t),Jc(n,e),bD(r,n)}function ID(t){let e=new Uint8Array(32);return Jc(e,t),e[0]&1}function N9(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Ks(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Js(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function je(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,h=0,g=0,y=0,m=0,T=0,O=0,B=0,W=0,U=0,A=0,_=0,N=0,I=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,ge=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],he=r[5],oe=r[6],ce=r[7],w=r[8],v=r[9],b=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,c+=n*ae,f+=n*he,h+=n*oe,g+=n*ce,y+=n*w,m+=n*v,T+=n*b,O+=n*P,B+=n*C,W+=n*D,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,c+=n*le,f+=n*ae,h+=n*he,g+=n*oe,y+=n*ce,m+=n*w,T+=n*v,O+=n*b,B+=n*P,W+=n*C,U+=n*D,A+=n*L,_+=n*x,n=e[2],a+=n*te,u+=n*ie,c+=n*M,f+=n*le,h+=n*ae,g+=n*he,y+=n*oe,m+=n*ce,T+=n*w,O+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*D,_+=n*L,N+=n*x,n=e[3],u+=n*te,c+=n*ie,f+=n*M,h+=n*le,g+=n*ae,y+=n*he,m+=n*oe,T+=n*ce,O+=n*w,B+=n*v,W+=n*b,U+=n*P,A+=n*C,_+=n*D,N+=n*L,I+=n*x,n=e[4],c+=n*te,f+=n*ie,h+=n*M,g+=n*le,y+=n*ae,m+=n*he,T+=n*oe,O+=n*ce,B+=n*w,W+=n*v,U+=n*b,A+=n*P,_+=n*C,N+=n*D,I+=n*L,S+=n*x,n=e[5],f+=n*te,h+=n*ie,g+=n*M,y+=n*le,m+=n*ae,T+=n*he,O+=n*oe,B+=n*ce,W+=n*w,U+=n*v,A+=n*b,_+=n*P,N+=n*C,I+=n*D,S+=n*L,R+=n*x,n=e[6],h+=n*te,g+=n*ie,y+=n*M,m+=n*le,T+=n*ae,O+=n*he,B+=n*oe,W+=n*ce,U+=n*w,A+=n*v,_+=n*b,N+=n*P,I+=n*C,S+=n*D,R+=n*L,J+=n*x,n=e[7],g+=n*te,y+=n*ie,m+=n*M,T+=n*le,O+=n*ae,B+=n*he,W+=n*oe,U+=n*ce,A+=n*w,_+=n*v,N+=n*b,I+=n*P,S+=n*C,R+=n*D,J+=n*L,Q+=n*x,n=e[8],y+=n*te,m+=n*ie,T+=n*M,O+=n*le,B+=n*ae,W+=n*he,U+=n*oe,A+=n*ce,_+=n*w,N+=n*v,I+=n*b,S+=n*P,R+=n*C,J+=n*D,Q+=n*L,V+=n*x,n=e[9],m+=n*te,T+=n*ie,O+=n*M,B+=n*le,W+=n*ae,U+=n*he,A+=n*oe,_+=n*ce,N+=n*w,I+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*D,V+=n*L,k+=n*x,n=e[10],T+=n*te,O+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*he,_+=n*oe,N+=n*ce,I+=n*w,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*D,k+=n*L,K+=n*x,n=e[11],O+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,_+=n*he,N+=n*oe,I+=n*ce,S+=n*w,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*D,K+=n*L,ge+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,_+=n*ae,N+=n*he,I+=n*oe,S+=n*ce,R+=n*w,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*D,ge+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,_+=n*le,N+=n*ae,I+=n*he,S+=n*oe,R+=n*ce,J+=n*w,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,ge+=n*D,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,_+=n*M,N+=n*le,I+=n*ae,S+=n*he,R+=n*oe,J+=n*ce,Q+=n*w,V+=n*v,k+=n*b,K+=n*P,ge+=n*C,ue+=n*D,re+=n*L,Y+=n*x,n=e[15],A+=n*te,_+=n*ie,N+=n*M,I+=n*le,S+=n*ae,R+=n*he,J+=n*oe,Q+=n*ce,V+=n*w,k+=n*v,K+=n*b,ge+=n*P,ue+=n*C,re+=n*D,Y+=n*L,se+=n*x,s+=38*_,o+=38*N,a+=38*I,u+=38*S,c+=38*R,f+=38*J,h+=38*Q,g+=38*V,y+=38*k,m+=38*K,T+=38*ge,O+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=h,t[7]=g,t[8]=y,t[9]=m,t[10]=T,t[11]=O,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function Ys(t,e){je(t,e,e)}function _D(t,e){let r=Ie(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=253;n>=0;n--)Ys(r,r),n!==2&&n!==4&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function O9(t,e){let r=Ie(),n;for(n=0;n<16;n++)r[n]=e[n];for(n=250;n>=0;n--)Ys(r,r),n!==1&&je(r,r,e);for(n=0;n<16;n++)t[n]=r[n]}function O1(t,e){let r=Ie(),n=Ie(),i=Ie(),s=Ie(),o=Ie(),a=Ie(),u=Ie(),c=Ie(),f=Ie();Js(r,t[1],t[0]),Js(f,e[1],e[0]),je(r,r,f),Ks(n,t[0],t[1]),Ks(f,e[0],e[1]),je(n,n,f),je(i,t[3],e[3]),je(i,i,C9),je(s,t[2],e[2]),Ks(s,s,s),Js(o,n,r),Js(a,s,i),Ks(u,s,i),Ks(c,n,r),je(t[0],o,a),je(t[1],c,u),je(t[2],u,a),je(t[3],o,c)}function ED(t,e,r){for(let n=0;n<4;n++)AD(t[n],e[n],r)}function P1(t,e){let r=Ie(),n=Ie(),i=Ie();_D(i,e[2]),je(r,e[0],i),je(n,e[1],i),Jc(t,n),t[31]^=ID(r)<<7}function SD(t,e,r){Gi(t[0],N1),Gi(t[1],Ra),Gi(t[2],Ra),Gi(t[3],N1);for(let n=255;n>=0;--n){let i=r[n/8|0]>>(n&7)&1;ED(t,e,i),O1(e,t),O1(t,t),ED(t,e,i)}}function R1(t,e){let r=[Ie(),Ie(),Ie(),Ie()];Gi(r[0],yD),Gi(r[1],mD),Gi(r[2],Ra),je(r[3],yD,mD),SD(t,r,e)}function TD(t){if(t.length!==Ve.SEED_LENGTH)throw new Error(`ed25519: seed must be ${Ve.SEED_LENGTH} bytes`);let e=(0,Yc.hash)(t);e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(32),n=[Ie(),Ie(),Ie(),Ie()];R1(n,e),P1(r,n);let i=new Uint8Array(64);return i.set(t),i.set(r,32),{publicKey:r,secretKey:i}}Ve.generateKeyPairFromSeed=TD;function D9(t){let e=(0,_9.randomBytes)(32,t),r=TD(e);return(0,vD.wipe)(e),r}Ve.generateKeyPair=D9;function P9(t){if(t.length!==Ve.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${Ve.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(t.subarray(32))}Ve.extractPublicKeyFromSecretKey=P9;var x1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function CD(t,e){let r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i>4)*x1[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=r*x1[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,t[n]=e[n]&255}function D1(t){let e=new Float64Array(64);for(let r=0;r<64;r++)e[r]=t[r];for(let r=0;r<64;r++)t[r]=0;CD(t,e)}function R9(t,e){let r=new Float64Array(64),n=[Ie(),Ie(),Ie(),Ie()],i=(0,Yc.hash)(t.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;let s=new Uint8Array(64);s.set(i.subarray(32),32);let o=new Yc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),D1(a),R1(n,a),P1(s,n),o.reset(),o.update(s.subarray(0,32)),o.update(t.subarray(32)),o.update(e);let u=o.digest();D1(u);for(let c=0;c<32;c++)r[c]=a[c];for(let c=0;c<32;c++)for(let f=0;f<32;f++)r[c+f]+=u[c]*i[f];return CD(s.subarray(32),r),s}Ve.sign=R9;function xD(t,e){let r=Ie(),n=Ie(),i=Ie(),s=Ie(),o=Ie(),a=Ie(),u=Ie();return Gi(t[2],Ra),N9(t[1],e),Ys(i,t[1]),je(s,i,T9),Js(i,i,t[2]),Ks(s,t[2],s),Ys(o,s),Ys(a,o),je(u,a,o),je(r,u,i),je(r,r,s),O9(r,r),je(r,r,i),je(r,r,s),je(r,r,s),je(t[0],r,s),Ys(n,t[0]),je(n,n,s),wD(n,i)&&je(t[0],t[0],x9),Ys(n,t[0]),je(n,n,s),wD(n,i)?-1:(ID(t[0])===e[31]>>7&&Js(t[0],N1,t[0]),je(t[3],t[0],t[1]),0)}function B9(t,e,r){let n=new Uint8Array(32),i=[Ie(),Ie(),Ie(),Ie()],s=[Ie(),Ie(),Ie(),Ie()];if(r.length!==Ve.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${Ve.SIGNATURE_LENGTH} bytes`);if(xD(s,t))return!1;let o=new Yc.SHA512;o.update(r.subarray(0,32)),o.update(t),o.update(e);let a=o.digest();return D1(a),SD(i,s,a),R1(s,r.subarray(32)),O1(i,s),P1(n,i),!bD(r,n)}Ve.verify=B9;function L9(t){let e=[Ie(),Ie(),Ie(),Ie()];if(xD(e,t))throw new Error("Ed25519: invalid public key");let r=Ie(),n=Ie(),i=e[1];Ks(r,Ra,i),Js(n,Ra,i),_D(n,n),je(r,r,n);let s=new Uint8Array(32);return Jc(s,r),s}Ve.convertPublicKeyToX25519=L9;function F9(t){let e=(0,Yc.hash)(t.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let r=new Uint8Array(e.subarray(0,32));return(0,vD.wipe)(e),r}Ve.convertSecretKeyToX25519=F9});var ep,tp,Xs,Ba,rp,Xc,np,ip,sp,La,op,ap,OD,DD,up=fe(()=>{l();ep="EdDSA",tp="JWT",Xs=".",Ba="base64url",rp="utf8",Xc="utf8",np=":",ip="did",sp="key",La="base58btc",op="z",ap="K36",OD=32,DD=32});function ki(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}var Zc=fe(()=>{l()});function Fa(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?ki(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var cp=fe(()=>{l();Zc()});function lp(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=Fa(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return ki(r)}var B1=fe(()=>{l();cp();Zc()});function M9(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var _=m[B],N=0,I=U-1;(_!==0||N>>0,A[I]=_%a>>>0,_=_/a>>>0;if(_!==0)throw new Error("Non-zero carry");O=N,B++}for(var S=U-O;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);m[T];){var A=r[m.charCodeAt(T)];if(A===255)return;for(var _=0,N=W-1;(A!==0||_>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=_,T++}if(m[T]!==" "){for(var I=W-B;I!==W&&U[I]===0;)I++;for(var S=new Uint8Array(O+(W-I)),R=O;I!==W;)S[R++]=U[I++];return S}}}function y(m){var T=g(m);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:g,decode:y}}var U9,q9,PD,RD=fe(()=>{l();U9=M9,q9=U9,PD=q9});var She,BD,ti,LD,FD,ji=fe(()=>{l();She=new Uint8Array(0),BD=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},LD=t=>new TextEncoder().encode(t),FD=t=>new TextDecoder().decode(t)});var L1,F1,M1,UD,U1,Ma,Qi,V9,H9,pt,Zr=fe(()=>{l();RD();ji();L1=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},F1=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return UD(this,e)}},M1=class{constructor(e){this.decoders=e}or(e){return UD(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},UD=(t,e)=>new M1({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),U1=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new L1(e,r,n),this.decoder=new F1(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ma=({name:t,prefix:e,encode:r,decode:n})=>new U1(t,e,r,n),Qi=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=PD(r,e);return Ma({prefix:t,name:e,encode:n,decode:s=>ti(i(s))})},V9=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},H9=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Ma({prefix:e,name:t,encode(i){return H9(i,n,r)},decode(i){return V9(i,n,r,t)}})});var q1={};ct(q1,{identity:()=>G9});var G9,qD=fe(()=>{l();Zr();ji();G9=Ma({prefix:"\0",name:"identity",encode:t=>FD(t),decode:t=>LD(t)})});var V1={};ct(V1,{base2:()=>k9});var k9,VD=fe(()=>{l();Zr();k9=pt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var H1={};ct(H1,{base8:()=>j9});var j9,HD=fe(()=>{l();Zr();j9=pt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var G1={};ct(G1,{base10:()=>Q9});var Q9,GD=fe(()=>{l();Zr();Q9=Qi({prefix:"9",name:"base10",alphabet:"0123456789"})});var k1={};ct(k1,{base16:()=>W9,base16upper:()=>z9});var W9,z9,kD=fe(()=>{l();Zr();W9=pt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),z9=pt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var j1={};ct(j1,{base32:()=>Ua,base32hex:()=>J9,base32hexpad:()=>Z9,base32hexpadupper:()=>eW,base32hexupper:()=>X9,base32pad:()=>K9,base32padupper:()=>Y9,base32upper:()=>$9,base32z:()=>tW});var Ua,$9,K9,Y9,J9,X9,Z9,eW,tW,Q1=fe(()=>{l();Zr();Ua=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),$9=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),K9=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Y9=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),J9=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),X9=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Z9=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),eW=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),tW=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var W1={};ct(W1,{base36:()=>rW,base36upper:()=>nW});var rW,nW,jD=fe(()=>{l();Zr();rW=Qi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nW=Qi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var z1={};ct(z1,{base58btc:()=>xn,base58flickr:()=>iW});var xn,iW,$1=fe(()=>{l();Zr();xn=Qi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iW=Qi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var K1={};ct(K1,{base64:()=>sW,base64pad:()=>oW,base64url:()=>aW,base64urlpad:()=>uW});var sW,oW,aW,uW,QD=fe(()=>{l();Zr();sW=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),oW=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),aW=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uW=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Y1={};ct(Y1,{base256emoji:()=>dW});function fW(t){return t.reduce((e,r)=>(e+=cW[r],e),"")}function hW(t){let e=[];for(let r of t){let n=lW[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var WD,cW,lW,dW,zD=fe(()=>{l();Zr();WD=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),cW=WD.reduce((t,e,r)=>(t[r]=e,t),[]),lW=WD.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);dW=Ma({prefix:"\u{1F680}",name:"base256emoji",encode:fW,decode:hW})});function YD(t,e,r){e=e||[],r=r||0;for(var n=r;t>=mW;)e[r++]=t&255|$D,t/=128;for(;t&yW;)e[r++]=t&255|$D,t>>>=7;return e[r]=t|0,YD.bytes=r-n+1,e}function J1(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw J1.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&KD)<=EW);return J1.bytes=s-n,r}var pW,$D,gW,yW,mW,wW,EW,KD,vW,AW,bW,IW,_W,SW,TW,CW,xW,NW,OW,DW,el,JD=fe(()=>{l();pW=YD,$D=128,gW=127,yW=~gW,mW=Math.pow(2,31);wW=J1,EW=128,KD=127;vW=Math.pow(2,7),AW=Math.pow(2,14),bW=Math.pow(2,21),IW=Math.pow(2,28),_W=Math.pow(2,35),SW=Math.pow(2,42),TW=Math.pow(2,49),CW=Math.pow(2,56),xW=Math.pow(2,63),NW=function(t){return t{l();JD();tl=(t,e=0)=>[el.decode(t,e),el.decode.bytes],qa=(t,e,r=0)=>(el.encode(t,e,r),e),Va=t=>el.encodingLength(t)});var Zs,XD,ZD,Ha,nl=fe(()=>{l();ji();hp();Zs=(t,e)=>{let r=e.byteLength,n=Va(t),i=n+Va(r),s=new Uint8Array(i+r);return qa(t,s,0),qa(r,s,n),s.set(e,i),new Ha(t,r,e,s)},XD=t=>{let e=ti(t),[r,n]=tl(e),[i,s]=tl(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Ha(r,i,o,e)},ZD=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&BD(t.bytes,e.bytes),Ha=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var Z1,X1,eA=fe(()=>{l();nl();Z1=({name:t,code:e,encode:r})=>new X1(t,e,r),X1=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Zs(this.code,r):r.then(n=>Zs(this.code,n))}else throw Error("Unknown type, must be binary type")}}});var tA={};ct(tA,{sha256:()=>PW,sha512:()=>RW});var tP,PW,RW,rP=fe(()=>{l();eA();tP=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),PW=Z1({name:"sha2-256",code:18,encode:tP("SHA-256")}),RW=Z1({name:"sha2-512",code:19,encode:tP("SHA-512")})});var rA={};ct(rA,{identity:()=>FW});var nP,BW,iP,LW,FW,sP=fe(()=>{l();ji();nl();nP=0,BW="identity",iP=ti,LW=t=>Zs(nP,iP(t)),FW={code:nP,name:BW,encode:iP,digest:LW}});var oP=fe(()=>{l();ji()});var fde,hde,aP=fe(()=>{l();fde=new TextEncoder,hde=new TextDecoder});var gp,qW,VW,HW,il,GW,uP,cP,dp,pp,kW,jW,QW,lP=fe(()=>{l();hp();nl();$1();Q1();ji();gp=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:pp,byteLength:pp,code:dp,version:dp,multihash:dp,bytes:dp,_baseCache:pp,asCID:pp})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==il)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==GW)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Zs(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&ZD(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return VW(r,i,e||xn.encoder);default:return HW(r,i,e||Ua.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return jW(/^0\.0/,QW),!!(e&&(e[cP]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof t)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new t(r,n,i,s||uP(r,n,i.bytes))}else if(e!=null&&e[cP]===!0){let{version:r,multihash:n,code:i}=e,s=XD(n);return t.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==il)throw new Error(`Version 0 CID must use dag-pb (code: ${il}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=uP(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,il,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=ti(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Ha(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[h,g]=tl(e.subarray(r));return r+=g,h},i=n(),s=il;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),u=n(),c=r+u,f=c-o;return{version:i,codec:s,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=qW(e,r),s=t.decode(i);return s._baseCache.set(n,e),s}},qW=(t,e)=>{switch(t[0]){case"Q":{let r=e||xn;return[xn.prefix,r.decode(`${xn.prefix}${t}`)]}case xn.prefix:{let r=e||xn;return[xn.prefix,r.decode(t)]}case Ua.prefix:{let r=e||Ua;return[Ua.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},VW=(t,e,r)=>{let{prefix:n}=r;if(n!==xn.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},HW=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},il=112,GW=18,uP=(t,e,r)=>{let n=Va(t),i=n+Va(e),s=new Uint8Array(i+r.byteLength);return qa(t,s,0),qa(e,s,n),s.set(r,i),s},cP=Symbol.for("@ipld/js-cid/CID"),dp={writable:!1,configurable:!1,enumerable:!0},pp={writable:!1,enumerable:!1,configurable:!1},kW="0.0.0-dev",jW=(t,e)=>{if(t.test(kW))console.warn(e);else throw new Error(e)},QW=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -17,33 +18,32 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var UD=ge(()=>{c();MD();cp();qi();H1();zc()});var j1,Dhe,qD=ge(()=>{c();hD();dD();pD();gD();yD();P1();mD();L1();wD();vD();ND();PD();RD();BD();UD();j1={...T1,...C1,...x1,...N1,...O1,...D1,...R1,...B1,...F1,...M1},Dhe={...G1,...k1}});function HD(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var VD,Q1,nW,dp,W1=ge(()=>{c();qD();op();VD=HD("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Q1=HD("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Ra(t.length);for(let r=0;r{c();W1()});function Sn(t,e="utf8"){let r=dp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ui(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var z1=ge(()=>{c();W1();jc()});function Yc(t){return Uc(Zn(Sn(t,Da),Zd))}function Jc(t){return Zn(Sn(qc(t),Zd),Da)}function K1(t){let e=Sn(ip,Pa),r=np+Zn(ap([e,t]),Pa);return[tp,rp,r].join(ep)}function Y1(t){let[e,r,n]=t.split(ep);if(e!==tp||r!==rp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==np)throw new Error("Issuer must be a key in mulicodec format");let s=Sn(n.slice(1),Pa);if(Zn(s.slice(0,2),Pa)!==ip)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function GD(t){return Zn(t,Da)}function kD(t){return Sn(t,Da)}function J1(t){return Sn([Jc(t.header),Jc(t.payload)].join($s),kc)}function iW(t){let e=Zn(t,kc).split($s),r=Yc(e[0]),n=Yc(e[1]);return{header:r,payload:n}}function X1(t){return[Jc(t.header),Jc(t.payload),GD(t.signature)].join($s)}function Z1(t){let e=t.split($s),r=Yc(e[0]),n=Yc(e[1]),i=kD(e[2]),s=Sn(e.slice(0,2).join($s),kc);return{header:r,payload:n,signature:i,data:s}}var eA=ge(()=>{c();A1();$1();z1();Qd();sp()});function sW(t=(0,jD.randomBytes)(32)){return qa.generateKeyPairFromSeed(t)}async function oW(t,e,r,n,i=(0,QD.fromMiliseconds)(Date.now())){let s={alg:Jd,typ:Xd},o=K1(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},l=J1({header:s,payload:u}),f=qa.sign(n.secretKey,l);return X1({header:s,payload:u,signature:f})}async function aW(t){let{header:e,payload:r,data:n,signature:i}=Z1(t);if(e.alg!==Jd||e.typ!==Xd)throw new Error("JWT must use EdDSA algorithm");let s=Y1(r.iss);return qa.verify(s,n,i)}var qa,jD,QD,WD=ge(()=>{c();qa=_e(rD()),jD=_e(Vc()),QD=_e(ks());sp();eA()});var $D=ge(()=>{c()});var zD={};ft(zD,{DATA_ENCODING:()=>kc,DID_DELIMITER:()=>ep,DID_METHOD:()=>rp,DID_PREFIX:()=>tp,JSON_ENCODING:()=>Zd,JWT_DELIMITER:()=>$s,JWT_ENCODING:()=>Da,JWT_IRIDIUM_ALG:()=>Jd,JWT_IRIDIUM_TYP:()=>Xd,KEY_PAIR_SEED_LENGTH:()=>iD,MULTICODEC_ED25519_BASE:()=>np,MULTICODEC_ED25519_ENCODING:()=>Pa,MULTICODEC_ED25519_HEADER:()=>ip,MULTICODEC_ED25519_LENGTH:()=>nD,decodeData:()=>iW,decodeIss:()=>Y1,decodeJSON:()=>Yc,decodeJWT:()=>Z1,decodeSig:()=>kD,encodeData:()=>J1,encodeIss:()=>K1,encodeJSON:()=>Jc,encodeJWT:()=>X1,encodeSig:()=>GD,generateKeyPair:()=>sW,signJWT:()=>oW,verifyJWT:()=>aW});var KD=ge(()=>{c();WD();sp();$D();eA()});var JD=m(pp=>{"use strict";c();Object.defineProperty(pp,"__esModule",{value:!0});var Xt=Ca(),tA=qr(),uW=20;function cW(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],w=r[27]<<24|r[26]<<16|r[25]<<8|r[24],E=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],D=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],W=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,A=i,I=s,N=o,_=a,S=u,R=l,J=f,Q=d,V=g,k=w,K=E,pe=T,ue=D,re=B,Y=W,se=0;se>>32-16|pe<<16,Q=Q+pe|0,_^=Q,_=_>>>32-12|_<<12,A=A+S|0,ue^=A,ue=ue>>>32-16|ue<<16,V=V+ue|0,S^=V,S=S>>>32-12|S<<12,I=I+R|0,re^=I,re=re>>>32-16|re<<16,k=k+re|0,R^=k,R=R>>>32-12|R<<12,N=N+J|0,Y^=N,Y=Y>>>32-16|Y<<16,K=K+Y|0,J^=K,J=J>>>32-12|J<<12,I=I+R|0,re^=I,re=re>>>32-8|re<<8,k=k+re|0,R^=k,R=R>>>32-7|R<<7,N=N+J|0,Y^=N,Y=Y>>>32-8|Y<<8,K=K+Y|0,J^=K,J=J>>>32-7|J<<7,A=A+S|0,ue^=A,ue=ue>>>32-8|ue<<8,V=V+ue|0,S^=V,S=S>>>32-7|S<<7,U=U+_|0,pe^=U,pe=pe>>>32-8|pe<<8,Q=Q+pe|0,_^=Q,_=_>>>32-7|_<<7,U=U+S|0,Y^=U,Y=Y>>>32-16|Y<<16,k=k+Y|0,S^=k,S=S>>>32-12|S<<12,A=A+R|0,pe^=A,pe=pe>>>32-16|pe<<16,K=K+pe|0,R^=K,R=R>>>32-12|R<<12,I=I+J|0,ue^=I,ue=ue>>>32-16|ue<<16,Q=Q+ue|0,J^=Q,J=J>>>32-12|J<<12,N=N+_|0,re^=N,re=re>>>32-16|re<<16,V=V+re|0,_^=V,_=_>>>32-12|_<<12,I=I+J|0,ue^=I,ue=ue>>>32-8|ue<<8,Q=Q+ue|0,J^=Q,J=J>>>32-7|J<<7,N=N+_|0,re^=N,re=re>>>32-8|re<<8,V=V+re|0,_^=V,_=_>>>32-7|_<<7,A=A+R|0,pe^=A,pe=pe>>>32-8|pe<<8,K=K+pe|0,R^=K,R=R>>>32-7|R<<7,U=U+S|0,Y^=U,Y=Y>>>32-8|Y<<8,k=k+Y|0,S^=k,S=S>>>32-7|S<<7;Xt.writeUint32LE(U+n|0,t,0),Xt.writeUint32LE(A+i|0,t,4),Xt.writeUint32LE(I+s|0,t,8),Xt.writeUint32LE(N+o|0,t,12),Xt.writeUint32LE(_+a|0,t,16),Xt.writeUint32LE(S+u|0,t,20),Xt.writeUint32LE(R+l|0,t,24),Xt.writeUint32LE(J+f|0,t,28),Xt.writeUint32LE(Q+d|0,t,32),Xt.writeUint32LE(V+g|0,t,36),Xt.writeUint32LE(k+w|0,t,40),Xt.writeUint32LE(K+E|0,t,44),Xt.writeUint32LE(pe+T|0,t,48),Xt.writeUint32LE(ue+D|0,t,52),Xt.writeUint32LE(re+B|0,t,56),Xt.writeUint32LE(Y+W|0,t,60)}function YD(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var gp=m(Va=>{"use strict";c();Object.defineProperty(Va,"__esModule",{value:!0});function hW(t,e,r){return~(t-1)&e|t-1&r}Va.select=hW;function dW(t,e){return(t|0)-(e|0)-1>>>31&1}Va.lessOrEqual=dW;function XD(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}Va.compare=XD;function pW(t,e){return t.length===0||e.length===0?!1:XD(t,e)!==0}Va.equal=pW});var eP=m(ei=>{"use strict";c();Object.defineProperty(ei,"__esModule",{value:!0});var gW=gp(),yp=qr();ei.DIGEST_LENGTH=16;var ZD=function(){function t(e){this.digestLength=ei.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(u>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],l=this._h[4],f=this._h[5],d=this._h[6],g=this._h[7],w=this._h[8],E=this._h[9],T=this._r[0],D=this._r[1],B=this._r[2],W=this._r[3],U=this._r[4],A=this._r[5],I=this._r[6],N=this._r[7],_=this._r[8],S=this._r[9];n>=16;){var R=e[r+0]|e[r+1]<<8;s+=R&8191;var J=e[r+2]|e[r+3]<<8;o+=(R>>>13|J<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(J>>>10|Q<<6)&8191;var V=e[r+6]|e[r+7]<<8;u+=(Q>>>7|V<<9)&8191;var k=e[r+8]|e[r+9]<<8;l+=(V>>>4|k<<12)&8191,f+=k>>>1&8191;var K=e[r+10]|e[r+11]<<8;d+=(k>>>14|K<<2)&8191;var pe=e[r+12]|e[r+13]<<8;g+=(K>>>11|pe<<5)&8191;var ue=e[r+14]|e[r+15]<<8;w+=(pe>>>8|ue<<8)&8191,E+=ue>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*S),Y+=a*(5*_),Y+=u*(5*N),Y+=l*(5*I),re=Y>>>13,Y&=8191,Y+=f*(5*A),Y+=d*(5*U),Y+=g*(5*W),Y+=w*(5*B),Y+=E*(5*D),re+=Y>>>13,Y&=8191;var se=re;se+=s*D,se+=o*T,se+=a*(5*S),se+=u*(5*_),se+=l*(5*N),re=se>>>13,se&=8191,se+=f*(5*I),se+=d*(5*A),se+=g*(5*U),se+=w*(5*W),se+=E*(5*B),re+=se>>>13,se&=8191;var te=re;te+=s*B,te+=o*D,te+=a*T,te+=u*(5*S),te+=l*(5*_),re=te>>>13,te&=8191,te+=f*(5*N),te+=d*(5*I),te+=g*(5*A),te+=w*(5*U),te+=E*(5*W),re+=te>>>13,te&=8191;var ie=re;ie+=s*W,ie+=o*B,ie+=a*D,ie+=u*T,ie+=l*(5*S),re=ie>>>13,ie&=8191,ie+=f*(5*_),ie+=d*(5*N),ie+=g*(5*I),ie+=w*(5*A),ie+=E*(5*U),re+=ie>>>13,ie&=8191;var M=re;M+=s*U,M+=o*W,M+=a*B,M+=u*D,M+=l*T,re=M>>>13,M&=8191,M+=f*(5*S),M+=d*(5*_),M+=g*(5*N),M+=w*(5*I),M+=E*(5*A),re+=M>>>13,M&=8191;var le=re;le+=s*A,le+=o*U,le+=a*W,le+=u*B,le+=l*D,re=le>>>13,le&=8191,le+=f*T,le+=d*(5*S),le+=g*(5*_),le+=w*(5*N),le+=E*(5*I),re+=le>>>13,le&=8191;var ae=re;ae+=s*I,ae+=o*A,ae+=a*U,ae+=u*W,ae+=l*B,re=ae>>>13,ae&=8191,ae+=f*D,ae+=d*T,ae+=g*(5*S),ae+=w*(5*_),ae+=E*(5*N),re+=ae>>>13,ae&=8191;var fe=re;fe+=s*N,fe+=o*I,fe+=a*A,fe+=u*U,fe+=l*W,re=fe>>>13,fe&=8191,fe+=f*B,fe+=d*D,fe+=g*T,fe+=w*(5*S),fe+=E*(5*_),re+=fe>>>13,fe&=8191;var oe=re;oe+=s*_,oe+=o*N,oe+=a*I,oe+=u*A,oe+=l*U,re=oe>>>13,oe&=8191,oe+=f*W,oe+=d*B,oe+=g*D,oe+=w*T,oe+=E*(5*S),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*S,ce+=o*_,ce+=a*N,ce+=u*I,ce+=l*A,re=ce>>>13,ce&=8191,ce+=f*U,ce+=d*W,ce+=g*B,ce+=w*D,ce+=E*T,re+=ce>>>13,ce&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,se+=re,s=Y,o=se,a=te,u=ie,l=M,f=le,d=ae,g=fe,w=oe,E=ce,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=l,this._h[5]=f,this._h[6]=d,this._h[7]=g,this._h[8]=w,this._h[9]=E},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";c();Object.defineProperty(ti,"__esModule",{value:!0});var mp=JD(),wW=eP(),Xc=qr(),tP=Ca(),EW=gp();ti.KEY_LENGTH=32;ti.NONCE_LENGTH=12;ti.TAG_LENGTH=16;var rP=new Uint8Array(16),vW=function(){function t(e){if(this.nonceLength=ti.NONCE_LENGTH,this.tagLength=ti.TAG_LENGTH,e.length!==ti.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);mp.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return mp.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),Xc.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(rP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(rP.subarray(n.length%16));var o=new Uint8Array(8);i&&tP.writeUint64LE(i.length,o),s.update(o),tP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";c();Object.defineProperty(rA,"__esModule",{value:!0});function AW(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}rA.isSerializableHash=AW});var oP=m(Zc=>{"use strict";c();Object.defineProperty(Zc,"__esModule",{value:!0});var Tn=iP(),bW=gp(),_W=qr(),sP=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";c();Object.defineProperty(nA,"__esModule",{value:!0});var aP=oP(),uP=qr(),SW=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=aP.hmac(this._hash,n,r);this._hmac=new aP.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";c();Object.defineProperty(Hi,"__esModule",{value:!0});var Ep=Ca(),wp=qr();Hi.DIGEST_LENGTH=32;Hi.BLOCK_SIZE=64;var lP=function(){function t(){this.digestLength=Hi.DIGEST_LENGTH,this.blockSize=Hi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){wp.wipe(this._buffer),wp.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(iA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=iA(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){wp.wipe(e.state),e.buffer&&wp.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Hi.SHA256=lP;var TW=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function iA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],l=e[4],f=e[5],d=e[6],g=e[7],w=0;w<16;w++){var E=n+w*4;t[w]=Ep.readUint32BE(r,E)}for(var w=16;w<64;w++){var T=t[w-2],D=(T>>>17|T<<32-17)^(T>>>19|T<<32-19)^T>>>10;T=t[w-15];var B=(T>>>7|T<<32-7)^(T>>>18|T<<32-18)^T>>>3;t[w]=(D+t[w-7]|0)+(B+t[w-16]|0)}for(var w=0;w<64;w++){var D=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&f^~l&d)|0)+(g+(TW[w]+t[w]|0)|0)|0,B=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;g=d,d=f,f=l,l=u+D|0,u=a,a=o,o=s,s=D+B|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=l,e[5]+=f,e[6]+=d,e[7]+=g,n+=64,i-=64}return n}function CW(t){var e=new lP;e.update(t);var r=e.digest();return e.clean(),r}Hi.hash=CW});var gP=m(gt=>{"use strict";c();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var xW=Vc(),NW=qr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.SHARED_KEY_LENGTH=32;function Cn(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,el(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function PW(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function vp(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function Ap(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function ri(t,e,r){let n,i,s=0,o=0,a=0,u=0,l=0,f=0,d=0,g=0,w=0,E=0,T=0,D=0,B=0,W=0,U=0,A=0,I=0,N=0,_=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,pe=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],fe=r[5],oe=r[6],ce=r[7],y=r[8],v=r[9],b=r[10],P=r[11],C=r[12],O=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,l+=n*ae,f+=n*fe,d+=n*oe,g+=n*ce,w+=n*y,E+=n*v,T+=n*b,D+=n*P,B+=n*C,W+=n*O,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,l+=n*le,f+=n*ae,d+=n*fe,g+=n*oe,w+=n*ce,E+=n*y,T+=n*v,D+=n*b,B+=n*P,W+=n*C,U+=n*O,A+=n*L,I+=n*x,n=e[2],a+=n*te,u+=n*ie,l+=n*M,f+=n*le,d+=n*ae,g+=n*fe,w+=n*oe,E+=n*ce,T+=n*y,D+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*O,I+=n*L,N+=n*x,n=e[3],u+=n*te,l+=n*ie,f+=n*M,d+=n*le,g+=n*ae,w+=n*fe,E+=n*oe,T+=n*ce,D+=n*y,B+=n*v,W+=n*b,U+=n*P,A+=n*C,I+=n*O,N+=n*L,_+=n*x,n=e[4],l+=n*te,f+=n*ie,d+=n*M,g+=n*le,w+=n*ae,E+=n*fe,T+=n*oe,D+=n*ce,B+=n*y,W+=n*v,U+=n*b,A+=n*P,I+=n*C,N+=n*O,_+=n*L,S+=n*x,n=e[5],f+=n*te,d+=n*ie,g+=n*M,w+=n*le,E+=n*ae,T+=n*fe,D+=n*oe,B+=n*ce,W+=n*y,U+=n*v,A+=n*b,I+=n*P,N+=n*C,_+=n*O,S+=n*L,R+=n*x,n=e[6],d+=n*te,g+=n*ie,w+=n*M,E+=n*le,T+=n*ae,D+=n*fe,B+=n*oe,W+=n*ce,U+=n*y,A+=n*v,I+=n*b,N+=n*P,_+=n*C,S+=n*O,R+=n*L,J+=n*x,n=e[7],g+=n*te,w+=n*ie,E+=n*M,T+=n*le,D+=n*ae,B+=n*fe,W+=n*oe,U+=n*ce,A+=n*y,I+=n*v,N+=n*b,_+=n*P,S+=n*C,R+=n*O,J+=n*L,Q+=n*x,n=e[8],w+=n*te,E+=n*ie,T+=n*M,D+=n*le,B+=n*ae,W+=n*fe,U+=n*oe,A+=n*ce,I+=n*y,N+=n*v,_+=n*b,S+=n*P,R+=n*C,J+=n*O,Q+=n*L,V+=n*x,n=e[9],E+=n*te,T+=n*ie,D+=n*M,B+=n*le,W+=n*ae,U+=n*fe,A+=n*oe,I+=n*ce,N+=n*y,_+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*O,V+=n*L,k+=n*x,n=e[10],T+=n*te,D+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*fe,I+=n*oe,N+=n*ce,_+=n*y,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*O,k+=n*L,K+=n*x,n=e[11],D+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,I+=n*fe,N+=n*oe,_+=n*ce,S+=n*y,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*O,K+=n*L,pe+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,I+=n*ae,N+=n*fe,_+=n*oe,S+=n*ce,R+=n*y,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*O,pe+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,I+=n*le,N+=n*ae,_+=n*fe,S+=n*oe,R+=n*ce,J+=n*y,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,pe+=n*O,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,I+=n*M,N+=n*le,_+=n*ae,S+=n*fe,R+=n*oe,J+=n*ce,Q+=n*y,V+=n*v,k+=n*b,K+=n*P,pe+=n*C,ue+=n*O,re+=n*L,Y+=n*x,n=e[15],A+=n*te,I+=n*ie,N+=n*M,_+=n*le,S+=n*ae,R+=n*fe,J+=n*oe,Q+=n*ce,V+=n*y,k+=n*v,K+=n*b,pe+=n*P,ue+=n*C,re+=n*O,Y+=n*L,se+=n*x,s+=38*I,o+=38*N,a+=38*_,u+=38*S,l+=38*R,f+=38*J,d+=38*Q,g+=38*V,w+=38*k,E+=38*K,T+=38*pe,D+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=D+i+65535,i=Math.floor(n/65536),D=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=l,t[5]=f,t[6]=d,t[7]=g,t[8]=w,t[9]=E,t[10]=T,t[11]=D,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function tl(t,e){ri(t,e,e)}function RW(t,e){let r=Cn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)tl(r,r),n!==2&&n!==4&&ri(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function oA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Cn(),s=Cn(),o=Cn(),a=Cn(),u=Cn(),l=Cn();for(let w=0;w<31;w++)r[w]=t[w];r[31]=t[31]&127|64,r[0]&=248,PW(n,e);for(let w=0;w<16;w++)s[w]=n[w];i[0]=a[0]=1;for(let w=254;w>=0;--w){let E=r[w>>>3]>>>(w&7)&1;el(i,s,E),el(o,a,E),vp(u,i,o),Ap(i,i,o),vp(o,s,a),Ap(s,s,a),tl(a,u),tl(l,i),ri(i,o,i),ri(o,s,u),vp(u,i,o),Ap(i,i,o),tl(s,i),Ap(o,a,l),ri(i,o,OW),vp(i,i,a),ri(o,o,i),ri(i,a,l),ri(a,s,n),tl(s,u),el(i,s,E),el(o,a,E)}for(let w=0;w<16;w++)n[w+16]=i[w],n[w+32]=o[w],n[w+48]=s[w],n[w+64]=a[w];let f=n.subarray(32),d=n.subarray(16);RW(f,f),ri(d,d,f);let g=new Uint8Array(32);return DW(g,d),g}gt.scalarMult=oA;function dP(t){return oA(t,hP)}gt.scalarMultBase=dP;function pP(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:dP(e),secretKey:e}}gt.generateKeyPairFromSeed=pP;function BW(t){let e=(0,xW.randomBytes)(32,t),r=pP(e);return(0,NW.wipe)(e),r}gt.generateKeyPair=BW;function LW(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=oA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{c()});function wP(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{c()});function vP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Ra(t.length);for(let n=0;n{c();op();jc()});var aA={};ft(aA,{compare:()=>yP,concat:()=>ap,equals:()=>wP,fromString:()=>Sn,toString:()=>Zn,xor:()=>vP});var uA=ge(()=>{c();mP();A1();EP();z1();$1();AP()});var RP=m(st=>{"use strict";c();var bP=st&&st.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new NP:typeof navigator<"u"?cA(navigator.userAgent):PP()}st.detect=qW;function OP(t){return t!==""&&UW.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function VW(t){var e=OP(t);return e?e[0]:null}st.browserName=VW;function cA(t){var e=OP(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new xP;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length<_P&&(i=bP(bP([],i,!0),HW(_P-i.length),!0)):i=[];var s=i.join("."),o=DP(t),a=MW.exec(t);return a&&a[1]?new CP(r,s,o,a[1]):new SP(r,s,o)}st.parseUserAgent=cA;function DP(t){for(var e=0,r=IP.length;e{"use strict";c();Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getLocalStorage=Ye.getLocalStorageOrThrow=Ye.getCrypto=Ye.getCryptoOrThrow=Ye.getLocation=Ye.getLocationOrThrow=Ye.getNavigator=Ye.getNavigatorOrThrow=Ye.getDocument=Ye.getDocumentOrThrow=Ye.getFromWindowOrThrow=Ye.getFromWindow=void 0;function Ks(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=Ks;function Ha(t){let e=Ks(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=Ha;function GW(){return Ha("document")}Ye.getDocumentOrThrow=GW;function kW(){return Ks("document")}Ye.getDocument=kW;function jW(){return Ha("navigator")}Ye.getNavigatorOrThrow=jW;function QW(){return Ks("navigator")}Ye.getNavigator=QW;function WW(){return Ha("location")}Ye.getLocationOrThrow=WW;function $W(){return Ks("location")}Ye.getLocation=$W;function zW(){return Ha("crypto")}Ye.getCryptoOrThrow=zW;function KW(){return Ks("crypto")}Ye.getCrypto=KW;function YW(){return Ha("localStorage")}Ye.getLocalStorageOrThrow=YW;function JW(){return Ks("localStorage")}Ye.getLocalStorage=JW});var LP=m(bp=>{"use strict";c();Object.defineProperty(bp,"__esModule",{value:!0});bp.getWindowMetadata=void 0;var BP=lA();function XW(){let t,e;try{t=BP.getDocumentOrThrow(),e=BP.getLocationOrThrow()}catch{return null}function r(){let d=t.getElementsByTagName("link"),g=[];for(let w=0;w-1){let D=E.getAttribute("href");if(D)if(D.toLowerCase().indexOf("https:")===-1&&D.toLowerCase().indexOf("http:")===-1&&D.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(D.indexOf("/")===0)B+=D;else{let W=e.pathname.split("/");W.pop();let U=W.join("/");B+=U+"/"+D}g.push(B)}else if(D.indexOf("//")===0){let B=e.protocol+D;g.push(B)}else g.push(D)}}return g}function n(...d){let g=t.getElementsByTagName("meta");for(let w=0;wE.getAttribute(D)).filter(D=>D?d.includes(D):!1);if(T.length&&T){let D=E.getAttribute("content");if(D)return D}}return""}function i(){let d=n("name","og:site_name","og:title","twitter:title");return d||(d=t.title),d}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,l=r();return{description:a,url:u,icons:l,name:o}}bp.getWindowMetadata=XW});var MP=m(($de,FP)=>{"use strict";c();FP.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var GP=m((Kde,HP)=>{"use strict";c();var VP="%[a-f0-9]{2}",UP=new RegExp("("+VP+")|([^%]+?)","gi"),qP=new RegExp("("+VP+")+","gi");function fA(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],fA(r),fA(n))}function ZW(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(UP)||[],r=1;r{"use strict";c();kP.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var WP=m((Zde,QP)=>{"use strict";c();QP.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";c();var t$=MP(),r$=GP(),zP=jP(),n$=WP(),i$=t=>t==null,hA=Symbol("encodeFragmentIdentifier");function s$(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[",i,"]"].join("")]:[...r,[vt(e,t),"[",vt(i,t),"]=",vt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[]"].join("")]:[...r,[vt(e,t),"[]=",vt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),":list="].join("")]:[...r,[vt(e,t),":list=",vt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[vt(r,t),e,vt(i,t)].join("")]:[[n,vt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,vt(e,t)]:[...r,[vt(e,t),"=",vt(n,t)].join("")]}}function o$(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&ni(n,t).includes(t.arrayFormatSeparator);n=o?ni(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>ni(u,t)):n===null?n:ni(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&ni(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>ni(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function KP(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function vt(t,e){return e.encode?e.strict?t$(t):encodeURIComponent(t):t}function ni(t,e){return e.decode?r$(t):t}function YP(t){return Array.isArray(t)?t.sort():typeof t=="object"?YP(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function JP(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function a$(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function XP(t){t=JP(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function $P(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function ZP(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),KP(e.arrayFormatSeparator);let r=o$(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=zP(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:ni(o,e),r(ni(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=$P(s[o],e);else n[i]=$P(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=YP(o):i[s]=o,i},Object.create(null))}pr.extract=XP;pr.parse=ZP;pr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),KP(e.arrayFormatSeparator);let r=o=>e.skipNull&&i$(t[o])||e.skipEmptyString&&t[o]==="",n=s$(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?vt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?vt(o,e)+"[]":a.reduce(n(o),[]).join("&"):vt(o,e)+"="+vt(a,e)}).filter(o=>o.length>0).join("&")};pr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=zP(t,"#");return Object.assign({url:r.split("?")[0]||"",query:ZP(XP(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ni(n,e)}:{})};pr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[hA]:!0},e);let r=JP(t.url).split("?")[0]||"",n=pr.extract(t.url),i=pr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=pr.stringify(s,e);o&&(o=`?${o}`);let a=a$(t.url);return t.fragmentIdentifier&&(a=`#${e[hA]?vt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};pr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[hA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=pr.parseUrl(t,r);return pr.stringifyUrl({url:n,query:n$(i,e),fragmentIdentifier:s},r)};pr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return pr.pick(t,n,r)}});var t3=ge(()=>{c()});function Gi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function u$(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function c$(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function l$(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function rl(t,e,r){return(!r.length?c$(t,e.length):l$(t,e.length))?u$(t,e):!1}function nl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var dA=ge(()=>{c()});function f$(t){return _p(t.method)&&Ip(t.params)}function _p(t){return nl(t,"subscribe")}function Ip(t){return rl(t,["topic"],[])}function h$(t){return Sp(t.method)&&Tp(t.params)}function Sp(t){return nl(t,"publish")}function Tp(t){return rl(t,["message","topic","ttl"],["prompt","tag"])}function d$(t){return Cp(t.method)&&xp(t.params)}function Cp(t){return nl(t,"unsubscribe")}function xp(t){return rl(t,["id","topic"],[])}function p$(t){return Np(t.method)&&Op(t.params)}function Np(t){return nl(t,"subscription")}function Op(t){return rl(t,["id","data"],[])}var pA=ge(()=>{c();dA()});function g$(t){if(!_p(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Ip(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return Gi(e,"topic"),e}function y$(t){if(!Sp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Tp(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return Gi(e,"topic"),Gi(e,"message"),Gi(e,"ttl","number"),e}function m$(t){if(!Cp(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!xp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return Gi(e,"id"),e}function w$(t){if(!Np(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Op(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return Gi(e,"id"),Gi(e,"data"),e}var r3=ge(()=>{c();dA();pA()});var E$,n3=ge(()=>{c();E$={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var i3={};ft(i3,{RELAY_JSONRPC:()=>E$,isPublishMethod:()=>Sp,isPublishParams:()=>Tp,isPublishRequest:()=>h$,isSubscribeMethod:()=>_p,isSubscribeParams:()=>Ip,isSubscribeRequest:()=>f$,isSubscriptionMethod:()=>Np,isSubscriptionParams:()=>Op,isSubscriptionRequest:()=>p$,isUnsubscribeMethod:()=>Cp,isUnsubscribeParams:()=>xp,isUnsubscribeRequest:()=>d$,parsePublishRequest:()=>y$,parseSubscribeRequest:()=>g$,parseSubscriptionRequest:()=>w$,parseUnsubscribeRequest:()=>m$});var s3=ge(()=>{c();t3();r3();n3();pA()});var cl=m(G=>{"use strict";c();Object.defineProperty(G,"__esModule",{value:!0});var g3=nP(),v$=cP(),y3=Vc(),vA=fP(),A$=gP(),ot=(uA(),ct(aA)),b$=RP(),Ga=ks(),il=lA(),_$=LP(),I$=e3(),S$=(s3(),ct(i3));function m3(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var w3=m3(A$),Dp=m3(I$),Bp=":";function E3(t){let[e,r]=t.split(Bp);return{namespace:e,reference:r}}function v3(t){let{namespace:e,reference:r}=t;return[e,r].join(Bp)}function AA(t){let[e,r,n]=t.split(Bp);return{namespace:e,reference:r,address:n}}function A3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Bp)}function bA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function b3(t){let{address:e}=AA(t);return e}function _3(t){let{namespace:e,reference:r}=AA(t);return v3({namespace:e,reference:r})}function T$(t,e){let{namespace:r,reference:n}=E3(e);return A3({namespace:r,reference:n,address:t})}function C$(t){return bA(t,b3)}function I3(t){return bA(t,_3)}function x$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function N$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...I3(i.accounts))}),r}function O$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Lp(n,i))}),r}function Lp(t,e){return t.includes(":")?[t]:e.chains||[]}var Fp=t=>t?.split(":"),S3=t=>{let e=t&&Fp(t);if(e)return e[3]},D$=t=>{let e=t&&Fp(t);if(e)return e[2]+":"+e[3]},T3=t=>{let e=t&&Fp(t);if(e)return e.pop()},P$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=T3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${S3(e)}`,u=`Nonce: ${t.nonce}`,l=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: -${t.resources.map(d=>`- ${d}`).join(` -`)}`:void 0;return[r,n,"",i,"",s,o,a,u,l,f].filter(d=>d!=null).join(` -`)},_A="base10",rr="base16",Pp="base64pad",Mp="utf8",IA=0,ka=1,R$=0,o3=1,yA=12,SA=32;function B$(){let t=w3.generateKeyPair();return{privateKey:ot.toString(t.secretKey,rr),publicKey:ot.toString(t.publicKey,rr)}}function L$(){let t=y3.randomBytes(SA);return ot.toString(t,rr)}function F$(t,e){let r=w3.sharedKey(ot.fromString(t,rr),ot.fromString(e,rr),!0),n=new v$.HKDF(vA.SHA256,r).expand(SA);return ot.toString(n,rr)}function M$(t){let e=vA.hash(ot.fromString(t,rr));return ot.toString(e,rr)}function U$(t){let e=vA.hash(ot.fromString(t,Mp));return ot.toString(e,rr)}function C3(t){return ot.fromString(`${t}`,_A)}function ol(t){return Number(ot.toString(t,_A))}function q$(t){let e=C3(typeof t.type<"u"?t.type:IA);if(ol(e)===ka&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,rr):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,rr):y3.randomBytes(yA),i=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)).seal(n,ot.fromString(t.message,Mp));return x3({type:e,sealed:i,iv:n,senderPublicKey:r})}function V$(t){let e=new g3.ChaCha20Poly1305(ot.fromString(t.symKey,rr)),{sealed:r,iv:n}=TA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Mp)}function x3(t){if(ol(t.type)===ka){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Pp)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Pp)}function TA(t){let e=ot.fromString(t,Pp),r=e.slice(R$,o3),n=o3;if(ol(r)===ka){let a=n+SA,u=a+yA,l=e.slice(n,a),f=e.slice(a,u),d=e.slice(u);return{type:r,sealed:d,iv:f,senderPublicKey:l}}let i=n+yA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function H$(t,e){let r=TA(t);return N3({type:ol(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,rr):void 0,receiverPublicKey:e?.receiverPublicKey})}function N3(t){let e=t?.type||IA;if(e===ka){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function G$(t){return t.type===ka&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var k$=Object.defineProperty,a3=Object.getOwnPropertySymbols,j$=Object.prototype.hasOwnProperty,Q$=Object.prototype.propertyIsEnumerable,u3=(t,e,r)=>e in t?k$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,c3=(t,e)=>{for(var r in e||(e={}))j$.call(e,r)&&u3(t,r,e[r]);if(a3)for(var r of a3(e))Q$.call(e,r)&&u3(t,r,e[r]);return t},O3="ReactNative",tr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Rp=" ",W$=":",D3="/",CA=2,$$=1e3,P3="js";function xA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function al(){return!il.getDocument()&&!!il.getNavigator()&&navigator.product===O3}function Up(){return!xA()&&!!il.getNavigator()}function Js(){return al()?tr.reactNative:xA()?tr.node:Up()?tr.browser:tr.unknown}function R3(t,e){let r=Dp.parse(t);return r=c3(c3({},r),e),t=Dp.stringify(r),t}function z$(){return _$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function K$(t,e){var r;let n=Js(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=il.getLocation())==null?void 0:r.host)||"unknown"),i}function B3(){if(Js()===tr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=b$.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function L3(){var t;let e=Js();return e===tr.browser?[e,((t=il.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function F3(t,e,r){let n=B3(),i=L3();return[[t,e].join("-"),[P3,r].join("-"),n,i].join("/")}function Y$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=F3(t,e,n),l={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=R3(a[1]||"",l);return a[0]+"?"+f}function J$(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function X$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function M3(t,e=CA){return U3(t.split(D3),e)}function Z$(t){return M3(t).join(Rp)}function ki(t,e){return t.filter(r=>e.includes(r)).length===t.length}function U3(t,e=CA){return t.slice(Math.max(t.length-e,0))}function ez(t){return Object.fromEntries(t.entries())}function tz(t){return new Map(Object.entries(t))}function rz(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var nz=t=>t;function q3(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function iz(t){return t.split(Rp).map(e=>q3(e)).join(Rp)}function sz(t=Ga.FIVE_MINUTES,e){let r=Ga.toMiliseconds(t||Ga.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function oz(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function NA(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function az(t){return NA("topic",t)}function uz(t){return NA("id",t)}function cz(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function lz(t,e){return Ga.fromMiliseconds((e||Date.now())+Ga.toMiliseconds(t))}function fz(t){return Date.now()>=Ga.toMiliseconds(t)}function hz(t,e){return`${t}${e?`:${e}`:""}`}function ji(t=[],e=[]){return[...new Set([...t,...e])]}async function dz({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=Js();o===tr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===tr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var V3="irn";function pz(t){return t?.relay||{protocol:V3}}function gz(t){let e=S$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var yz=Object.defineProperty,l3=Object.getOwnPropertySymbols,mz=Object.prototype.hasOwnProperty,wz=Object.prototype.propertyIsEnumerable,f3=(t,e,r)=>e in t?yz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ez=(t,e)=>{for(var r in e||(e={}))mz.call(e,r)&&f3(t,r,e[r]);if(l3)for(var r of l3(e))wz.call(e,r)&&f3(t,r,e[r]);return t};function H3(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function vz(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Dp.parse(s);return{protocol:n,topic:G3(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:H3(o)}}function G3(t){return t.startsWith("//")?t.substring(2):t}function k3(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function Az(t){return`${t.protocol}:${t.topic}@${t.version}?`+Dp.stringify(Ez({symKey:t.symKey},k3(t.relay)))}var bz=Object.defineProperty,_z=Object.defineProperties,Iz=Object.getOwnPropertyDescriptors,h3=Object.getOwnPropertySymbols,Sz=Object.prototype.hasOwnProperty,Tz=Object.prototype.propertyIsEnumerable,d3=(t,e,r)=>e in t?bz(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cz=(t,e)=>{for(var r in e||(e={}))Sz.call(e,r)&&d3(t,r,e[r]);if(h3)for(var r of h3(e))Tz.call(e,r)&&d3(t,r,e[r]);return t},xz=(t,e)=>_z(t,Iz(e));function Xs(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function j3(t){let e=[];return Object.values(t).forEach(r=>{e.push(...Xs(r.accounts))}),e}function Q3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.methods)}),r}function W3(t,e){let r=[];return Object.values(t).forEach(n=>{Xs(n.accounts).includes(e)&&r.push(...n.events)}),r}function Nz(t,e){let r=eR(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function Oz(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=mA(e),s=mA(r),o={};Object.keys(n).forEach(l=>{let f=n[l].chains,d=n[l].methods,g=n[l].events,w=n[l].accounts;f.forEach(E=>{if(!w.some(T=>T.includes(E)))throw new Error(`No accounts provided for chain ${E} in namespace ${l}`)}),o[l]={chains:f,methods:d,events:g,accounts:w}});let a=rR(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(l=>{let f=n[l].chains.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.chains)==null?void 0:D.includes(E)}),d=n[l].methods.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.methods)==null?void 0:D.includes(E)}),g=n[l].events.filter(E=>{var T,D;return(D=(T=i[l])==null?void 0:T.events)==null?void 0:D.includes(E)}),w=f.map(E=>n[l].accounts.filter(T=>T.includes(`${E}:`))).flat();u[l]={chains:f,methods:d,events:g,accounts:w}}),Object.keys(s).forEach(l=>{var f,d,g,w,E,T;if(!n[l])return;let D=(d=(f=s[l])==null?void 0:f.chains)==null?void 0:d.filter(A=>n[l].chains.includes(A)),B=n[l].methods.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.methods)==null?void 0:N.includes(A)}),W=n[l].events.filter(A=>{var I,N;return(N=(I=s[l])==null?void 0:I.events)==null?void 0:N.includes(A)}),U=D?.map(A=>n[l].accounts.filter(I=>I.includes(`${A}:`))).flat();u[l]={chains:ji((g=u[l])==null?void 0:g.chains,D),methods:ji((w=u[l])==null?void 0:w.methods,B),events:ji((E=u[l])==null?void 0:E.events,W),accounts:ji((T=u[l])==null?void 0:T.accounts,U)}}),u)}function OA(t){return t.includes(":")}function $3(t){return OA(t)?t.split(":")[0]:t}function mA(t){var e,r,n;let i={};if(!qp(t))return i;for(let[s,o]of Object.entries(t)){let a=OA(s)?[s]:o.chains,u=o.methods||[],l=o.events||[],f=$3(s);i[f]=xz(Cz({},i[f]),{chains:ji(a,(e=i[f])==null?void 0:e.chains),methods:ji(u,(r=i[f])==null?void 0:r.methods),events:ji(l,(n=i[f])==null?void 0:n.events)})}return i}var Dz={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Pz={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ii(t,e){let{message:r,code:n}=Pz[t];return{message:e?`${r} ${e}`:r,code:n}}function Ys(t,e){let{message:r,code:n}=Dz[t];return{message:e?`${r} ${e}`:r,code:n}}function ul(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function qp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Qi(t){return typeof t>"u"}function br(t,e){return e&&Qi(t)?!0:typeof t=="string"&&!!t.trim().length}function Vp(t,e){return e&&Qi(t)?!0:typeof t=="number"&&!isNaN(t)}function Rz(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return ki(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:l}=t.namespaces[o],f=Xs(a),d=r[o];(!ki(Lp(o,d),f)||!ki(d.methods,u)||!ki(d.events,l))&&(s=!1)}),s):!1}function sl(t){return br(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function z3(t){if(br(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&sl(r)}}return!1}function Bz(t){if(br(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function Lz(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function Fz(t){return t?.topic}function Mz(t,e){let r=null;return br(t?.publicKey,!1)||(r=ii("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function wA(t){let e=!0;return ul(t)?t.length&&(e=t.every(r=>br(r,!1))):e=!1,e}function K3(t,e,r){let n=null;return ul(e)&&e.length?e.forEach(i=>{n||sl(i)||(n=Ys("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):sl(t)||(n=Ys("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function Y3(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=K3(i,Lp(i,s),`${e} ${r}`);o&&(n=o)}),n}function J3(t,e){let r=null;return ul(t)?t.forEach(n=>{r||z3(n)||(r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=Ys("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function X3(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=J3(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function Z3(t,e){let r=null;return wA(t?.methods)?wA(t?.events)||(r=Ys("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=Ys("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function DA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=Z3(n,`${e}, namespace`);i&&(r=i)}),r}function Uz(t,e,r){let n=null;if(t&&qp(t)){let i=DA(t,e);i&&(n=i);let s=Y3(t,e,r);s&&(n=s)}else n=ii("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function eR(t,e){let r=null;if(t&&qp(t)){let n=DA(t,e);n&&(r=n);let i=X3(t,e);i&&(r=i)}else r=ii("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function tR(t){return br(t.protocol,!0)}function qz(t,e){let r=!1;return e&&!t?r=!0:t&&ul(t)&&t.length&&t.forEach(n=>{r=tR(n)}),r}function Vz(t){return typeof t=="number"}function Hz(t){return typeof t<"u"&&typeof t!==null}function Gz(t){return!(!t||typeof t!="object"||!t.code||!Vp(t.code,!1)||!t.message||!br(t.message,!1))}function kz(t){return!(Qi(t)||!br(t.method,!1))}function jz(t){return!(Qi(t)||Qi(t.result)&&Qi(t.error)||!Vp(t.id,!1)||!br(t.jsonrpc,!1))}function Qz(t){return!(Qi(t)||!br(t.name,!1))}function Wz(t,e){return!(!sl(e)||!j3(t).includes(e))}function $z(t,e,r){return br(r,!1)?Q3(t,e).includes(r):!1}function zz(t,e,r){return br(r,!1)?W3(t,e).includes(r):!1}function rR(t,e,r){let n=null,i=Kz(t),s=Yz(e),o=Object.keys(i),a=Object.keys(s),u=p3(Object.keys(t)),l=p3(Object.keys(e)),f=u.filter(d=>!l.includes(d));return f.length&&(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. +`});var fP=fe(()=>{l();lP();hp();ji();eA();nl()});var nA,Ide,hP=fe(()=>{l();qD();VD();HD();GD();kD();Q1();jD();$1();QD();zD();rP();sP();oP();aP();fP();nA={...q1,...V1,...H1,...G1,...k1,...j1,...W1,...z1,...K1,...Y1},Ide={...tA,...rA}});function pP(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var dP,iA,WW,yp,sA=fe(()=>{l();hP();cp();dP=pP("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),iA=pP("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=Fa(t.length);for(let r=0;r{l();sA()});function Nn(t,e="utf8"){let r=yp[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ki(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var aA=fe(()=>{l();sA();Zc()});function sl(t){return Vi(ri(Nn(t,Ba),rp))}function ol(t){return ri(Nn(Hi(t),rp),Ba)}function uA(t){let e=Nn(ap,La),r=op+ri(lp([e,t]),La);return[ip,sp,r].join(np)}function cA(t){let[e,r,n]=t.split(np);if(e!==ip||r!==sp)throw new Error('Issuer must be a DID with method "key"');if(n.slice(0,1)!==op)throw new Error("Issuer must be a key in mulicodec format");let s=Nn(n.slice(1),La);if(ri(s.slice(0,2),La)!==ap)throw new Error('Issuer must be a public key with type "Ed25519"');let a=s.slice(2);if(a.length!==32)throw new Error("Issuer must be a public key with length 32 bytes");return a}function gP(t){return ri(t,Ba)}function yP(t){return Nn(t,Ba)}function lA(t){return Nn([ol(t.header),ol(t.payload)].join(Xs),Xc)}function zW(t){let e=ri(t,Xc).split(Xs),r=sl(e[0]),n=sl(e[1]);return{header:r,payload:n}}function fA(t){return[ol(t.header),ol(t.payload),gP(t.signature)].join(Xs)}function hA(t){let e=t.split(Xs),r=sl(e[0]),n=sl(e[1]),i=yP(e[2]),s=Nn(e.slice(0,2).join(Xs),Xc);return{header:r,payload:n,signature:i,data:s}}var dA=fe(()=>{l();B1();oA();aA();kc();up()});function $W(t=(0,mP.randomBytes)(32)){return Ga.generateKeyPairFromSeed(t)}async function KW(t,e,r,n,i=(0,wP.fromMiliseconds)(Date.now())){let s={alg:ep,typ:tp},o=uA(n.publicKey),a=i+r,u={iss:o,sub:t,aud:e,iat:i,exp:a},c=lA({header:s,payload:u}),f=Ga.sign(n.secretKey,c);return fA({header:s,payload:u,signature:f})}async function YW(t){let{header:e,payload:r,data:n,signature:i}=hA(t);if(e.alg!==ep||e.typ!==tp)throw new Error("JWT must use EdDSA algorithm");let s=cA(r.iss);return Ga.verify(s,n,i)}var Ga,mP,wP,EP=fe(()=>{l();Ga=be(ND()),mP=be(Kc()),wP=be($s());up();dA()});var vP=fe(()=>{l()});var AP={};ct(AP,{DATA_ENCODING:()=>Xc,DID_DELIMITER:()=>np,DID_METHOD:()=>sp,DID_PREFIX:()=>ip,JSON_ENCODING:()=>rp,JWT_DELIMITER:()=>Xs,JWT_ENCODING:()=>Ba,JWT_IRIDIUM_ALG:()=>ep,JWT_IRIDIUM_TYP:()=>tp,KEY_PAIR_SEED_LENGTH:()=>DD,MULTICODEC_ED25519_BASE:()=>op,MULTICODEC_ED25519_ENCODING:()=>La,MULTICODEC_ED25519_HEADER:()=>ap,MULTICODEC_ED25519_LENGTH:()=>OD,decodeData:()=>zW,decodeIss:()=>cA,decodeJSON:()=>sl,decodeJWT:()=>hA,decodeSig:()=>yP,encodeData:()=>lA,encodeIss:()=>uA,encodeJSON:()=>ol,encodeJWT:()=>fA,encodeSig:()=>gP,generateKeyPair:()=>$W,signJWT:()=>KW,verifyJWT:()=>YW});var bP=fe(()=>{l();EP();up();vP();dA()});var _P=E(mp=>{"use strict";l();Object.defineProperty(mp,"__esModule",{value:!0});var Zt=Oa(),pA=Hr(),JW=20;function XW(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],c=r[11]<<24|r[10]<<16|r[9]<<8|r[8],f=r[15]<<24|r[14]<<16|r[13]<<8|r[12],h=r[19]<<24|r[18]<<16|r[17]<<8|r[16],g=r[23]<<24|r[22]<<16|r[21]<<8|r[20],y=r[27]<<24|r[26]<<16|r[25]<<8|r[24],m=r[31]<<24|r[30]<<16|r[29]<<8|r[28],T=e[3]<<24|e[2]<<16|e[1]<<8|e[0],O=e[7]<<24|e[6]<<16|e[5]<<8|e[4],B=e[11]<<24|e[10]<<16|e[9]<<8|e[8],W=e[15]<<24|e[14]<<16|e[13]<<8|e[12],U=n,A=i,_=s,N=o,I=a,S=u,R=c,J=f,Q=h,V=g,k=y,K=m,ge=T,ue=O,re=B,Y=W,se=0;se>>16|ge<<16,Q=Q+ge|0,I^=Q,I=I>>>20|I<<12,A=A+S|0,ue^=A,ue=ue>>>16|ue<<16,V=V+ue|0,S^=V,S=S>>>20|S<<12,_=_+R|0,re^=_,re=re>>>16|re<<16,k=k+re|0,R^=k,R=R>>>20|R<<12,N=N+J|0,Y^=N,Y=Y>>>16|Y<<16,K=K+Y|0,J^=K,J=J>>>20|J<<12,_=_+R|0,re^=_,re=re>>>24|re<<8,k=k+re|0,R^=k,R=R>>>25|R<<7,N=N+J|0,Y^=N,Y=Y>>>24|Y<<8,K=K+Y|0,J^=K,J=J>>>25|J<<7,A=A+S|0,ue^=A,ue=ue>>>24|ue<<8,V=V+ue|0,S^=V,S=S>>>25|S<<7,U=U+I|0,ge^=U,ge=ge>>>24|ge<<8,Q=Q+ge|0,I^=Q,I=I>>>25|I<<7,U=U+S|0,Y^=U,Y=Y>>>16|Y<<16,k=k+Y|0,S^=k,S=S>>>20|S<<12,A=A+R|0,ge^=A,ge=ge>>>16|ge<<16,K=K+ge|0,R^=K,R=R>>>20|R<<12,_=_+J|0,ue^=_,ue=ue>>>16|ue<<16,Q=Q+ue|0,J^=Q,J=J>>>20|J<<12,N=N+I|0,re^=N,re=re>>>16|re<<16,V=V+re|0,I^=V,I=I>>>20|I<<12,_=_+J|0,ue^=_,ue=ue>>>24|ue<<8,Q=Q+ue|0,J^=Q,J=J>>>25|J<<7,N=N+I|0,re^=N,re=re>>>24|re<<8,V=V+re|0,I^=V,I=I>>>25|I<<7,A=A+R|0,ge^=A,ge=ge>>>24|ge<<8,K=K+ge|0,R^=K,R=R>>>25|R<<7,U=U+S|0,Y^=U,Y=Y>>>24|Y<<8,k=k+Y|0,S^=k,S=S>>>25|S<<7;Zt.writeUint32LE(U+n|0,t,0),Zt.writeUint32LE(A+i|0,t,4),Zt.writeUint32LE(_+s|0,t,8),Zt.writeUint32LE(N+o|0,t,12),Zt.writeUint32LE(I+a|0,t,16),Zt.writeUint32LE(S+u|0,t,20),Zt.writeUint32LE(R+c|0,t,24),Zt.writeUint32LE(J+f|0,t,28),Zt.writeUint32LE(Q+h|0,t,32),Zt.writeUint32LE(V+g|0,t,36),Zt.writeUint32LE(k+y|0,t,40),Zt.writeUint32LE(K+m|0,t,44),Zt.writeUint32LE(ge+T|0,t,48),Zt.writeUint32LE(ue+O|0,t,52),Zt.writeUint32LE(re+B|0,t,56),Zt.writeUint32LE(Y+W|0,t,60)}function IP(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var wp=E(ka=>{"use strict";l();Object.defineProperty(ka,"__esModule",{value:!0});function tz(t,e,r){return~(t-1)&e|t-1&r}ka.select=tz;function rz(t,e){return(t|0)-(e|0)-1>>>31&1}ka.lessOrEqual=rz;function SP(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n>>8}ka.compare=SP;function nz(t,e){return t.length===0||e.length===0?!1:SP(t,e)!==0}ka.equal=nz});var CP=E(ni=>{"use strict";l();Object.defineProperty(ni,"__esModule",{value:!0});var iz=wp(),Ep=Hr();ni.DIGEST_LENGTH=16;var TP=function(){function t(e){this.digestLength=ni.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var o=e[8]|e[9]<<8;this._r[4]=(s>>>4|o<<12)&255,this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=(o>>>14|a<<2)&8191;var u=e[12]|e[13]<<8;this._r[7]=(a>>>11|u<<5)&8065;var c=e[14]|e[15]<<8;this._r[8]=(u>>>8|c<<8)&8191,this._r[9]=c>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],c=this._h[4],f=this._h[5],h=this._h[6],g=this._h[7],y=this._h[8],m=this._h[9],T=this._r[0],O=this._r[1],B=this._r[2],W=this._r[3],U=this._r[4],A=this._r[5],_=this._r[6],N=this._r[7],I=this._r[8],S=this._r[9];n>=16;){var R=e[r+0]|e[r+1]<<8;s+=R&8191;var J=e[r+2]|e[r+3]<<8;o+=(R>>>13|J<<3)&8191;var Q=e[r+4]|e[r+5]<<8;a+=(J>>>10|Q<<6)&8191;var V=e[r+6]|e[r+7]<<8;u+=(Q>>>7|V<<9)&8191;var k=e[r+8]|e[r+9]<<8;c+=(V>>>4|k<<12)&8191,f+=k>>>1&8191;var K=e[r+10]|e[r+11]<<8;h+=(k>>>14|K<<2)&8191;var ge=e[r+12]|e[r+13]<<8;g+=(K>>>11|ge<<5)&8191;var ue=e[r+14]|e[r+15]<<8;y+=(ge>>>8|ue<<8)&8191,m+=ue>>>5|i;var re=0,Y=re;Y+=s*T,Y+=o*(5*S),Y+=a*(5*I),Y+=u*(5*N),Y+=c*(5*_),re=Y>>>13,Y&=8191,Y+=f*(5*A),Y+=h*(5*U),Y+=g*(5*W),Y+=y*(5*B),Y+=m*(5*O),re+=Y>>>13,Y&=8191;var se=re;se+=s*O,se+=o*T,se+=a*(5*S),se+=u*(5*I),se+=c*(5*N),re=se>>>13,se&=8191,se+=f*(5*_),se+=h*(5*A),se+=g*(5*U),se+=y*(5*W),se+=m*(5*B),re+=se>>>13,se&=8191;var te=re;te+=s*B,te+=o*O,te+=a*T,te+=u*(5*S),te+=c*(5*I),re=te>>>13,te&=8191,te+=f*(5*N),te+=h*(5*_),te+=g*(5*A),te+=y*(5*U),te+=m*(5*W),re+=te>>>13,te&=8191;var ie=re;ie+=s*W,ie+=o*B,ie+=a*O,ie+=u*T,ie+=c*(5*S),re=ie>>>13,ie&=8191,ie+=f*(5*I),ie+=h*(5*N),ie+=g*(5*_),ie+=y*(5*A),ie+=m*(5*U),re+=ie>>>13,ie&=8191;var M=re;M+=s*U,M+=o*W,M+=a*B,M+=u*O,M+=c*T,re=M>>>13,M&=8191,M+=f*(5*S),M+=h*(5*I),M+=g*(5*N),M+=y*(5*_),M+=m*(5*A),re+=M>>>13,M&=8191;var le=re;le+=s*A,le+=o*U,le+=a*W,le+=u*B,le+=c*O,re=le>>>13,le&=8191,le+=f*T,le+=h*(5*S),le+=g*(5*I),le+=y*(5*N),le+=m*(5*_),re+=le>>>13,le&=8191;var ae=re;ae+=s*_,ae+=o*A,ae+=a*U,ae+=u*W,ae+=c*B,re=ae>>>13,ae&=8191,ae+=f*O,ae+=h*T,ae+=g*(5*S),ae+=y*(5*I),ae+=m*(5*N),re+=ae>>>13,ae&=8191;var he=re;he+=s*N,he+=o*_,he+=a*A,he+=u*U,he+=c*W,re=he>>>13,he&=8191,he+=f*B,he+=h*O,he+=g*T,he+=y*(5*S),he+=m*(5*I),re+=he>>>13,he&=8191;var oe=re;oe+=s*I,oe+=o*N,oe+=a*_,oe+=u*A,oe+=c*U,re=oe>>>13,oe&=8191,oe+=f*W,oe+=h*B,oe+=g*O,oe+=y*T,oe+=m*(5*S),re+=oe>>>13,oe&=8191;var ce=re;ce+=s*S,ce+=o*I,ce+=a*N,ce+=u*_,ce+=c*A,re=ce>>>13,ce&=8191,ce+=f*U,ce+=h*W,ce+=g*B,ce+=y*O,ce+=m*T,re+=ce>>>13,ce&=8191,re=(re<<2)+re|0,re=re+Y|0,Y=re&8191,re=re>>>13,se+=re,s=Y,o=se,a=te,u=ie,c=M,f=le,h=ae,g=he,y=oe,m=ce,r+=16,n-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=c,this._h[5]=f,this._h[6]=h,this._h[7]=g,this._h[8]=y,this._h[9]=m},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,o,a;if(this._leftover){for(a=this._leftover,this._buffer[a++]=1;a<16;a++)this._buffer[a]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=i,i=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,a=1;a<10;a++)n[a]=this._h[a]+i,i=n[a]>>>13,n[a]&=8191;for(n[9]-=8192,s=(i^1)-1,a=0;a<10;a++)n[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|n[a];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,o=this._h[0]+this._pad[0],this._h[0]=o&65535,a=1;a<8;a++)o=(this._h[a]+this._pad[a]|0)+(o>>>16)|0,this._h[a]=o&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s{"use strict";l();Object.defineProperty(ii,"__esModule",{value:!0});var vp=_P(),az=CP(),al=Hr(),xP=Oa(),uz=wp();ii.KEY_LENGTH=32;ii.NONCE_LENGTH=12;ii.TAG_LENGTH=16;var NP=new Uint8Array(16),cz=function(){function t(e){if(this.nonceLength=ii.NONCE_LENGTH,this.tagLength=ii.TAG_LENGTH,e.length!==ii.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var o=new Uint8Array(32);vp.stream(this._key,s,o,4);var a=r.length+this.tagLength,u;if(i){if(i.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=i}else u=new Uint8Array(a);return vp.streamXOR(this._key,s,r,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),n),al.wipe(s),u},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&s.update(NP.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(NP.subarray(n.length%16));var o=new Uint8Array(8);i&&xP.writeUint64LE(i.length,o),s.update(o),xP.writeUint64LE(n.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";l();Object.defineProperty(gA,"__esModule",{value:!0});function lz(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}gA.isSerializableHash=lz});var RP=E(ul=>{"use strict";l();Object.defineProperty(ul,"__esModule",{value:!0});var On=DP(),fz=wp(),hz=Hr(),PP=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i{"use strict";l();Object.defineProperty(yA,"__esModule",{value:!0});var BP=RP(),LP=Hr(),pz=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=BP.hmac(this._hash,n,r);this._hmac=new BP.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n{"use strict";l();Object.defineProperty(Wi,"__esModule",{value:!0});var bp=Oa(),Ap=Hr();Wi.DIGEST_LENGTH=32;Wi.BLOCK_SIZE=64;var MP=function(){function t(){this.digestLength=Wi.DIGEST_LENGTH,this.blockSize=Wi.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){Ap.wipe(this._buffer),Ap.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(mA(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=mA(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,o=r%64<56?64:128;this._buffer[n]=128;for(var a=n+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){Ap.wipe(e.state),e.buffer&&Ap.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();Wi.SHA256=MP;var gz=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function mA(t,e,r,n,i){for(;i>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],c=e[4],f=e[5],h=e[6],g=e[7],y=0;y<16;y++){var m=n+y*4;t[y]=bp.readUint32BE(r,m)}for(var y=16;y<64;y++){var T=t[y-2],O=(T>>>17|T<<15)^(T>>>19|T<<13)^T>>>10;T=t[y-15];var B=(T>>>7|T<<25)^(T>>>18|T<<14)^T>>>3;t[y]=(O+t[y-7]|0)+(B+t[y-16]|0)}for(var y=0;y<64;y++){var O=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&f^~c&h)|0)+(g+(gz[y]+t[y]|0)|0)|0,B=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&o^s&a^o&a)|0;g=h,h=f,f=c,c=u+O|0,u=a,a=o,o=s,s=O+B|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=c,e[5]+=f,e[6]+=h,e[7]+=g,n+=64,i-=64}return n}function yz(t){var e=new MP;e.update(t);var r=e.digest();return e.clean(),r}Wi.hash=yz});var GP=E(gt=>{"use strict";l();Object.defineProperty(gt,"__esModule",{value:!0});gt.sharedKey=gt.generateKeyPair=gt.generateKeyPairFromSeed=gt.scalarMultBase=gt.scalarMult=gt.SHARED_KEY_LENGTH=gt.SECRET_KEY_LENGTH=gt.PUBLIC_KEY_LENGTH=void 0;var mz=Kc(),wz=Hr();gt.PUBLIC_KEY_LENGTH=32;gt.SECRET_KEY_LENGTH=32;gt.SHARED_KEY_LENGTH=32;function Dn(t){let e=new Float64Array(16);if(t)for(let r=0;r>16&1),r[o-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);let s=r[15]>>16&1;r[14]&=65535,cl(n,r,1-s)}for(let i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function Az(t,e){for(let r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function Ip(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]+r[n]}function _p(t,e,r){for(let n=0;n<16;n++)t[n]=e[n]-r[n]}function si(t,e,r){let n,i,s=0,o=0,a=0,u=0,c=0,f=0,h=0,g=0,y=0,m=0,T=0,O=0,B=0,W=0,U=0,A=0,_=0,N=0,I=0,S=0,R=0,J=0,Q=0,V=0,k=0,K=0,ge=0,ue=0,re=0,Y=0,se=0,te=r[0],ie=r[1],M=r[2],le=r[3],ae=r[4],he=r[5],oe=r[6],ce=r[7],w=r[8],v=r[9],b=r[10],P=r[11],C=r[12],D=r[13],L=r[14],x=r[15];n=e[0],s+=n*te,o+=n*ie,a+=n*M,u+=n*le,c+=n*ae,f+=n*he,h+=n*oe,g+=n*ce,y+=n*w,m+=n*v,T+=n*b,O+=n*P,B+=n*C,W+=n*D,U+=n*L,A+=n*x,n=e[1],o+=n*te,a+=n*ie,u+=n*M,c+=n*le,f+=n*ae,h+=n*he,g+=n*oe,y+=n*ce,m+=n*w,T+=n*v,O+=n*b,B+=n*P,W+=n*C,U+=n*D,A+=n*L,_+=n*x,n=e[2],a+=n*te,u+=n*ie,c+=n*M,f+=n*le,h+=n*ae,g+=n*he,y+=n*oe,m+=n*ce,T+=n*w,O+=n*v,B+=n*b,W+=n*P,U+=n*C,A+=n*D,_+=n*L,N+=n*x,n=e[3],u+=n*te,c+=n*ie,f+=n*M,h+=n*le,g+=n*ae,y+=n*he,m+=n*oe,T+=n*ce,O+=n*w,B+=n*v,W+=n*b,U+=n*P,A+=n*C,_+=n*D,N+=n*L,I+=n*x,n=e[4],c+=n*te,f+=n*ie,h+=n*M,g+=n*le,y+=n*ae,m+=n*he,T+=n*oe,O+=n*ce,B+=n*w,W+=n*v,U+=n*b,A+=n*P,_+=n*C,N+=n*D,I+=n*L,S+=n*x,n=e[5],f+=n*te,h+=n*ie,g+=n*M,y+=n*le,m+=n*ae,T+=n*he,O+=n*oe,B+=n*ce,W+=n*w,U+=n*v,A+=n*b,_+=n*P,N+=n*C,I+=n*D,S+=n*L,R+=n*x,n=e[6],h+=n*te,g+=n*ie,y+=n*M,m+=n*le,T+=n*ae,O+=n*he,B+=n*oe,W+=n*ce,U+=n*w,A+=n*v,_+=n*b,N+=n*P,I+=n*C,S+=n*D,R+=n*L,J+=n*x,n=e[7],g+=n*te,y+=n*ie,m+=n*M,T+=n*le,O+=n*ae,B+=n*he,W+=n*oe,U+=n*ce,A+=n*w,_+=n*v,N+=n*b,I+=n*P,S+=n*C,R+=n*D,J+=n*L,Q+=n*x,n=e[8],y+=n*te,m+=n*ie,T+=n*M,O+=n*le,B+=n*ae,W+=n*he,U+=n*oe,A+=n*ce,_+=n*w,N+=n*v,I+=n*b,S+=n*P,R+=n*C,J+=n*D,Q+=n*L,V+=n*x,n=e[9],m+=n*te,T+=n*ie,O+=n*M,B+=n*le,W+=n*ae,U+=n*he,A+=n*oe,_+=n*ce,N+=n*w,I+=n*v,S+=n*b,R+=n*P,J+=n*C,Q+=n*D,V+=n*L,k+=n*x,n=e[10],T+=n*te,O+=n*ie,B+=n*M,W+=n*le,U+=n*ae,A+=n*he,_+=n*oe,N+=n*ce,I+=n*w,S+=n*v,R+=n*b,J+=n*P,Q+=n*C,V+=n*D,k+=n*L,K+=n*x,n=e[11],O+=n*te,B+=n*ie,W+=n*M,U+=n*le,A+=n*ae,_+=n*he,N+=n*oe,I+=n*ce,S+=n*w,R+=n*v,J+=n*b,Q+=n*P,V+=n*C,k+=n*D,K+=n*L,ge+=n*x,n=e[12],B+=n*te,W+=n*ie,U+=n*M,A+=n*le,_+=n*ae,N+=n*he,I+=n*oe,S+=n*ce,R+=n*w,J+=n*v,Q+=n*b,V+=n*P,k+=n*C,K+=n*D,ge+=n*L,ue+=n*x,n=e[13],W+=n*te,U+=n*ie,A+=n*M,_+=n*le,N+=n*ae,I+=n*he,S+=n*oe,R+=n*ce,J+=n*w,Q+=n*v,V+=n*b,k+=n*P,K+=n*C,ge+=n*D,ue+=n*L,re+=n*x,n=e[14],U+=n*te,A+=n*ie,_+=n*M,N+=n*le,I+=n*ae,S+=n*he,R+=n*oe,J+=n*ce,Q+=n*w,V+=n*v,k+=n*b,K+=n*P,ge+=n*C,ue+=n*D,re+=n*L,Y+=n*x,n=e[15],A+=n*te,_+=n*ie,N+=n*M,I+=n*le,S+=n*ae,R+=n*he,J+=n*oe,Q+=n*ce,V+=n*w,k+=n*v,K+=n*b,ge+=n*P,ue+=n*C,re+=n*D,Y+=n*L,se+=n*x,s+=38*_,o+=38*N,a+=38*I,u+=38*S,c+=38*R,f+=38*J,h+=38*Q,g+=38*V,y+=38*k,m+=38*K,T+=38*ge,O+=38*ue,B+=38*re,W+=38*Y,U+=38*se,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=m+i+65535,i=Math.floor(n/65536),m=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,n=O+i+65535,i=Math.floor(n/65536),O=n-i*65536,n=B+i+65535,i=Math.floor(n/65536),B=n-i*65536,n=W+i+65535,i=Math.floor(n/65536),W=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=o,t[2]=a,t[3]=u,t[4]=c,t[5]=f,t[6]=h,t[7]=g,t[8]=y,t[9]=m,t[10]=T,t[11]=O,t[12]=B,t[13]=W,t[14]=U,t[15]=A}function ll(t,e){si(t,e,e)}function bz(t,e){let r=Dn();for(let n=0;n<16;n++)r[n]=e[n];for(let n=253;n>=0;n--)ll(r,r),n!==2&&n!==4&&si(r,r,e);for(let n=0;n<16;n++)t[n]=r[n]}function EA(t,e){let r=new Uint8Array(32),n=new Float64Array(80),i=Dn(),s=Dn(),o=Dn(),a=Dn(),u=Dn(),c=Dn();for(let y=0;y<31;y++)r[y]=t[y];r[31]=t[31]&127|64,r[0]&=248,Az(n,e);for(let y=0;y<16;y++)s[y]=n[y];i[0]=a[0]=1;for(let y=254;y>=0;--y){let m=r[y>>>3]>>>(y&7)&1;cl(i,s,m),cl(o,a,m),Ip(u,i,o),_p(i,i,o),Ip(o,s,a),_p(s,s,a),ll(a,u),ll(c,i),si(i,o,i),si(o,s,u),Ip(u,i,o),_p(i,i,o),ll(s,i),_p(o,a,c),si(i,o,Ez),Ip(i,i,a),si(o,o,i),si(i,a,c),si(a,s,n),ll(s,u),cl(i,s,m),cl(o,a,m)}for(let y=0;y<16;y++)n[y+16]=i[y],n[y+32]=o[y],n[y+48]=s[y],n[y+64]=a[y];let f=n.subarray(32),h=n.subarray(16);bz(f,f),si(h,h,f);let g=new Uint8Array(32);return vz(g,h),g}gt.scalarMult=EA;function VP(t){return EA(t,qP)}gt.scalarMultBase=VP;function HP(t){if(t.length!==gt.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${gt.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(t);return{publicKey:VP(e),secretKey:e}}gt.generateKeyPairFromSeed=HP;function Iz(t){let e=(0,mz.randomBytes)(32,t),r=HP(e);return(0,wz.wipe)(e),r}gt.generateKeyPair=Iz;function _z(t,e,r=!1){if(t.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==gt.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let n=EA(t,e);if(r){let i=0;for(let s=0;se[r])return 1}return t.byteLength>e.byteLength?1:t.byteLength{l()});function QP(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r{l()});function zP(t,e){if(t.length!==e.length)throw new Error("Inputs should have the same length");let r=Fa(t.length);for(let n=0;n{l();cp();Zc()});var vA={};ct(vA,{compare:()=>kP,concat:()=>lp,equals:()=>QP,fromString:()=>Nn,toString:()=>ri,xor:()=>zP});var AA=fe(()=>{l();jP();B1();WP();aA();oA();$P()});var o3=E(st=>{"use strict";l();var KP=st&&st.__spreadArray||function(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new r3:typeof navigator<"u"?bA(navigator.userAgent):s3()}st.detect=xz;function n3(t){return t!==""&&Cz.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function Nz(t){var e=n3(t);return e?e[0]:null}st.browserName=Nz;function bA(t){var e=n3(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new t3;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length{"use strict";l();Object.defineProperty(Ye,"__esModule",{value:!0});Ye.getLocalStorage=Ye.getLocalStorageOrThrow=Ye.getCrypto=Ye.getCryptoOrThrow=Ye.getLocation=Ye.getLocationOrThrow=Ye.getNavigator=Ye.getNavigatorOrThrow=Ye.getDocument=Ye.getDocumentOrThrow=Ye.getFromWindowOrThrow=Ye.getFromWindow=void 0;function eo(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}Ye.getFromWindow=eo;function ja(t){let e=eo(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}Ye.getFromWindowOrThrow=ja;function Dz(){return ja("document")}Ye.getDocumentOrThrow=Dz;function Pz(){return eo("document")}Ye.getDocument=Pz;function Rz(){return ja("navigator")}Ye.getNavigatorOrThrow=Rz;function Bz(){return eo("navigator")}Ye.getNavigator=Bz;function Lz(){return ja("location")}Ye.getLocationOrThrow=Lz;function Fz(){return eo("location")}Ye.getLocation=Fz;function Mz(){return ja("crypto")}Ye.getCryptoOrThrow=Mz;function Uz(){return eo("crypto")}Ye.getCrypto=Uz;function qz(){return ja("localStorage")}Ye.getLocalStorageOrThrow=qz;function Vz(){return eo("localStorage")}Ye.getLocalStorage=Vz});var u3=E(Sp=>{"use strict";l();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.getWindowMetadata=void 0;var a3=IA();function Hz(){let t,e;try{t=a3.getDocumentOrThrow(),e=a3.getLocationOrThrow()}catch{return null}function r(){let h=t.getElementsByTagName("link"),g=[];for(let y=0;y-1){let O=m.getAttribute("href");if(O)if(O.toLowerCase().indexOf("https:")===-1&&O.toLowerCase().indexOf("http:")===-1&&O.indexOf("//")!==0){let B=e.protocol+"//"+e.host;if(O.indexOf("/")===0)B+=O;else{let W=e.pathname.split("/");W.pop();let U=W.join("/");B+=U+"/"+O}g.push(B)}else if(O.indexOf("//")===0){let B=e.protocol+O;g.push(B)}else g.push(O)}}return g}function n(...h){let g=t.getElementsByTagName("meta");for(let y=0;ym.getAttribute(O)).filter(O=>O?h.includes(O):!1);if(T.length&&T){let O=m.getAttribute("content");if(O)return O}}return""}function i(){let h=n("name","og:site_name","og:title","twitter:title");return h||(h=t.title),h}function s(){return n("description","og:description","twitter:description","keywords")}let o=i(),a=s(),u=e.origin,c=r();return{description:a,url:u,icons:c,name:o}}Sp.getWindowMetadata=Hz});var l3=E((qpe,c3)=>{"use strict";l();c3.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var g3=E((Hpe,p3)=>{"use strict";l();var d3="%[a-f0-9]{2}",f3=new RegExp("("+d3+")|([^%]+?)","gi"),h3=new RegExp("("+d3+")+","gi");function _A(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],_A(r),_A(n))}function Gz(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(f3)||[],r=1;r{"use strict";l();y3.exports=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];let r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]}});var E3=E((Qpe,w3)=>{"use strict";l();w3.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s{"use strict";l();var jz=l3(),Qz=g3(),A3=m3(),Wz=E3(),zz=t=>t==null,SA=Symbol("encodeFragmentIdentifier");function $z(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{let i=r.length;return n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[",i,"]"].join("")]:[...r,[vt(e,t),"[",vt(i,t),"]=",vt(n,t)].join("")]};case"bracket":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),"[]"].join("")]:[...r,[vt(e,t),"[]=",vt(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,[vt(e,t),":list="].join("")]:[...r,[vt(e,t),":list=",vt(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{let e=t.arrayFormat==="bracket-separator"?"[]=":"=";return r=>(n,i)=>i===void 0||t.skipNull&&i===null||t.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[vt(r,t),e,vt(i,t)].join("")]:[[n,vt(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>n===void 0||t.skipNull&&n===null||t.skipEmptyString&&n===""?r:n===null?[...r,vt(e,t)]:[...r,[vt(e,t),"=",vt(n,t)].join("")]}}function Kz(t){let e;switch(t.arrayFormat){case"index":return(r,n,i)=>{if(e=/\[(\d*)\]$/.exec(r),r=r.replace(/\[\d*\]$/,""),!e){i[r]=n;return}i[r]===void 0&&(i[r]={}),i[r][e[1]]=n};case"bracket":return(r,n,i)=>{if(e=/(\[\])$/.exec(r),r=r.replace(/\[\]$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"colon-list-separator":return(r,n,i)=>{if(e=/(:list)$/.exec(r),r=r.replace(/:list$/,""),!e){i[r]=n;return}if(i[r]===void 0){i[r]=[n];return}i[r]=[].concat(i[r],n)};case"comma":case"separator":return(r,n,i)=>{let s=typeof n=="string"&&n.includes(t.arrayFormatSeparator),o=typeof n=="string"&&!s&&oi(n,t).includes(t.arrayFormatSeparator);n=o?oi(n,t):n;let a=s||o?n.split(t.arrayFormatSeparator).map(u=>oi(u,t)):n===null?n:oi(n,t);i[r]=a};case"bracket-separator":return(r,n,i)=>{let s=/(\[\])$/.test(r);if(r=r.replace(/\[\]$/,""),!s){i[r]=n&&oi(n,t);return}let o=n===null?[]:n.split(t.arrayFormatSeparator).map(a=>oi(a,t));if(i[r]===void 0){i[r]=o;return}i[r]=[].concat(i[r],o)};default:return(r,n,i)=>{if(i[r]===void 0){i[r]=n;return}i[r]=[].concat(i[r],n)}}}function b3(t){if(typeof t!="string"||t.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function vt(t,e){return e.encode?e.strict?jz(t):encodeURIComponent(t):t}function oi(t,e){return e.decode?Qz(t):t}function I3(t){return Array.isArray(t)?t.sort():typeof t=="object"?I3(Object.keys(t)).sort((e,r)=>Number(e)-Number(r)).map(e=>t[e]):t}function _3(t){let e=t.indexOf("#");return e!==-1&&(t=t.slice(0,e)),t}function Yz(t){let e="",r=t.indexOf("#");return r!==-1&&(e=t.slice(r)),e}function S3(t){t=_3(t);let e=t.indexOf("?");return e===-1?"":t.slice(e+1)}function v3(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&typeof t=="string"&&t.trim()!==""?t=Number(t):e.parseBooleans&&t!==null&&(t.toLowerCase()==="true"||t.toLowerCase()==="false")&&(t=t.toLowerCase()==="true"),t}function T3(t,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),b3(e.arrayFormatSeparator);let r=Kz(e),n=Object.create(null);if(typeof t!="string"||(t=t.trim().replace(/^[?#&]/,""),!t))return n;for(let i of t.split("&")){if(i==="")continue;let[s,o]=A3(e.decode?i.replace(/\+/g," "):i,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:oi(o,e),r(oi(s,e),o,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=v3(s[o],e);else n[i]=v3(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let o=n[s];return o&&typeof o=="object"&&!Array.isArray(o)?i[s]=I3(o):i[s]=o,i},Object.create(null))}yr.extract=S3;yr.parse=T3;yr.stringify=(t,e)=>{if(!t)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),b3(e.arrayFormatSeparator);let r=o=>e.skipNull&&zz(t[o])||e.skipEmptyString&&t[o]==="",n=$z(e),i={};for(let o of Object.keys(t))r(o)||(i[o]=t[o]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=t[o];return a===void 0?"":a===null?vt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?vt(o,e)+"[]":a.reduce(n(o),[]).join("&"):vt(o,e)+"="+vt(a,e)}).filter(o=>o.length>0).join("&")};yr.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);let[r,n]=A3(t,"#");return Object.assign({url:r.split("?")[0]||"",query:T3(S3(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:oi(n,e)}:{})};yr.stringifyUrl=(t,e)=>{e=Object.assign({encode:!0,strict:!0,[SA]:!0},e);let r=_3(t.url).split("?")[0]||"",n=yr.extract(t.url),i=yr.parse(n,{sort:!1}),s=Object.assign(i,t.query),o=yr.stringify(s,e);o&&(o=`?${o}`);let a=Yz(t.url);return t.fragmentIdentifier&&(a=`#${e[SA]?vt(t.fragmentIdentifier,e):t.fragmentIdentifier}`),`${r}${o}${a}`};yr.pick=(t,e,r)=>{r=Object.assign({parseFragmentIdentifier:!0,[SA]:!1},r);let{url:n,query:i,fragmentIdentifier:s}=yr.parseUrl(t,r);return yr.stringifyUrl({url:n,query:Wz(i,e),fragmentIdentifier:s},r)};yr.exclude=(t,e,r)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return yr.pick(t,n,r)}});var x3=fe(()=>{l()});function zi(t,e,r="string"){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function Jz(t,e){let r=!0;return e.forEach(n=>{n in t||(r=!1)}),r}function Xz(t,e){return Array.isArray(t)?t.length===e:Object.keys(t).length===e}function Zz(t,e){return Array.isArray(t)?t.length>=e:Object.keys(t).length>=e}function fl(t,e,r){return(!r.length?Xz(t,e.length):Zz(t,e.length))?Jz(t,e):!1}function hl(t,e,r="_"){let n=t.split(r);return n[n.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var TA=fe(()=>{l()});function e$(t){return Tp(t.method)&&Cp(t.params)}function Tp(t){return hl(t,"subscribe")}function Cp(t){return fl(t,["topic"],[])}function t$(t){return xp(t.method)&&Np(t.params)}function xp(t){return hl(t,"publish")}function Np(t){return fl(t,["message","topic","ttl"],["prompt","tag"])}function r$(t){return Op(t.method)&&Dp(t.params)}function Op(t){return hl(t,"unsubscribe")}function Dp(t){return fl(t,["id","topic"],[])}function n$(t){return Pp(t.method)&&Rp(t.params)}function Pp(t){return hl(t,"subscription")}function Rp(t){return fl(t,["id","data"],[])}var CA=fe(()=>{l();TA()});function i$(t){if(!Tp(t.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!Cp(t.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=t.params;return zi(e,"topic"),e}function s$(t){if(!xp(t.method))throw new Error("JSON-RPC Request has invalid publish method");if(!Np(t.params))throw new Error("JSON-RPC Request has invalid publish params");let e=t.params;return zi(e,"topic"),zi(e,"message"),zi(e,"ttl","number"),e}function o$(t){if(!Op(t.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!Dp(t.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=t.params;return zi(e,"id"),e}function a$(t){if(!Pp(t.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!Rp(t.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=t.params;return zi(e,"id"),zi(e,"data"),e}var N3=fe(()=>{l();TA();CA()});var u$,O3=fe(()=>{l();u$={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe"}}});var D3={};ct(D3,{RELAY_JSONRPC:()=>u$,isPublishMethod:()=>xp,isPublishParams:()=>Np,isPublishRequest:()=>t$,isSubscribeMethod:()=>Tp,isSubscribeParams:()=>Cp,isSubscribeRequest:()=>e$,isSubscriptionMethod:()=>Pp,isSubscriptionParams:()=>Rp,isSubscriptionRequest:()=>n$,isUnsubscribeMethod:()=>Op,isUnsubscribeParams:()=>Dp,isUnsubscribeRequest:()=>r$,parsePublishRequest:()=>s$,parseSubscribeRequest:()=>i$,parseSubscriptionRequest:()=>a$,parseUnsubscribeRequest:()=>o$});var P3=fe(()=>{l();x3();N3();O3();CA()});var wl=E(G=>{"use strict";l();Object.defineProperty(G,"__esModule",{value:!0});var G3=OP(),c$=FP(),k3=Kc(),RA=UP(),l$=GP(),ot=(AA(),ft(vA)),f$=o3(),Qa=$s(),dl=IA(),h$=u3(),d$=C3(),p$=(P3(),ft(D3));function j3(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var Q3=j3(l$),Bp=j3(d$),Mp=":";function W3(t){let[e,r]=t.split(Mp);return{namespace:e,reference:r}}function z3(t){let{namespace:e,reference:r}=t;return[e,r].join(Mp)}function BA(t){let[e,r,n]=t.split(Mp);return{namespace:e,reference:r,address:n}}function $3(t){let{namespace:e,reference:r,address:n}=t;return[e,r,n].join(Mp)}function LA(t,e){let r=[];return t.forEach(n=>{let i=e(n);r.includes(i)||r.push(i)}),r}function K3(t){let{address:e}=BA(t);return e}function Y3(t){let{namespace:e,reference:r}=BA(t);return z3({namespace:e,reference:r})}function g$(t,e){let{namespace:r,reference:n}=W3(e);return $3({namespace:r,reference:n,address:t})}function y$(t){return LA(t,K3)}function J3(t){return LA(t,Y3)}function m$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...i.accounts)}),r}function w$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...J3(i.accounts))}),r}function E$(t,e=[]){let r=[];return Object.keys(t).forEach(n=>{if(e.length&&!e.includes(n))return;let i=t[n];r.push(...Up(n,i))}),r}function Up(t,e){return t.includes(":")?[t]:e.chains||[]}var qp=t=>t?.split(":"),X3=t=>{let e=t&&qp(t);if(e)return e[3]},v$=t=>{let e=t&&qp(t);if(e)return e[2]+":"+e[3]},Z3=t=>{let e=t&&qp(t);if(e)return e.pop()},A$=(t,e)=>{let r=`${t.domain} wants you to sign in with your Ethereum account:`,n=Z3(e),i=t.statement,s=`URI: ${t.aud}`,o=`Version: ${t.version}`,a=`Chain ID: ${X3(e)}`,u=`Nonce: ${t.nonce}`,c=`Issued At: ${t.iat}`,f=t.resources&&t.resources.length>0?`Resources: +${t.resources.map(h=>`- ${h}`).join(` +`)}`:void 0;return[r,n,"",i,"",s,o,a,u,c,f].filter(h=>h!=null).join(` +`)},FA="base10",ir="base16",Lp="base64pad",Vp="utf8",MA=0,Wa=1,b$=0,R3=1,NA=12,UA=32;function I$(){let t=Q3.generateKeyPair();return{privateKey:ot.toString(t.secretKey,ir),publicKey:ot.toString(t.publicKey,ir)}}function _$(){let t=k3.randomBytes(UA);return ot.toString(t,ir)}function S$(t,e){let r=Q3.sharedKey(ot.fromString(t,ir),ot.fromString(e,ir),!0),n=new c$.HKDF(RA.SHA256,r).expand(UA);return ot.toString(n,ir)}function T$(t){let e=RA.hash(ot.fromString(t,ir));return ot.toString(e,ir)}function C$(t){let e=RA.hash(ot.fromString(t,Vp));return ot.toString(e,ir)}function eR(t){return ot.fromString(`${t}`,FA)}function gl(t){return Number(ot.toString(t,FA))}function x$(t){let e=eR(typeof t.type<"u"?t.type:MA);if(gl(e)===Wa&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let r=typeof t.senderPublicKey<"u"?ot.fromString(t.senderPublicKey,ir):void 0,n=typeof t.iv<"u"?ot.fromString(t.iv,ir):k3.randomBytes(NA),i=new G3.ChaCha20Poly1305(ot.fromString(t.symKey,ir)).seal(n,ot.fromString(t.message,Vp));return tR({type:e,sealed:i,iv:n,senderPublicKey:r})}function N$(t){let e=new G3.ChaCha20Poly1305(ot.fromString(t.symKey,ir)),{sealed:r,iv:n}=qA(t.encoded),i=e.open(n,r);if(i===null)throw new Error("Failed to decrypt");return ot.toString(i,Vp)}function tR(t){if(gl(t.type)===Wa){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ot.toString(ot.concat([t.type,t.senderPublicKey,t.iv,t.sealed]),Lp)}return ot.toString(ot.concat([t.type,t.iv,t.sealed]),Lp)}function qA(t){let e=ot.fromString(t,Lp),r=e.slice(b$,R3),n=R3;if(gl(r)===Wa){let a=n+UA,u=a+NA,c=e.slice(n,a),f=e.slice(a,u),h=e.slice(u);return{type:r,sealed:h,iv:f,senderPublicKey:c}}let i=n+NA,s=e.slice(n,i),o=e.slice(i);return{type:r,sealed:o,iv:s}}function O$(t,e){let r=qA(t);return rR({type:gl(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?ot.toString(r.senderPublicKey,ir):void 0,receiverPublicKey:e?.receiverPublicKey})}function rR(t){let e=t?.type||MA;if(e===Wa){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function D$(t){return t.type===Wa&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}var P$=Object.defineProperty,B3=Object.getOwnPropertySymbols,R$=Object.prototype.hasOwnProperty,B$=Object.prototype.propertyIsEnumerable,L3=(t,e,r)=>e in t?P$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F3=(t,e)=>{for(var r in e||(e={}))R$.call(e,r)&&L3(t,r,e[r]);if(B3)for(var r of B3(e))B$.call(e,r)&&L3(t,r,e[r]);return t},nR="ReactNative",nr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Fp=" ",L$=":",iR="/",VA=2,F$=1e3,sR="js";function HA(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}function yl(){return!dl.getDocument()&&!!dl.getNavigator()&&navigator.product===nR}function Hp(){return!HA()&&!!dl.getNavigator()}function ro(){return yl()?nr.reactNative:HA()?nr.node:Hp()?nr.browser:nr.unknown}function oR(t,e){let r=Bp.parse(t);return r=F3(F3({},r),e),t=Bp.stringify(r),t}function M$(){return h$.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function U$(t,e){var r;let n=ro(),i={protocol:t,version:e,env:n};return n==="browser"&&(i.host=((r=dl.getLocation())==null?void 0:r.host)||"unknown"),i}function aR(){if(ro()===nr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){let{OS:r,Version:n}=global.Platform;return[r,n].join("-")}let t=f$.detect();if(t===null)return"unknown";let e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function uR(){var t;let e=ro();return e===nr.browser?[e,((t=dl.getLocation())==null?void 0:t.host)||"unknown"].join(":"):e}function cR(t,e,r){let n=aR(),i=uR();return[[t,e].join("-"),[sR,r].join("-"),n,i].join("/")}function q$({protocol:t,version:e,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o}){let a=r.split("?"),u=cR(t,e,n),c={auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0},f=oR(a[1]||"",c);return a[0]+"?"+f}function V$(t){let e=(t.match(/^[^:]+(?=:\/\/)/gi)||[])[0],r=typeof e<"u"?t.split("://")[1]:t;return e=e==="wss"?"https":"http",[e,r].join("://")}function H$(t,e,r){if(!t[e]||typeof t[e]!==r)throw new Error(`Missing or invalid "${e}" param`)}function lR(t,e=VA){return fR(t.split(iR),e)}function G$(t){return lR(t).join(Fp)}function $i(t,e){return t.filter(r=>e.includes(r)).length===t.length}function fR(t,e=VA){return t.slice(Math.max(t.length-e,0))}function k$(t){return Object.fromEntries(t.entries())}function j$(t){return new Map(Object.entries(t))}function Q$(t,e){let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}var W$=t=>t;function hR(t){return t.trim().replace(/^\w/,e=>e.toUpperCase())}function z$(t){return t.split(Fp).map(e=>hR(e)).join(Fp)}function $$(t=Qa.FIVE_MINUTES,e){let r=Qa.toMiliseconds(t||Qa.FIVE_MINUTES),n,i,s;return{resolve:o=>{s&&n&&(clearTimeout(s),n(o))},reject:o=>{s&&i&&(clearTimeout(s),i(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),n=o,i=a})}}function K$(t,e,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(new Error(r)),e);try{let o=await t;n(o)}catch(o){i(o)}clearTimeout(s)})}function GA(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Y$(t){return GA("topic",t)}function J$(t){return GA("id",t)}function X$(t){let[e,r]=t.split(":"),n={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")n.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))n.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return n}function Z$(t,e){return Qa.fromMiliseconds((e||Date.now())+Qa.toMiliseconds(t))}function eK(t){return Date.now()>=Qa.toMiliseconds(t)}function tK(t,e){return`${t}${e?`:${e}`:""}`}function Ki(t=[],e=[]){return[...new Set([...t,...e])]}async function rK({id:t,topic:e,wcDeepLink:r}){try{if(!r)return;let i=(typeof r=="string"?JSON.parse(r):r)?.href;if(typeof i!="string")return;i.endsWith("/")&&(i=i.slice(0,-1));let s=`${i}/wc?requestId=${t}&sessionTopic=${e}`,o=ro();o===nr.browser?s.startsWith("https://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"):o===nr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(n){console.error(n)}}var dR="irn";function nK(t){return t?.relay||{protocol:dR}}function iK(t){let e=p$.RELAY_JSONRPC[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var sK=Object.defineProperty,M3=Object.getOwnPropertySymbols,oK=Object.prototype.hasOwnProperty,aK=Object.prototype.propertyIsEnumerable,U3=(t,e,r)=>e in t?sK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uK=(t,e)=>{for(var r in e||(e={}))oK.call(e,r)&&U3(t,r,e[r]);if(M3)for(var r of M3(e))aK.call(e,r)&&U3(t,r,e[r]);return t};function pR(t,e="-"){let r={},n="relay"+e;return Object.keys(t).forEach(i=>{if(i.startsWith(n)){let s=i.replace(n,""),o=t[i];r[s]=o}}),r}function cK(t){let e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,n=t.substring(0,e),i=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=Bp.parse(s);return{protocol:n,topic:gR(i[0]),version:parseInt(i[1],10),symKey:o.symKey,relay:pR(o)}}function gR(t){return t.startsWith("//")?t.substring(2):t}function yR(t,e="-"){let r="relay",n={};return Object.keys(t).forEach(i=>{let s=r+e+i;t[i]&&(n[s]=t[i])}),n}function lK(t){return`${t.protocol}:${t.topic}@${t.version}?`+Bp.stringify(uK({symKey:t.symKey},yR(t.relay)))}var fK=Object.defineProperty,hK=Object.defineProperties,dK=Object.getOwnPropertyDescriptors,q3=Object.getOwnPropertySymbols,pK=Object.prototype.hasOwnProperty,gK=Object.prototype.propertyIsEnumerable,V3=(t,e,r)=>e in t?fK(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yK=(t,e)=>{for(var r in e||(e={}))pK.call(e,r)&&V3(t,r,e[r]);if(q3)for(var r of q3(e))gK.call(e,r)&&V3(t,r,e[r]);return t},mK=(t,e)=>hK(t,dK(e));function no(t){let e=[];return t.forEach(r=>{let[n,i]=r.split(":");e.push(`${n}:${i}`)}),e}function mR(t){let e=[];return Object.values(t).forEach(r=>{e.push(...no(r.accounts))}),e}function wR(t,e){let r=[];return Object.values(t).forEach(n=>{no(n.accounts).includes(e)&&r.push(...n.methods)}),r}function ER(t,e){let r=[];return Object.values(t).forEach(n=>{no(n.accounts).includes(e)&&r.push(...n.events)}),r}function wK(t,e){let r=CR(t,e);if(r)throw new Error(r.message);let n={};for(let[i,s]of Object.entries(t))n[i]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return n}function EK(t){let{proposal:{requiredNamespaces:e,optionalNamespaces:r={}},supportedNamespaces:n}=t,i=OA(e),s=OA(r),o={};Object.keys(n).forEach(c=>{let f=n[c].chains,h=n[c].methods,g=n[c].events,y=n[c].accounts;f.forEach(m=>{if(!y.some(T=>T.includes(m)))throw new Error(`No accounts provided for chain ${m} in namespace ${c}`)}),o[c]={chains:f,methods:h,events:g,accounts:y}});let a=NR(e,o,"approve()");if(a)throw new Error(a.message);let u={};return!Object.keys(e).length&&!Object.keys(r).length?o:(Object.keys(i).forEach(c=>{let f=n[c].chains.filter(m=>{var T,O;return(O=(T=i[c])==null?void 0:T.chains)==null?void 0:O.includes(m)}),h=n[c].methods.filter(m=>{var T,O;return(O=(T=i[c])==null?void 0:T.methods)==null?void 0:O.includes(m)}),g=n[c].events.filter(m=>{var T,O;return(O=(T=i[c])==null?void 0:T.events)==null?void 0:O.includes(m)}),y=f.map(m=>n[c].accounts.filter(T=>T.includes(`${m}:`))).flat();u[c]={chains:f,methods:h,events:g,accounts:y}}),Object.keys(s).forEach(c=>{var f,h,g,y,m,T;if(!n[c])return;let O=(h=(f=s[c])==null?void 0:f.chains)==null?void 0:h.filter(A=>n[c].chains.includes(A)),B=n[c].methods.filter(A=>{var _,N;return(N=(_=s[c])==null?void 0:_.methods)==null?void 0:N.includes(A)}),W=n[c].events.filter(A=>{var _,N;return(N=(_=s[c])==null?void 0:_.events)==null?void 0:N.includes(A)}),U=O?.map(A=>n[c].accounts.filter(_=>_.includes(`${A}:`))).flat();u[c]={chains:Ki((g=u[c])==null?void 0:g.chains,O),methods:Ki((y=u[c])==null?void 0:y.methods,B),events:Ki((m=u[c])==null?void 0:m.events,W),accounts:Ki((T=u[c])==null?void 0:T.accounts,U)}}),u)}function kA(t){return t.includes(":")}function vR(t){return kA(t)?t.split(":")[0]:t}function OA(t){var e,r,n;let i={};if(!Gp(t))return i;for(let[s,o]of Object.entries(t)){let a=kA(s)?[s]:o.chains,u=o.methods||[],c=o.events||[],f=vR(s);i[f]=mK(yK({},i[f]),{chains:Ki(a,(e=i[f])==null?void 0:e.chains),methods:Ki(u,(r=i[f])==null?void 0:r.methods),events:Ki(c,(n=i[f])==null?void 0:n.events)})}return i}var vK={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},AK={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function ai(t,e){let{message:r,code:n}=AK[t];return{message:e?`${r} ${e}`:r,code:n}}function to(t,e){let{message:r,code:n}=vK[t];return{message:e?`${r} ${e}`:r,code:n}}function ml(t,e){return Array.isArray(t)?typeof e<"u"&&t.length?t.every(e):!0:!1}function Gp(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function Yi(t){return typeof t>"u"}function br(t,e){return e&&Yi(t)?!0:typeof t=="string"&&!!t.trim().length}function kp(t,e){return e&&Yi(t)?!0:typeof t=="number"&&!isNaN(t)}function bK(t,e){let{requiredNamespaces:r}=e,n=Object.keys(t.namespaces),i=Object.keys(r),s=!0;return $i(i,n)?(n.forEach(o=>{let{accounts:a,methods:u,events:c}=t.namespaces[o],f=no(a),h=r[o];(!$i(Up(o,h),f)||!$i(h.methods,u)||!$i(h.events,c))&&(s=!1)}),s):!1}function pl(t){return br(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function AR(t){if(br(t,!1)&&t.includes(":")){let e=t.split(":");if(e.length===3){let r=e[0]+":"+e[1];return!!e[2]&&pl(r)}}return!1}function IK(t){if(br(t,!1))try{return typeof new URL(t)<"u"}catch{return!1}return!1}function _K(t){var e;return(e=t?.proposer)==null?void 0:e.publicKey}function SK(t){return t?.topic}function TK(t,e){let r=null;return br(t?.publicKey,!1)||(r=ai("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function DA(t){let e=!0;return ml(t)?t.length&&(e=t.every(r=>br(r,!1))):e=!1,e}function bR(t,e,r){let n=null;return ml(e)&&e.length?e.forEach(i=>{n||pl(i)||(n=to("UNSUPPORTED_CHAINS",`${r}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):pl(t)||(n=to("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function IR(t,e,r){let n=null;return Object.entries(t).forEach(([i,s])=>{if(n)return;let o=bR(i,Up(i,s),`${e} ${r}`);o&&(n=o)}),n}function _R(t,e){let r=null;return ml(t)?t.forEach(n=>{r||AR(n)||(r=to("UNSUPPORTED_ACCOUNTS",`${e}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):r=to("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function SR(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=_R(n?.accounts,`${e} namespace`);i&&(r=i)}),r}function TR(t,e){let r=null;return DA(t?.methods)?DA(t?.events)||(r=to("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=to("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function jA(t,e){let r=null;return Object.values(t).forEach(n=>{if(r)return;let i=TR(n,`${e}, namespace`);i&&(r=i)}),r}function CK(t,e,r){let n=null;if(t&&Gp(t)){let i=jA(t,e);i&&(n=i);let s=IR(t,e,r);s&&(n=s)}else n=ai("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return n}function CR(t,e){let r=null;if(t&&Gp(t)){let n=jA(t,e);n&&(r=n);let i=SR(t,e);i&&(r=i)}else r=ai("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function xR(t){return br(t.protocol,!0)}function xK(t,e){let r=!1;return e&&!t?r=!0:t&&ml(t)&&t.length&&t.forEach(n=>{r=xR(n)}),r}function NK(t){return typeof t=="number"}function OK(t){return typeof t<"u"&&typeof t!==null}function DK(t){return!(!t||typeof t!="object"||!t.code||!kp(t.code,!1)||!t.message||!br(t.message,!1))}function PK(t){return!(Yi(t)||!br(t.method,!1))}function RK(t){return!(Yi(t)||Yi(t.result)&&Yi(t.error)||!kp(t.id,!1)||!br(t.jsonrpc,!1))}function BK(t){return!(Yi(t)||!br(t.name,!1))}function LK(t,e){return!(!pl(e)||!mR(t).includes(e))}function FK(t,e,r){return br(r,!1)?wR(t,e).includes(r):!1}function MK(t,e,r){return br(r,!1)?ER(t,e).includes(r):!1}function NR(t,e,r){let n=null,i=UK(t),s=qK(e),o=Object.keys(i),a=Object.keys(s),u=H3(Object.keys(t)),c=H3(Object.keys(e)),f=u.filter(h=>!c.includes(h));return f.length&&(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. Required: ${f.toString()} - Received: ${Object.keys(e).toString()}`)),ki(o,a)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. + Received: ${Object.keys(e).toString()}`)),$i(o,a)||(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. Required: ${o.toString()} - Approved: ${a.toString()}`)),Object.keys(e).forEach(d=>{if(!d.includes(":")||n)return;let g=Xs(e[d].accounts);g.includes(d)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${d} - Required: ${d} - Approved: ${g.toString()}`))}),o.forEach(d=>{n||(ki(i[d].methods,s[d].methods)?ki(i[d].events,s[d].events)||(n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${d}`)):n=ii("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function Kz(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function p3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Yz(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:Xs(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function Jz(t,e){return Vp(t,!1)&&t<=e.max&&t>=e.min}function Xz(){let t=Js();return new Promise(e=>{switch(t){case tr.browser:e(nR());break;case tr.reactNative:e(iR());break;case tr.node:e(sR());break;default:e(!0)}})}function nR(){return Up()&&navigator?.onLine}async function iR(){return al()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function sR(){return!0}function Zz(t){switch(Js()){case tr.browser:oR(t);break;case tr.reactNative:aR(t);break;case tr.node:break}}function oR(t){!al()&&Up()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function aR(t){al()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var gA={},EA=class{static get(e){return gA[e]}static set(e,r){gA[e]=r}static delete(e){delete gA[e]}};G.BASE10=_A,G.BASE16=rr,G.BASE64=Pp,G.COLON=W$,G.DEFAULT_DEPTH=CA,G.EMPTY_SPACE=Rp,G.ENV_MAP=tr,G.MemoryStore=EA,G.ONE_THOUSAND=$$,G.REACT_NATIVE_PRODUCT=O3,G.RELAYER_DEFAULT_PROTOCOL=V3,G.SDK_TYPE=P3,G.SLASH=D3,G.TYPE_0=IA,G.TYPE_1=ka,G.UTF8=Mp,G.appendToQueryString=R3,G.assertType=X$,G.buildApprovedNamespaces=Oz,G.calcExpiry=lz,G.capitalize=iz,G.capitalizeWord=q3,G.createDelayedPromise=sz,G.createExpiringPromise=oz,G.decodeTypeByte=ol,G.decrypt=V$,G.deriveSymKey=F$,G.deserialize=TA,G.encodeTypeByte=C3,G.encrypt=q$,G.engineEvent=hz,G.enumify=nz,G.formatAccountId=A3,G.formatAccountWithChain=T$,G.formatChainId=v3,G.formatExpirerTarget=NA,G.formatIdTarget=uz,G.formatMessage=P$,G.formatMessageContext=Z$,G.formatRelayParams=k3,G.formatRelayRpcUrl=Y$,G.formatTopicTarget=az,G.formatUA=F3,G.formatUri=Az,G.generateKeyPair=B$,G.generateRandomBytes32=L$,G.getAccountsChains=Xs,G.getAccountsFromNamespaces=x$,G.getAddressFromAccount=b3,G.getAddressesFromAccounts=C$,G.getAppMetadata=z$,G.getBrowserOnlineStatus=nR,G.getChainFromAccount=_3,G.getChainsFromAccounts=I3,G.getChainsFromNamespace=Lp,G.getChainsFromNamespaces=N$,G.getChainsFromRequiredNamespaces=O$,G.getDidAddress=T3,G.getDidAddressSegments=Fp,G.getDidChainId=S3,G.getEnvironment=Js,G.getHttpUrl=J$,G.getInternalError=ii,G.getJavascriptID=L3,G.getJavascriptOS=B3,G.getLastItems=U3,G.getNamespacedDidChainId=D$,G.getNamespacesChains=j3,G.getNamespacesEventsForChainId=W3,G.getNamespacesMethodsForChainId=Q3,G.getNodeOnlineStatus=sR,G.getReactNativeOnlineStatus=iR,G.getRelayClientMetadata=K$,G.getRelayProtocolApi=gz,G.getRelayProtocolName=pz,G.getRequiredNamespacesFromNamespaces=Nz,G.getSdkError=Ys,G.getUniqueValues=bA,G.handleDeeplinkRedirect=dz,G.hasOverlap=ki,G.hashKey=M$,G.hashMessage=U$,G.isBrowser=Up,G.isCaipNamespace=OA,G.isConformingNamespaces=rR,G.isExpired=fz,G.isNode=xA,G.isOnline=Xz,G.isProposalStruct=Lz,G.isReactNative=al,G.isSessionCompatible=Rz,G.isSessionStruct=Fz,G.isTypeOneEnvelope=G$,G.isUndefined=Qi,G.isValidAccountId=z3,G.isValidAccounts=J3,G.isValidActions=Z3,G.isValidArray=ul,G.isValidChainId=sl,G.isValidChains=K3,G.isValidController=Mz,G.isValidErrorReason=Gz,G.isValidEvent=Qz,G.isValidId=Vz,G.isValidNamespaceAccounts=X3,G.isValidNamespaceActions=DA,G.isValidNamespaceChains=Y3,G.isValidNamespaceMethodsOrEvents=wA,G.isValidNamespaces=eR,G.isValidNamespacesChainId=Wz,G.isValidNamespacesEvent=zz,G.isValidNamespacesRequest=$z,G.isValidNumber=Vp,G.isValidObject=qp,G.isValidParams=Hz,G.isValidRelay=tR,G.isValidRelays=qz,G.isValidRequest=kz,G.isValidRequestExpiry=Jz,G.isValidRequiredNamespaces=Uz,G.isValidResponse=jz,G.isValidString=br,G.isValidUrl=Bz,G.mapEntries=rz,G.mapToObj=ez,G.mergeArrays=ji,G.normalizeNamespaces=mA,G.objToMap=tz,G.parseAccountId=AA,G.parseChainId=E3,G.parseContextNames=M3,G.parseExpirerTarget=cz,G.parseNamespaceKey=$3,G.parseRelayParams=H3,G.parseTopic=G3,G.parseUri=vz,G.serialize=x3,G.subscribeToBrowserNetworkChange=oR,G.subscribeToNetworkChange=Zz,G.subscribeToReactNativeNetworkChange=aR,G.validateDecoding=H$,G.validateEncoding=N3});var uR,cR,lR,fR,Hp,ll,PA,Gp,Wi,fl,kp=ge(()=>{c();uR="PARSE_ERROR",cR="INVALID_REQUEST",lR="METHOD_NOT_FOUND",fR="INVALID_PARAMS",Hp="INTERNAL_ERROR",ll="SERVER_ERROR",PA=[-32700,-32600,-32601,-32602,-32603],Gp=[-32e3,-32099],Wi={[uR]:{code:-32700,message:"Parse error"},[cR]:{code:-32600,message:"Invalid Request"},[lR]:{code:-32601,message:"Method not found"},[fR]:{code:-32602,message:"Invalid params"},[Hp]:{code:-32603,message:"Internal error"},[ll]:{code:-32e3,message:"Server error"}},fl=ll});function eK(t){return t<=Gp[0]&&t>=Gp[1]}function jp(t){return PA.includes(t)}function hR(t){return typeof t=="number"}function Qp(t){return Object.keys(Wi).includes(t)?Wi[t]:Wi[fl]}function Wp(t){let e=Object.values(Wi).find(r=>r.code===t);return e||Wi[fl]}function tK(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!hR(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(jp(t.error.code)){let e=Wp(t.error.code);if(e.message!==Wi[fl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function RA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var BA=ge(()=>{c();kp()});var pR=m($i=>{"use strict";c();Object.defineProperty($i,"__esModule",{value:!0});$i.isBrowserCryptoAvailable=$i.getSubtleCrypto=$i.getBrowerCrypto=void 0;function LA(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}$i.getBrowerCrypto=LA;function dR(){let t=LA();return t.subtle||t.webkitSubtle}$i.getSubtleCrypto=dR;function rK(){return!!LA()&&!!dR()}$i.isBrowserCryptoAvailable=rK});var mR=m(zi=>{"use strict";c();Object.defineProperty(zi,"__esModule",{value:!0});zi.isBrowser=zi.isNode=zi.isReactNative=void 0;function gR(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}zi.isReactNative=gR;function yR(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}zi.isNode=yR;function nK(){return!gR()&&!yR()}zi.isBrowser=nK});var FA=m($p=>{"use strict";c();Object.defineProperty($p,"__esModule",{value:!0});var wR=(vr(),ct(Er));wR.__exportStar(pR(),$p);wR.__exportStar(mR(),$p)});var Ft={};ft(Ft,{isNodeJs:()=>vR});var ER,vR,AR=ge(()=>{c();ER=_e(FA());Ht(Ft,_e(FA()));vR=ER.isNode});function MA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function UA(t=6){return BigInt(MA(t))}function qA(t,e,r){return{id:r||MA(),jsonrpc:"2.0",method:t,params:e}}function iK(t,e){return{id:t,jsonrpc:"2.0",result:e}}function VA(t,e,r){return{id:t,jsonrpc:"2.0",error:bR(e,r)}}function bR(t,e){return typeof t>"u"?Qp(Hp):(typeof t=="string"&&(t=Object.assign(Object.assign({},Qp(ll)),{message:t})),typeof e<"u"&&(t.data=e),jp(t.code)&&(t=Wp(t.code)),t)}var _R=ge(()=>{c();BA();kp()});function sK(t){return t.includes("*")?Kp(t):!/\W/g.test(t)}function zp(t){return t==="*"}function Kp(t){return zp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function oK(t){return!zp(t)&&Kp(t)&&!t.split("*")[0].trim()}function aK(t){return!zp(t)&&Kp(t)&&!t.split("*")[1].trim()}var IR=ge(()=>{c()});var SR=ge(()=>{c()});var ja,HA=ge(()=>{c();ja=class{}});var GA,Yp,hl,TR=ge(()=>{c();HA();GA=class extends ja{constructor(e){super()}},Yp=class extends ja{constructor(){super()}},hl=class extends Yp{constructor(e){super()}}});var CR=ge(()=>{c()});var xR=ge(()=>{c();SR();HA();TR();CR()});var NR=ge(()=>{c();xR()});function lK(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function OR(t,e){let r=lK(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function fK(t){return OR(t,uK)}function Jp(t){return OR(t,cK)}function kA(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var uK,cK,DR=ge(()=>{c();uK="^https?:",cK="^wss?:"});function jA(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function hK(t){return jA(t)&&"method"in t}function QA(t){return jA(t)&&(PR(t)||Xp(t))}function PR(t){return"result"in t}function Xp(t){return"error"in t}function dK(t){return"error"in t&&t.valid===!1}var RR=ge(()=>{c()});var Zt={};ft(Zt,{DEFAULT_ERROR:()=>fl,IBaseJsonRpcProvider:()=>Yp,IEvents:()=>ja,IJsonRpcConnection:()=>GA,IJsonRpcProvider:()=>hl,INTERNAL_ERROR:()=>Hp,INVALID_PARAMS:()=>fR,INVALID_REQUEST:()=>cR,METHOD_NOT_FOUND:()=>lR,PARSE_ERROR:()=>uR,RESERVED_ERROR_CODES:()=>PA,SERVER_ERROR:()=>ll,SERVER_ERROR_CODE_RANGE:()=>Gp,STANDARD_ERROR_MAP:()=>Wi,formatErrorMessage:()=>bR,formatJsonRpcError:()=>VA,formatJsonRpcRequest:()=>qA,formatJsonRpcResult:()=>iK,getBigIntRpcId:()=>UA,getError:()=>Qp,getErrorByCode:()=>Wp,isHttpUrl:()=>fK,isJsonRpcError:()=>Xp,isJsonRpcPayload:()=>jA,isJsonRpcRequest:()=>hK,isJsonRpcResponse:()=>QA,isJsonRpcResult:()=>PR,isJsonRpcValidationInvalid:()=>dK,isLocalhostUrl:()=>kA,isNodeJs:()=>vR,isReservedErrorCode:()=>jp,isServerErrorCode:()=>eK,isValidDefaultRoute:()=>zp,isValidErrorCode:()=>hR,isValidLeadingWildcardRoute:()=>oK,isValidRoute:()=>sK,isValidTrailingWildcardRoute:()=>aK,isValidWildcardRoute:()=>Kp,isWsUrl:()=>Jp,parseConnectionError:()=>RA,payloadId:()=>MA,validateJsonRpcError:()=>tK});var dl=ge(()=>{c();kp();BA();AR();Ht(Zt,Ft);_R();IR();NR();DR();RR()});var BR,Zp,LR,WA=ge(()=>{c();BR=_e(Kn());dl();Zp=class extends hl{constructor(e){super(e),this.events=new BR.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(qA(e.method,e.params||[],e.id||UA().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{Xp(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),QA(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},LR=Zp});var FR={};ft(FR,{JsonRpcProvider:()=>Zp,default:()=>pK});var pK,MR=ge(()=>{c();WA();WA();pK=LR});var qR=m((bge,UR)=>{"use strict";c();UR.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var VR,HR,$A,GR=ge(()=>{c();VR=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:qR(),HR=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",$A=t=>t.split("?")[0]});var jR,kR,gK,eg,QR,zA=ge(()=>{c();jR=_e(Kn());Qd();dl();GR();kR=10,gK=VR(),eg=class{constructor(e){if(this.url=e,this.events=new jR.EventEmitter,this.registering=!1,!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(qc(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!Jp(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,Zt.isReactNative)()?void 0:{rejectUnauthorized:!kA(e)},s=new gK(e,[],i);HR()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Uc(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=VA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return RA(e,$A(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>kR&&this.events.setMaxListeners(kR)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${$A(this.url)}`));return this.events.emit("register_error",r),r}},QR=eg});var WR={};ft(WR,{WsConnection:()=>eg,default:()=>yK});var yK,$R=ge(()=>{c();zA();zA();yK=QR});var x6=m((pl,Wa)=>{c();var mK=200,sb="__lodash_hash_undefined__",ug=1,s6=2,o6=9007199254740991,tg="[object Arguments]",XA="[object Array]",wK="[object AsyncFunction]",a6="[object Boolean]",u6="[object Date]",c6="[object Error]",l6="[object Function]",EK="[object GeneratorFunction]",rg="[object Map]",f6="[object Number]",vK="[object Null]",Qa="[object Object]",zR="[object Promise]",AK="[object Proxy]",h6="[object RegExp]",ng="[object Set]",d6="[object String]",bK="[object Symbol]",_K="[object Undefined]",ZA="[object WeakMap]",p6="[object ArrayBuffer]",ig="[object DataView]",IK="[object Float32Array]",SK="[object Float64Array]",TK="[object Int8Array]",CK="[object Int16Array]",xK="[object Int32Array]",NK="[object Uint8Array]",OK="[object Uint8ClampedArray]",DK="[object Uint16Array]",PK="[object Uint32Array]",RK=/[\\^$.*+?()[\]{}|]/g,BK=/^\[object .+?Constructor\]$/,LK=/^(?:0|[1-9]\d*)$/,rt={};rt[IK]=rt[SK]=rt[TK]=rt[CK]=rt[xK]=rt[NK]=rt[OK]=rt[DK]=rt[PK]=!0;rt[tg]=rt[XA]=rt[p6]=rt[a6]=rt[ig]=rt[u6]=rt[c6]=rt[l6]=rt[rg]=rt[f6]=rt[Qa]=rt[h6]=rt[ng]=rt[d6]=rt[ZA]=!1;var g6=typeof global=="object"&&global&&global.Object===Object&&global,FK=typeof self=="object"&&self&&self.Object===Object&&self,si=g6||FK||Function("return this")(),y6=typeof pl=="object"&&pl&&!pl.nodeType&&pl,KR=y6&&typeof Wa=="object"&&Wa&&!Wa.nodeType&&Wa,m6=KR&&KR.exports===y6,KA=m6&&g6.process,YR=function(){try{return KA&&KA.binding&&KA.binding("util")}catch{}}(),JR=YR&&YR.isTypedArray;function MK(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function dY(t,e){var r=this.__data__,n=lg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}oi.prototype.clear=cY;oi.prototype.delete=lY;oi.prototype.get=fY;oi.prototype.has=hY;oi.prototype.set=dY;function to(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var l=s.get(t);if(l&&s.get(e))return l==e;var f=-1,d=!0,g=r&s6?new og:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=o6}function T6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ml(t){return t!=null&&typeof t=="object"}var C6=JR?HK(JR):OY;function jY(t){return GY(t)?TY(t):DY(t)}function QY(){return[]}function WY(){return!1}Wa.exports=kY});var P8=m(me=>{"use strict";c();Object.defineProperty(me,"__esModule",{value:!0});var no=Kn(),$Y=KO(),Al=f2(),Qe=qv(),ui=n1(),N6=(Qd(),ct(S2)),zY=(KD(),ct(zD)),ee=cl(),KY=(uA(),ct(aA)),We=ks(),YY=(MR(),ct(FR)),_r=(dl(),ct(Zt)),JY=($R(),ct(WR)),XY=x6();function Tg(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function ZY(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var eJ=Tg(no),tJ=Tg($Y),hg=ZY(zY),rJ=Tg(JY),nJ=Tg(XY);function iJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var I=E[B],N=0,_=U-1;(I!==0||N>>0,A[_]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");D=N,B++}for(var S=U-D;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);E[T];){var A=r[E.charCodeAt(T)];if(A===255)return;for(var I=0,N=W-1;(A!==0||I>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=I,T++}if(E[T]!==" "){for(var _=W-B;_!==W&&U[_]===0;)_++;for(var S=new Uint8Array(D+(W-_)),R=D;_!==W;)S[R++]=U[_++];return S}}}function w(E){var T=g(E);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:g,decode:w}}var sJ=iJ,oJ=sJ,W6=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},aJ=t=>new TextEncoder().encode(t),uJ=t=>new TextDecoder().decode(t),ub=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},cb=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return $6(this,e)}},lb=class{constructor(e){this.decoders=e}or(e){return $6(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},$6=(t,e)=>new lb({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),fb=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new ub(e,r,n),this.decoder=new cb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Cg=({name:t,prefix:e,encode:r,decode:n})=>new fb(t,e,r,n),bl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=oJ(r,e);return Cg({prefix:t,name:e,encode:n,decode:s=>W6(i(s))})},cJ=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[l++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},lJ=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Cg({prefix:e,name:t,encode(i){return lJ(i,n,r)},decode(i){return cJ(i,n,r,t)}}),fJ=Cg({prefix:"\0",name:"identity",encode:t=>uJ(t),decode:t=>aJ(t)}),hJ=Object.freeze({__proto__:null,identity:fJ}),dJ=kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),pJ=Object.freeze({__proto__:null,base2:dJ}),gJ=kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),yJ=Object.freeze({__proto__:null,base8:gJ}),mJ=bl({prefix:"9",name:"base10",alphabet:"0123456789"}),wJ=Object.freeze({__proto__:null,base10:mJ}),EJ=kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),vJ=kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),AJ=Object.freeze({__proto__:null,base16:EJ,base16upper:vJ}),bJ=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_J=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),IJ=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SJ=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),TJ=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CJ=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),xJ=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),NJ=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),OJ=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),DJ=Object.freeze({__proto__:null,base32:bJ,base32upper:_J,base32pad:IJ,base32padupper:SJ,base32hex:TJ,base32hexupper:CJ,base32hexpad:xJ,base32hexpadupper:NJ,base32z:OJ}),PJ=bl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),RJ=bl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),BJ=Object.freeze({__proto__:null,base36:PJ,base36upper:RJ}),LJ=bl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),FJ=bl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),MJ=Object.freeze({__proto__:null,base58btc:LJ,base58flickr:FJ}),UJ=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),qJ=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),VJ=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),HJ=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),GJ=Object.freeze({__proto__:null,base64:UJ,base64pad:qJ,base64url:VJ,base64urlpad:HJ}),z6=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),kJ=z6.reduce((t,e,r)=>(t[r]=e,t),[]),jJ=z6.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function QJ(t){return t.reduce((e,r)=>(e+=kJ[r],e),"")}function WJ(t){let e=[];for(let r of t){let n=jJ[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var $J=Cg({prefix:"\u{1F680}",name:"base256emoji",encode:QJ,decode:WJ}),zJ=Object.freeze({__proto__:null,base256emoji:$J}),KJ=K6,O6=128,YJ=127,JJ=~YJ,XJ=Math.pow(2,31);function K6(t,e,r){e=e||[],r=r||0;for(var n=r;t>=XJ;)e[r++]=t&255|O6,t/=128;for(;t&JJ;)e[r++]=t&255|O6,t>>>=7;return e[r]=t|0,K6.bytes=r-n+1,e}var ZJ=hb,eX=128,D6=127;function hb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw hb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&D6)<=eX);return hb.bytes=s-n,r}var tX=Math.pow(2,7),rX=Math.pow(2,14),nX=Math.pow(2,21),iX=Math.pow(2,28),sX=Math.pow(2,35),oX=Math.pow(2,42),aX=Math.pow(2,49),uX=Math.pow(2,56),cX=Math.pow(2,63),lX=function(t){return t(Y6.encode(t,e,r),e),R6=t=>Y6.encodingLength(t),db=(t,e)=>{let r=e.byteLength,n=R6(t),i=n+R6(r),s=new Uint8Array(i+r);return P6(t,s,0),P6(r,s,n),s.set(e,i),new pb(t,r,e,s)},pb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},J6=({name:t,code:e,encode:r})=>new gb(t,e,r),gb=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?db(this.code,r):r.then(n=>db(this.code,n))}else throw Error("Unknown type, must be binary type")}},X6=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),hX=J6({name:"sha2-256",code:18,encode:X6("SHA-256")}),dX=J6({name:"sha2-512",code:19,encode:X6("SHA-512")}),pX=Object.freeze({__proto__:null,sha256:hX,sha512:dX}),Z6=0,gX="identity",e8=W6,yX=t=>db(Z6,e8(t)),mX={code:Z6,name:gX,encode:e8,digest:yX},wX=Object.freeze({__proto__:null,identity:mX});new TextEncoder,new TextDecoder;var B6={...hJ,...pJ,...yJ,...wJ,...AJ,...DJ,...BJ,...MJ,...GJ,...zJ};({...pX,...wX});function t8(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function EX(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?t8(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function r8(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var L6=r8("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),ob=r8("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=EX(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},yg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=o8,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=hg.generateKeyPair(i);return hg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=hg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=a8;return await hg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=N6.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,w=a.receiverPublicKey;i=await this.generateSharedKey(g,w)}let l=this.getSymKey(i),{type:f,senderPublicKey:d}=a;return ee.encrypt({type:f,symKey:l,message:u,senderPublicKey:d})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,l=a.senderPublicKey;i=await this.generateSharedKey(u,l)}try{let u=this.getSymKey(i),l=ee.decrypt({symKey:u,encoded:s});return N6.safeJsonParse(l)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?KY.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new gg(this.core,this.logger)}get context(){return Qe.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(yb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(yb,e)}return AX(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},mg=class extends ui.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=l8,this.version=f8,this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Eb=class extends ui.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new no.EventEmitter,this.name=d8,this.queue=new Map,this.publishTimeout=We.toMiliseconds(We.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||h8,u=ee.getRelayProtocolName(s),l=s?.prompt||!1,f=s?.tag||0,d=s?.id||_r.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:l,tag:f,id:d}},w=setTimeout(()=>this.queue.set(d,g),this.publishTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,a,u,l,f,d),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(d),this.relayer.events.emit(nr.publish,g)}catch(E){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(d),E;return}finally{clearTimeout(w)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,l,f,d;let g={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return ee.isUndefined((u=g.params)==null?void 0:u.prompt)&&((l=g.params)==null||delete l.prompt),ee.isUndefined((f=g.params)==null?void 0:f.tag)&&((d=g.params)==null||delete d.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(nr.connection_stalled);return}this.checkQueue()}),this.relayer.on(nr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},vb=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},TX=Object.defineProperty,CX=Object.defineProperties,xX=Object.getOwnPropertyDescriptors,F6=Object.getOwnPropertySymbols,NX=Object.prototype.hasOwnProperty,OX=Object.prototype.propertyIsEnumerable,M6=(t,e,r)=>e in t?TX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,El=(t,e)=>{for(var r in e||(e={}))NX.call(e,r)&&M6(t,r,e[r]);if(F6)for(var r of F6(e))OX.call(e,r)&&M6(t,r,e[r]);return t},ab=(t,e)=>CX(t,xX(e)),wg=class extends ui.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new vb,this.events=new no.EventEmitter,this.name=_8,this.version=I8,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ai,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new We.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=S8&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(nr.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(nr.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,ab(El({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,El({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,El({},r)),this.topicMap.set(r.topic,e),this.events.emit(Hr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Hr.deleted,ab(El({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Hr.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>ab(El({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(nr.connect,async()=>{await this.onConnect()}),this.relayer.on(nr.disconnect,()=>{this.onDisconnect()}),this.events.on(Hr.created,async e=>{let r=Hr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Hr.deleted,async e=>{let r=Hr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},DX=Object.defineProperty,U6=Object.getOwnPropertySymbols,PX=Object.prototype.hasOwnProperty,RX=Object.prototype.propertyIsEnumerable,q6=(t,e,r)=>e in t?DX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,BX=(t,e)=>{for(var r in e||(e={}))PX.call(e,r)&&q6(t,r,e[r]);if(U6)for(var r of U6(e))RX.call(e,r)&&q6(t,r,e[r]);return t},Eg=class extends ui.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new no.EventEmitter,this.name=y8,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(nr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(nr.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Nn.payload,this.onPayloadHandler),this.provider.on(Nn.connect,this.onConnectHandler),this.provider.on(Nn.disconnect,this.onDisconnectHandler),this.provider.on(Nn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||g8})),this.messages=new mg(this.logger,e.core),this.subscriber=new wg(this,this.logger),this.publisher=new Eb(this,this.logger),this.relayUrl=e?.relayUrl||bb,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${mb}...`),await this.restartTransport(mb)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},v8)}get context(){return Qe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(Hr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Hr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ee.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(Hr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await ee.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Nn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ee.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new YY.JsonRpcProvider(new rJ.default(ee.formatRelayRpcUrl({sdkVersion:E8,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),_r.isJsonRpcRequest(e)){if(!e.method.endsWith(m8))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(BX({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else _r.isJsonRpcResponse(e)&&this.events.emit(nr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(nr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=_r.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Nn.payload,this.onPayloadHandler),this.provider.off(Nn.connect,this.onConnectHandler),this.provider.off(Nn.disconnect,this.onDisconnectHandler),this.provider.off(Nn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(nr.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await ee.isOnline();ee.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(nr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},We.toMiliseconds(w8)))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},LX=Object.defineProperty,V6=Object.getOwnPropertySymbols,FX=Object.prototype.hasOwnProperty,MX=Object.prototype.propertyIsEnumerable,H6=(t,e,r)=>e in t?LX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,G6=(t,e)=>{for(var r in e||(e={}))FX.call(e,r)&&H6(t,r,e[r]);if(V6)for(var r of V6(e))MX.call(e,r)&&H6(t,r,e[r]);return t},vg=class extends ui.IStore{constructor(e,r,n,i=ai,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=A8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>nJ.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=G6(G6({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ag=class{constructor(e,r){this.core=e,this.logger=r,this.name=T8,this.version=C8,this.events=new eJ.default,this.initialized=!1,this.storagePrefix=ai,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(We.FIVE_MINUTES),o={protocol:p8},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}));let u=ee.calcExpiry(We.FIVE_MINUTES),l={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,l),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(vl.create,l),l},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(We.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:l})=>{l?u(l):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=_r.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=za[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=_r.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[u.request.method].res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=_r.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),l=za[u.request.method]?za[u.request.method].res:za.unregistered_method.res;await this.core.relayer.publish(i,a,l),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(vl.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{_r.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):_r.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(vl.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new vg(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(nr.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{_r.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):_r.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(vl.expire,{topic:r}))})}},bg=class extends ui.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new no.EventEmitter,this.name=x8,this.version=N8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ee.calcExpiry(We.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(Yr.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=_r.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(Yr.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(Yr.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:_r.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Yr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Yr.created,e=>{let r=Yr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.updated,e=>{let r=Yr.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(Yr.deleted,e=>{let r=Yr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{We.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},_g=class extends ui.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new no.EventEmitter,this.name=O8,this.version=D8,this.cached=[],this.initialized=!1,this.storagePrefix=ai,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Vr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Vr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Vr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;We.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Al.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let r=Vr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let r=Vr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let r=Vr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Ig=class extends ui.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=dg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||ee.isReactNative()||!ee.isBrowser())return;let n=pg;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i)}if(!this.initialized){this.removeIframe(),this.verifyUrl=wb;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=n?.verifyUrl||pg,s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,wb)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(We.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(dg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=dg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},We.toMiliseconds(We.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=pg,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),We.toMiliseconds(e))}},UX=Object.defineProperty,k6=Object.getOwnPropertySymbols,qX=Object.prototype.hasOwnProperty,VX=Object.prototype.propertyIsEnumerable,j6=(t,e,r)=>e in t?UX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Q6=(t,e)=>{for(var r in e||(e={}))qX.call(e,r)&&j6(t,r,e[r]);if(k6)for(var r of k6(e))VX.call(e,r)&&j6(t,r,e[r]);return t},Sg=class t extends ui.ICore{constructor(e){super(e),this.protocol=Ab,this.version=n8,this.name=xg,this.events=new no.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||bb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||i8.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Al.HeartBeat,this.crypto=new yg(this,this.logger,e?.keychain),this.history=new bg(this,this.logger),this.expirer=new _g(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new tJ.default(Q6(Q6({},s8),e?.storageOptions)),this.relayer=new Eg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Ag(this,this.logger),this.verify=new Ig(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(b8,n),r}get context(){return Qe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},HX=Sg;me.CORE_CONTEXT=xg,me.CORE_DEFAULT=i8,me.CORE_PROTOCOL=Ab,me.CORE_STORAGE_OPTIONS=s8,me.CORE_STORAGE_PREFIX=ai,me.CORE_VERSION=n8,me.CRYPTO_CLIENT_SEED=yb,me.CRYPTO_CONTEXT=o8,me.CRYPTO_JWT_TTL=a8,me.Core=HX,me.Crypto=yg,me.EXPIRER_CONTEXT=O8,me.EXPIRER_DEFAULT_TTL=SX,me.EXPIRER_EVENTS=Vr,me.EXPIRER_STORAGE_VERSION=D8,me.Expirer=_g,me.HISTORY_CONTEXT=x8,me.HISTORY_EVENTS=Yr,me.HISTORY_STORAGE_VERSION=N8,me.JsonRpcHistory=bg,me.KEYCHAIN_CONTEXT=u8,me.KEYCHAIN_STORAGE_VERSION=c8,me.KeyChain=gg,me.MESSAGES_CONTEXT=l8,me.MESSAGES_STORAGE_VERSION=f8,me.MessageTracker=mg,me.PAIRING_CONTEXT=T8,me.PAIRING_DEFAULT_TTL=IX,me.PAIRING_EVENTS=vl,me.PAIRING_RPC_OPTS=za,me.PAIRING_STORAGE_VERSION=C8,me.PENDING_SUB_RESOLUTION_TIMEOUT=S8,me.PUBLISHER_CONTEXT=d8,me.PUBLISHER_DEFAULT_TTL=h8,me.Pairing=Ag,me.RELAYER_CONTEXT=y8,me.RELAYER_DEFAULT_LOGGER=g8,me.RELAYER_DEFAULT_PROTOCOL=p8,me.RELAYER_DEFAULT_RELAY_URL=bb,me.RELAYER_EVENTS=nr,me.RELAYER_FAILOVER_RELAY_URL=mb,me.RELAYER_PROVIDER_EVENTS=Nn,me.RELAYER_RECONNECT_TIMEOUT=w8,me.RELAYER_SDK_VERSION=E8,me.RELAYER_STORAGE_OPTIONS=bX,me.RELAYER_SUBSCRIBER_SUFFIX=m8,me.RELAYER_TRANSPORT_CUTOFF=v8,me.Relayer=Eg,me.STORE_STORAGE_VERSION=A8,me.SUBSCRIBER_CONTEXT=_8,me.SUBSCRIBER_DEFAULT_TTL=_X,me.SUBSCRIBER_EVENTS=Hr,me.SUBSCRIBER_STORAGE_VERSION=I8,me.Store=vg,me.Subscriber=wg,me.VERIFY_CONTEXT=dg,me.VERIFY_FALLBACK_SERVER=wb,me.VERIFY_SERVER=pg,me.Verify=Ig,me.WALLETCONNECT_CLIENT_ID=b8,me.default=Sg});var k8=m(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});var Dn=P8(),Ng=qv(),L8=n1(),j=cl(),F8=Kn(),Xe=ks(),yt=(dl(),ct(Zt));function GX(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var kX=GX(F8),xb="wc",Nb=2,Ob="client",Rg=`${xb}@${Nb}:${Ob}:`,Og={name:Ob,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},jX={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},QX={database:":memory:"},_b="WALLETCONNECT_DEEPLINK_CHOICE",WX={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},$X="history",zX="0.3",M8="proposal",KX=Xe.THIRTY_DAYS,U8="Proposal expired",q8="session",Il=Xe.SEVEN_DAYS,V8="engine",Ka={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Dg={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},On={idle:"IDLE",active:"ACTIVE"},H8="request",G8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],YX=Object.defineProperty,JX=Object.defineProperties,XX=Object.getOwnPropertyDescriptors,R8=Object.getOwnPropertySymbols,ZX=Object.prototype.hasOwnProperty,eZ=Object.prototype.propertyIsEnumerable,B8=(t,e,r)=>e in t?YX(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gr=(t,e)=>{for(var r in e||(e={}))ZX.call(e,r)&&B8(t,r,e[r]);if(R8)for(var r of R8(e))eZ.call(e,r)&&B8(t,r,e[r]);return t},_l=(t,e)=>JX(t,XX(e)),Ib=class extends L8.IEngine{constructor(e){super(e),this.name=V8,this.events=new kX.default,this.initialized=!1,this.ignoredPayloadTypes=[j.TYPE_1],this.requestQueue={state:On.idle,queue:[]},this.sessionRequestQueue={state:On.idle,queue:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Ka)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=_l(gr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,l=i,f,d=!1;if(l&&(d=this.client.core.pairing.pairings.get(l).active),!l||!d){let{topic:U,uri:A}=await this.client.core.pairing.create();l=U,f=A}let g=await this.client.core.crypto.generateKeyPair(),w=gr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Dn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:E,resolve:T,done:D}=j.createDelayedPromise(Xe.FIVE_MINUTES,U8);if(this.events.once(j.engineEvent("session_connect"),async({error:U,session:A})=>{if(U)E(U);else if(A){A.self.publicKey=g;let I=_l(gr({},A),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(A.topic,I),await this.setExpiry(A.topic,A.expiry),l&&await this.client.core.pairing.updateMetadata({topic:l,metadata:A.peer.metadata}),T(I)}}),!l){let{message:U}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw new Error(U)}let B=await this.sendRequest({topic:l,method:"wc_sessionPropose",params:w}),W=j.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(B,gr({id:B,expiry:W},w)),{uri:f,approval:D}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:l,requiredNamespaces:f,optionalNamespaces:d}=a;u=u||"",j.isValidObject(f)||(f=j.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),w=l.publicKey,E=await this.client.core.crypto.generateSharedKey(g,w);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:l.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=gr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:d,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:j.calcExpiry(Il)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(E),await this.sendRequest({topic:E,method:"wc_sessionSettle",params:T,throwOnFailedPublish:!0});let D=_l(gr({},T),{topic:E,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:g});return await this.client.session.set(E,D),await this.setExpiry(E,j.calcExpiry(Il)),{topic:E,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(E)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_update",s),({error:l})=>{l?u(l):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,j.calcExpiry(Il)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=yt.payloadId(),{done:u,resolve:l,reject:f}=j.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(j.engineEvent("session_request",a),({error:d,result:g})=>{d?f(d):l(g)}),await Promise.all([new Promise(async d=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),d()}),new Promise(async d=>{let g=await this.client.core.storage.getItem(_b);j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),d()}),u()]).then(d=>d[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;yt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):yt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(_b).catch(s=>this.client.logger.warn(s))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=On.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Ka.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,j.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:l}=r,f=yt.formatJsonRpcRequest(i,s,u);if(j.isBrowser()&&G8.includes(i)){let w=j.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:w})}let d=await this.client.core.crypto.encode(n,f),g=Ka[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),l?(g.internal=_l(gr({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,d,g)):this.client.core.relayer.publish(n,d,g).catch(w=>this.client.logger.error(w)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=yt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),l=await this.client.core.history.get(i,n),f=Ka[l.request.method].res;o?(f.internal=_l(gr({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(d=>this.client.logger.error(d)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=yt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Ka[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{j.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===On.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=On.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=On.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(gr({},n.params));let o=j.calcExpiry(Xe.FIVE_MINUTES),a=gr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=j.hashMessage(JSON.stringify(n)),l=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:l})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(yt.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let l=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:l});let f=await this.client.core.relayer.subscribe(l);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else yt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:l,requiredNamespaces:f,optionalNamespaces:d,sessionProperties:g,pairingTopic:w}=n.params,E=gr({topic:r,relay:o,expiry:u,namespaces:l,acknowledged:!0,pairingTopic:w,requiredNamespaces:f,optionalNamespaces:d,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(j.engineEvent("session_connect"),{session:E}),this.cleanupDuplicatePairings(E)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):yt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(gr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),j.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,j.calcExpiry(Il)),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Dn.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(gr({topic:r},s));let o=j.hashMessage(JSON.stringify(yt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),l={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(l),this.addSessionRequestToSessionRequestQueue(l),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(gr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=On.idle,this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===On.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=On.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,yt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(a,!0)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=j.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let l=j.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(l)throw new Error(l.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:l}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(l)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:l}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(l)}let a=j.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=j.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(j.isExpired(o)){let{message:l}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(l)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!j.isValidNamespacesChainId(a,s)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j.isValidRequest(i)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!j.isValidNamespacesRequest(a,s,i.method)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!j.isValidRequestExpiry(o,Dg)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Dg.min} and ${Dg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!j.isValidResponse(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!j.isValidNamespacesChainId(o,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!j.isValidEvent(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Dn.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Dn.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);try{yt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):yt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Dn.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Dn.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=j.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Sb=class extends Dn.Store{constructor(e,r){super(e,r,M8,Rg),this.core=e,this.logger=r}},Tb=class extends Dn.Store{constructor(e,r){super(e,r,q8,Rg),this.core=e,this.logger=r}},Cb=class extends Dn.Store{constructor(e,r){super(e,r,H8,Rg,n=>n.id),this.core=e,this.logger=r}},Pg=class t extends L8.ISignClient{constructor(e){super(e),this.protocol=xb,this.version=Nb,this.name=Og.name,this.events=new F8.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||Og.name,this.metadata=e?.metadata||j.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Ng.pino(Ng.getDefaultLoggerOptions({level:e?.logger||Og.logger}));this.core=e?.core||new Dn.Core(e),this.logger=Ng.generateChildLogger(r,this.name),this.session=new Tb(this.core,this.logger),this.proposal=new Sb(this.core,this.logger),this.pendingRequest=new Cb(this.core,this.logger),this.engine=new Ib(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Ng.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},tZ=Pg;Je.ENGINE_CONTEXT=V8,Je.ENGINE_QUEUE_STATES=On,Je.ENGINE_RPC_OPTS=Ka,Je.HISTORY_CONTEXT=$X,Je.HISTORY_EVENTS=WX,Je.HISTORY_STORAGE_VERSION=zX,Je.METHODS_TO_VERIFY=G8,Je.PROPOSAL_CONTEXT=M8,Je.PROPOSAL_EXPIRY=KX,Je.PROPOSAL_EXPIRY_MESSAGE=U8,Je.REQUEST_CONTEXT=H8,Je.SESSION_CONTEXT=q8,Je.SESSION_EXPIRY=Il,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Dg,Je.SIGN_CLIENT_CONTEXT=Ob,Je.SIGN_CLIENT_DEFAULT=Og,Je.SIGN_CLIENT_EVENTS=jX,Je.SIGN_CLIENT_PROTOCOL=xb,Je.SIGN_CLIENT_STORAGE_OPTIONS=QX,Je.SIGN_CLIENT_STORAGE_PREFIX=Rg,Je.SIGN_CLIENT_VERSION=Nb,Je.SignClient=tZ,Je.WALLETCONNECT_DEEPLINK_CHOICE=_b,Je.default=Pg});var Bg=m(Ji=>{"use strict";c();Object.defineProperty(Ji,"__esModule",{value:!0});Ji.OptionalOperation=Ji.Operation=void 0;var rZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(rZ=Ji.Operation||(Ji.Operation={}));var nZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(nZ=Ji.OptionalOperation||(Ji.OptionalOperation={}))});var Db=m(Pn=>{"use strict";c();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Pn.WALLETCONNECT_MULTIVERSX_METHODS=Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var j8=Bg();Pn.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Pn.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(j8.Operation);Pn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(j8.OptionalOperation);Pn.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var Bb=m(Jr=>{"use strict";c();Object.defineProperty(Jr,"__esModule",{value:!0});Jr.WalletConnectV2ProviderErrorMessagesEnum=Jr.ErrBadAddress=Jr.ErrNotImplemented=Jr.Err=void 0;var Sl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Jr.Err=Sl;var Pb=class extends Sl{constructor(){super("Method not yet implemented")}};Jr.ErrNotImplemented=Pb;var Rb=class extends Sl{constructor(e,r){super(`Bad address: ${e}`,r)}};Jr.ErrBadAddress=Rb;var iZ;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(iZ=Jr.WalletConnectV2ProviderErrorMessagesEnum||(Jr.WalletConnectV2ProviderErrorMessagesEnum={}))});var Fb=m(Lg=>{"use strict";c();Object.defineProperty(Lg,"__esModule",{value:!0});Lg.Logger=void 0;var Lb=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Lg.Logger=Lb});var Q8=m(()=>{"use strict";c();global.Buffer||(global.Buffer=Ps().Buffer)});var $8=m(W8=>{"use strict";c();Object.defineProperty(W8,"__esModule",{value:!0})});var K8=m(z8=>{"use strict";c();Object.defineProperty(z8,"__esModule",{value:!0})});var Y8=m(Ya=>{"use strict";c();var sZ=Ya&&Ya.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.RelayedTransactionV1Builder=void 0;var oZ=sZ(Gt()),Mb=ht(),aZ=Be(),uZ=wn(),cZ=jn(),Ub=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new aZ.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${h.Buffer.from(e).toString("hex")}`,n=new cZ.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new uZ.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new Mb.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Mb.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new oZ.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:h.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new Mb.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?h.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?h.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};Ya.RelayedTransactionV1Builder=Ub});var J8=m(Fg=>{"use strict";c();Object.defineProperty(Fg,"__esModule",{value:!0});Fg.Code=void 0;var qb=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}toString(){return this.hex}valueOf(){return h.Buffer.from(this.hex,"hex")}};Fg.Code=qb});var Z8=m(X8=>{"use strict";c();Object.defineProperty(X8,"__esModule",{value:!0})});var nB=m(Xa=>{"use strict";c();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.bech32m=Xa.bech32=void 0;var Mg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tB={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function eB(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=Ja(e)^n>>5}e=Ja(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let l=eB(o);if(typeof l=="string")throw new Error(l);let f=o+"1";for(let d=0;d>5)throw new Error("Non 5-bit word");l=Ja(l)^g,f+=Mg.charAt(g)}for(let d=0;d<6;++d)l=Ja(l);l^=e;for(let d=0;d<6;++d){let g=l>>(5-d)*5&31;f+=Mg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),l=o.toUpperCase();if(o!==u&&o!==l)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let d=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let w=eB(d);if(typeof w=="string")return w;let E=[];for(let T=0;T=g.length)&&E.push(B)}return w!==e?"Invalid checksum for "+o:{prefix:d,words:E}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:lZ,fromWordsUnsafe:fZ,fromWords:hZ}}Xa.bech32=rB("bech32");Xa.bech32m=rB("bech32m")});var sB=m(Gr=>{"use strict";c();Object.defineProperty(Gr,"__esModule",{value:!0});Gr.TokenTransferProperties=Gr.TransactionMetadataTransfer=Gr.TransactionMetadata=Gr.TransactionToDecode=Gr.TransactionDecoder=void 0;var iB=nB(),Hb=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new io;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Ug;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new io;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new io;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return h.Buffer.from(e).toString("base64")}base64Decode(e){return h.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new io;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=h.Buffer.from(e,"hex"),n=iB.bech32.toWords(r);return iB.bech32.encode("erd",n)}isAddressValid(e){return h.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return h.Buffer.from(e,"base64").toString("hex")}hexToString(e){return h.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};Gr.TransactionDecoder=Hb;var Ug=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};Gr.TransactionToDecode=Ug;var io=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};Gr.TransactionMetadata=io;var Gb=class{constructor(){this.value=BigInt(0)}};Gr.TransactionMetadataTransfer=Gb;var kb=class{};Gr.TokenTransferProperties=kb});var jb=m(qg=>{"use strict";c();Object.defineProperty(qg,"__esModule",{value:!0});qg.ReturnCode=void 0;var Ge=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};qg.ReturnCode=Ge;Ge.None=new Ge("");Ge.Ok=new Ge("ok");Ge.FunctionNotFound=new Ge("function not found");Ge.FunctionWrongSignature=new Ge("wrong signature for function");Ge.ContractNotFound=new Ge("contract not found");Ge.UserError=new Ge("user error");Ge.OutOfGas=new Ge("out of gas");Ge.AccountCollision=new Ge("account collision");Ge.OutOfFunds=new Ge("out of funds");Ge.CallStackOverFlow=new Ge("call stack overflow");Ge.ContractInvalid=new Ge("contract invalid");Ge.ExecutionFailed=new Ge("execution failed");Ge.Unknown=new Ge("unknown")});var uB=m(Vg=>{"use strict";c();Object.defineProperty(Vg,"__esModule",{value:!0});Vg.ResultsParser=void 0;var dZ=sB(),oB=ht(),aB=Be(),Xi=na(),pZ=Wo(),Za=jb(),eu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(eu||(eu={}));var Qb;(function(t){t.TooMuchGas="@too much gas provided for processing"})(Qb||(Qb={}));var gZ={argsSerializer:new pZ.ArgSerializer},Wb=class{constructor(e){e=Object.assign(Object.assign({},gZ),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new Za.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new Za.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return Xi.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return Xi.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return Xi.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return Xi.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return Xi.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return Xi.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new aB.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new dZ.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:Za.ReturnCode.None,returnMessage:Za.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:Za.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(eu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(eu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(Qb.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new oB.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(eu.OnWriteLog,u=>u.findFirstOrNoneTopic(l=>l.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new oB.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(eu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),l=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&l});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||h.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new aB.ErrCannotParseContractResults("no return code");return{returnCode:Za.ReturnCode.fromBuffer(i),returnDataParts:s}}};Vg.ResultsParser=Wb});var $b=m(At=>{"use strict";c();var yZ=At&&At.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),ir=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&yZ(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});ir(Wo(),At);ir(J8(),At);ir(pw(),At);ir(cE(),At);ir(wc(),At);ir(wE(),At);ir(dE(),At);ir(Z8(),At);ir(AE(),At);ir(Ec(),At);ir(uB(),At);ir(jb(),At);ir(fv(),At);ir(xE(),At);ir(St(),At)});var lB=m(Hg=>{"use strict";c();Object.defineProperty(Hg,"__esModule",{value:!0});Hg.RelayedTransactionV2Builder=void 0;var cB=Be(),Tl=$b(),mZ=wn(),wZ=jn(),zb=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new cB.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new cB.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Tl.ArgSerializer().valuesToString([new Tl.AddressValue(this.innerTransaction.getReceiver()),new Tl.U64Value(this.innerTransaction.getNonce().valueOf()),new Tl.BytesValue(this.innerTransaction.getData().valueOf()),new Tl.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new wZ.TransactionPayload(r),i=new mZ.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};Hg.RelayedTransactionV2Builder=zb});var fB=m(so=>{"use strict";c();Object.defineProperty(so,"__esModule",{value:!0});so.SignableMessage=so.MESSAGE_PREFIX=void 0;var EZ=ht(),vZ=av();so.MESSAGE_PREFIX=`Elrond Signed Message: -`;var Kb=class{constructor(e){this.message=h.Buffer.from([]),this.signature=h.Buffer.from([]),this.version=1,this.signer="ErdJS",this.address=new EZ.Address,Object.assign(this,e)}serializeForSigning(){let e=h.Buffer.from(this.message.length.toString()),r=h.Buffer.concat([e,this.message]),n=h.Buffer.concat([h.Buffer.from(so.MESSAGE_PREFIX),r]);return vZ("keccak256").update(n).digest()}serializeForSigningRaw(){return h.Buffer.concat([this.getMessageSize(),this.message])}getSignature(){return this.signature}applySignature(e){e instanceof h.Buffer?this.signature=e:this.signature=h.Buffer.from(e.hex(),"hex")}getMessageSize(){let e=h.Buffer.alloc(4);return e.writeUInt32BE(this.message.length,0),e}toJSON(){return{address:this.address.bech32(),message:"0x"+this.message.toString("hex"),signature:"0x"+this.signature.toString("hex"),version:this.version,signer:this.signer}}};so.SignableMessage=Kb});var Jb=m(at=>{"use strict";c();var AZ=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),bZ=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),hB=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&AZ(e,t,r);return bZ(e,t),e},_Z=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var IZ=_Z(Gt()),SZ=ht(),Yb=hB(ac()),dB=hB(ph());function TZ(t){return h.Buffer.from(t)}at.stringToBuffer=TZ;function CZ(t){return t.length==0?new IZ.default(0):Yb.bufferToBigInt(t)}at.bufferToBigInt=CZ;function xZ(t){return t==0?h.Buffer.from([]):Yb.bigIntToBuffer(t)}at.bigIntToBuffer=xZ;function NZ(t){return t==0?"":Yb.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=NZ;function OZ(t){let e=h.Buffer.from(t).toString("hex");return dB.zeroPadStringIfOddLength(e)}at.utf8ToHex=OZ;function DZ(t){let e=t.toString("hex");return dB.zeroPadStringIfOddLength(e)}at.bufferToHex=DZ;function PZ(t){return SZ.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=PZ});var gB=m(Gg=>{"use strict";c();Object.defineProperty(Gg,"__esModule",{value:!0});Gg.TokenOperationsFactory=void 0;var Xb=bs(),RZ=na(),pB=cc(),BZ=wn(),LZ=jn(),ne=Jb(),Zb=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){RZ.Logger.info(` + Approved: ${a.toString()}`)),Object.keys(e).forEach(h=>{if(!h.includes(":")||n)return;let g=no(e[h].accounts);g.includes(h)||(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${h} + Required: ${h} + Approved: ${g.toString()}`))}),o.forEach(h=>{n||($i(i[h].methods,s[h].methods)?$i(i[h].events,s[h].events)||(n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${h}`)):n=ai("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${h}`))}),n}function UK(t){let e={};return Object.keys(t).forEach(r=>{var n;r.includes(":")?e[r]=t[r]:(n=t[r].chains)==null||n.forEach(i=>{e[i]={methods:t[r].methods,events:t[r].events}})}),e}function H3(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function qK(t){let e={};return Object.keys(t).forEach(r=>{r.includes(":")?e[r]=t[r]:no(t[r].accounts)?.forEach(i=>{e[i]={accounts:t[r].accounts.filter(s=>s.includes(`${i}:`)),methods:t[r].methods,events:t[r].events}})}),e}function VK(t,e){return kp(t,!1)&&t<=e.max&&t>=e.min}function HK(){let t=ro();return new Promise(e=>{switch(t){case nr.browser:e(OR());break;case nr.reactNative:e(DR());break;case nr.node:e(PR());break;default:e(!0)}})}function OR(){return Hp()&&navigator?.onLine}async function DR(){return yl()&&typeof global<"u"&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function PR(){return!0}function GK(t){switch(ro()){case nr.browser:RR(t);break;case nr.reactNative:BR(t);break;case nr.node:break}}function RR(t){!yl()&&Hp()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function BR(t){yl()&&typeof global<"u"&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}var xA={},PA=class{static get(e){return xA[e]}static set(e,r){xA[e]=r}static delete(e){delete xA[e]}};G.BASE10=FA,G.BASE16=ir,G.BASE64=Lp,G.COLON=L$,G.DEFAULT_DEPTH=VA,G.EMPTY_SPACE=Fp,G.ENV_MAP=nr,G.MemoryStore=PA,G.ONE_THOUSAND=F$,G.REACT_NATIVE_PRODUCT=nR,G.RELAYER_DEFAULT_PROTOCOL=dR,G.SDK_TYPE=sR,G.SLASH=iR,G.TYPE_0=MA,G.TYPE_1=Wa,G.UTF8=Vp,G.appendToQueryString=oR,G.assertType=H$,G.buildApprovedNamespaces=EK,G.calcExpiry=Z$,G.capitalize=z$,G.capitalizeWord=hR,G.createDelayedPromise=$$,G.createExpiringPromise=K$,G.decodeTypeByte=gl,G.decrypt=N$,G.deriveSymKey=S$,G.deserialize=qA,G.encodeTypeByte=eR,G.encrypt=x$,G.engineEvent=tK,G.enumify=W$,G.formatAccountId=$3,G.formatAccountWithChain=g$,G.formatChainId=z3,G.formatExpirerTarget=GA,G.formatIdTarget=J$,G.formatMessage=A$,G.formatMessageContext=G$,G.formatRelayParams=yR,G.formatRelayRpcUrl=q$,G.formatTopicTarget=Y$,G.formatUA=cR,G.formatUri=lK,G.generateKeyPair=I$,G.generateRandomBytes32=_$,G.getAccountsChains=no,G.getAccountsFromNamespaces=m$,G.getAddressFromAccount=K3,G.getAddressesFromAccounts=y$,G.getAppMetadata=M$,G.getBrowserOnlineStatus=OR,G.getChainFromAccount=Y3,G.getChainsFromAccounts=J3,G.getChainsFromNamespace=Up,G.getChainsFromNamespaces=w$,G.getChainsFromRequiredNamespaces=E$,G.getDidAddress=Z3,G.getDidAddressSegments=qp,G.getDidChainId=X3,G.getEnvironment=ro,G.getHttpUrl=V$,G.getInternalError=ai,G.getJavascriptID=uR,G.getJavascriptOS=aR,G.getLastItems=fR,G.getNamespacedDidChainId=v$,G.getNamespacesChains=mR,G.getNamespacesEventsForChainId=ER,G.getNamespacesMethodsForChainId=wR,G.getNodeOnlineStatus=PR,G.getReactNativeOnlineStatus=DR,G.getRelayClientMetadata=U$,G.getRelayProtocolApi=iK,G.getRelayProtocolName=nK,G.getRequiredNamespacesFromNamespaces=wK,G.getSdkError=to,G.getUniqueValues=LA,G.handleDeeplinkRedirect=rK,G.hasOverlap=$i,G.hashKey=T$,G.hashMessage=C$,G.isBrowser=Hp,G.isCaipNamespace=kA,G.isConformingNamespaces=NR,G.isExpired=eK,G.isNode=HA,G.isOnline=HK,G.isProposalStruct=_K,G.isReactNative=yl,G.isSessionCompatible=bK,G.isSessionStruct=SK,G.isTypeOneEnvelope=D$,G.isUndefined=Yi,G.isValidAccountId=AR,G.isValidAccounts=_R,G.isValidActions=TR,G.isValidArray=ml,G.isValidChainId=pl,G.isValidChains=bR,G.isValidController=TK,G.isValidErrorReason=DK,G.isValidEvent=BK,G.isValidId=NK,G.isValidNamespaceAccounts=SR,G.isValidNamespaceActions=jA,G.isValidNamespaceChains=IR,G.isValidNamespaceMethodsOrEvents=DA,G.isValidNamespaces=CR,G.isValidNamespacesChainId=LK,G.isValidNamespacesEvent=MK,G.isValidNamespacesRequest=FK,G.isValidNumber=kp,G.isValidObject=Gp,G.isValidParams=OK,G.isValidRelay=xR,G.isValidRelays=xK,G.isValidRequest=PK,G.isValidRequestExpiry=VK,G.isValidRequiredNamespaces=CK,G.isValidResponse=RK,G.isValidString=br,G.isValidUrl=IK,G.mapEntries=Q$,G.mapToObj=k$,G.mergeArrays=Ki,G.normalizeNamespaces=OA,G.objToMap=j$,G.parseAccountId=BA,G.parseChainId=W3,G.parseContextNames=lR,G.parseExpirerTarget=X$,G.parseNamespaceKey=vR,G.parseRelayParams=pR,G.parseTopic=gR,G.parseUri=cK,G.serialize=tR,G.subscribeToBrowserNetworkChange=RR,G.subscribeToNetworkChange=GK,G.subscribeToReactNativeNetworkChange=BR,G.validateDecoding=O$,G.validateEncoding=rR});var LR,FR,MR,UR,jp,El,QA,Qp,Ji,vl,Wp=fe(()=>{l();LR="PARSE_ERROR",FR="INVALID_REQUEST",MR="METHOD_NOT_FOUND",UR="INVALID_PARAMS",jp="INTERNAL_ERROR",El="SERVER_ERROR",QA=[-32700,-32600,-32601,-32602,-32603],Qp=[-32e3,-32099],Ji={[LR]:{code:-32700,message:"Parse error"},[FR]:{code:-32600,message:"Invalid Request"},[MR]:{code:-32601,message:"Method not found"},[UR]:{code:-32602,message:"Invalid params"},[jp]:{code:-32603,message:"Internal error"},[El]:{code:-32e3,message:"Server error"}},vl=El});function kK(t){return t<=Qp[0]&&t>=Qp[1]}function zp(t){return QA.includes(t)}function qR(t){return typeof t=="number"}function $p(t){return Object.keys(Ji).includes(t)?Ji[t]:Ji[vl]}function Kp(t){let e=Object.values(Ji).find(r=>r.code===t);return e||Ji[vl]}function jK(t){if(typeof t.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof t.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!qR(t.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${t.error.code}`};if(zp(t.error.code)){let e=Kp(t.error.code);if(e.message!==Ji[vl].message&&t.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${t.error.code}`}}return{valid:!0}}function WA(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var zA=fe(()=>{l();Wp()});var HR=E(Xi=>{"use strict";l();Object.defineProperty(Xi,"__esModule",{value:!0});Xi.isBrowserCryptoAvailable=Xi.getSubtleCrypto=Xi.getBrowerCrypto=void 0;function $A(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Xi.getBrowerCrypto=$A;function VR(){let t=$A();return t.subtle||t.webkitSubtle}Xi.getSubtleCrypto=VR;function QK(){return!!$A()&&!!VR()}Xi.isBrowserCryptoAvailable=QK});var jR=E(Zi=>{"use strict";l();Object.defineProperty(Zi,"__esModule",{value:!0});Zi.isBrowser=Zi.isNode=Zi.isReactNative=void 0;function GR(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Zi.isReactNative=GR;function kR(){return typeof p.default<"u"&&typeof p.default.versions<"u"&&typeof p.default.versions.node<"u"}Zi.isNode=kR;function WK(){return!GR()&&!kR()}Zi.isBrowser=WK});var KA=E(Yp=>{"use strict";l();Object.defineProperty(Yp,"__esModule",{value:!0});var QR=(Xr(),ft(Jr));QR.__exportStar(HR(),Yp);QR.__exportStar(jR(),Yp)});var Ut={};ct(Ut,{isNodeJs:()=>zR});var WR,zR,$R=fe(()=>{l();WR=be(KA());Gt(Ut,be(KA()));zR=WR.isNode});function YA(t=3){let e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function JA(t=6){return BigInt(YA(t))}function XA(t,e,r){return{id:r||YA(),jsonrpc:"2.0",method:t,params:e}}function zK(t,e){return{id:t,jsonrpc:"2.0",result:e}}function ZA(t,e,r){return{id:t,jsonrpc:"2.0",error:KR(e,r)}}function KR(t,e){return typeof t>"u"?$p(jp):(typeof t=="string"&&(t=Object.assign(Object.assign({},$p(El)),{message:t})),typeof e<"u"&&(t.data=e),zp(t.code)&&(t=Kp(t.code)),t)}var YR=fe(()=>{l();zA();Wp()});function $K(t){return t.includes("*")?Xp(t):!/\W/g.test(t)}function Jp(t){return t==="*"}function Xp(t){return Jp(t)?!0:!(!t.includes("*")||t.split("*").length!==2||t.split("*").filter(e=>e.trim()==="").length!==1)}function KK(t){return!Jp(t)&&Xp(t)&&!t.split("*")[0].trim()}function YK(t){return!Jp(t)&&Xp(t)&&!t.split("*")[1].trim()}var JR=fe(()=>{l()});var XR=fe(()=>{l()});var za,eb=fe(()=>{l();za=class{}});var tb,Zp,Al,ZR=fe(()=>{l();eb();tb=class extends za{constructor(e){super()}},Zp=class extends za{constructor(){super()}},Al=class extends Zp{constructor(e){super()}}});var e6=fe(()=>{l()});var t6=fe(()=>{l();XR();eb();ZR();e6()});var r6=fe(()=>{l();t6()});function ZK(t){let e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function n6(t,e){let r=ZK(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function eY(t){return n6(t,JK)}function eg(t){return n6(t,XK)}function rb(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}var JK,XK,i6=fe(()=>{l();JK="^https?:",XK="^wss?:"});function nb(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function tY(t){return nb(t)&&"method"in t}function ib(t){return nb(t)&&(s6(t)||tg(t))}function s6(t){return"result"in t}function tg(t){return"error"in t}function rY(t){return"error"in t&&t.valid===!1}var o6=fe(()=>{l()});var er={};ct(er,{DEFAULT_ERROR:()=>vl,IBaseJsonRpcProvider:()=>Zp,IEvents:()=>za,IJsonRpcConnection:()=>tb,IJsonRpcProvider:()=>Al,INTERNAL_ERROR:()=>jp,INVALID_PARAMS:()=>UR,INVALID_REQUEST:()=>FR,METHOD_NOT_FOUND:()=>MR,PARSE_ERROR:()=>LR,RESERVED_ERROR_CODES:()=>QA,SERVER_ERROR:()=>El,SERVER_ERROR_CODE_RANGE:()=>Qp,STANDARD_ERROR_MAP:()=>Ji,formatErrorMessage:()=>KR,formatJsonRpcError:()=>ZA,formatJsonRpcRequest:()=>XA,formatJsonRpcResult:()=>zK,getBigIntRpcId:()=>JA,getError:()=>$p,getErrorByCode:()=>Kp,isHttpUrl:()=>eY,isJsonRpcError:()=>tg,isJsonRpcPayload:()=>nb,isJsonRpcRequest:()=>tY,isJsonRpcResponse:()=>ib,isJsonRpcResult:()=>s6,isJsonRpcValidationInvalid:()=>rY,isLocalhostUrl:()=>rb,isNodeJs:()=>zR,isReservedErrorCode:()=>zp,isServerErrorCode:()=>kK,isValidDefaultRoute:()=>Jp,isValidErrorCode:()=>qR,isValidLeadingWildcardRoute:()=>KK,isValidRoute:()=>$K,isValidTrailingWildcardRoute:()=>YK,isValidWildcardRoute:()=>Xp,isWsUrl:()=>eg,parseConnectionError:()=>WA,payloadId:()=>YA,validateJsonRpcError:()=>jK});var bl=fe(()=>{l();Wp();zA();$R();Gt(er,Ut);YR();JR();r6();i6();o6()});var a6,rg,u6,sb=fe(()=>{l();a6=be(Xn());bl();rg=class extends Al{constructor(e){super(e),this.events=new a6.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(XA(e.method,e.params||[],e.id||JA().toString()),r)}async requestStrict(e,r){return new Promise(async(n,i)=>{if(!this.connection.connected)try{await this.open()}catch(s){i(s)}this.events.on(`${e.id}`,s=>{tg(s)?i(s.error):n(s.result)});try{await this.connection.send(e,r)}catch(s){i(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ib(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}},u6=rg});var c6={};ct(c6,{JsonRpcProvider:()=>rg,default:()=>nY});var nY,l6=fe(()=>{l();sb();sb();nY=u6});var h6=E((pye,f6)=>{"use strict";l();f6.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var d6,p6,ob,g6=fe(()=>{l();d6=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:h6(),p6=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",ob=t=>t.split("?")[0]});var m6,y6,iY,ng,w6,ab=fe(()=>{l();m6=be(Xn());kc();bl();g6();y6=10,iY=d6(),ng=class{constructor(e){if(this.url=e,this.events=new m6.EventEmitter,this.registering=!1,!eg(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=n=>{this.onClose(n),e()},this.socket.close()})}async send(e,r){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(Hi(e))}catch(n){this.onError(e.id,n)}}register(e=this.url){if(!eg(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return i(new Error("WebSocket connection is missing or invalid"));n(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,n)=>{let i=(0,er.isReactNative)()?void 0:{rejectUnauthorized:!rb(e)},s=new iY(e,[],i);p6()?s.onerror=o=>{let a=o;n(this.emitError(a.error))}:s.on("error",o=>{n(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),r(s)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let r=typeof e.data=="string"?Vi(e.data):e.data;this.events.emit("payload",r)}onError(e,r){let n=this.parseError(r),i=n.message||n.toString(),s=ZA(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return WA(e,ob(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>y6&&this.events.setMaxListeners(y6)}emitError(e){let r=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${ob(this.url)}`));return this.events.emit("register_error",r),r}},w6=ng});var E6={};ct(E6,{WsConnection:()=>ng,default:()=>sY});var sY,v6=fe(()=>{l();ab();ab();sY=w6});var tB=E((Il,Ka)=>{l();var oY=200,wb="__lodash_hash_undefined__",fg=1,P6=2,R6=9007199254740991,ig="[object Arguments]",fb="[object Array]",aY="[object AsyncFunction]",B6="[object Boolean]",L6="[object Date]",F6="[object Error]",M6="[object Function]",uY="[object GeneratorFunction]",sg="[object Map]",U6="[object Number]",cY="[object Null]",$a="[object Object]",A6="[object Promise]",lY="[object Proxy]",q6="[object RegExp]",og="[object Set]",V6="[object String]",fY="[object Symbol]",hY="[object Undefined]",hb="[object WeakMap]",H6="[object ArrayBuffer]",ag="[object DataView]",dY="[object Float32Array]",pY="[object Float64Array]",gY="[object Int8Array]",yY="[object Int16Array]",mY="[object Int32Array]",wY="[object Uint8Array]",EY="[object Uint8ClampedArray]",vY="[object Uint16Array]",AY="[object Uint32Array]",bY=/[\\^$.*+?()[\]{}|]/g,IY=/^\[object .+?Constructor\]$/,_Y=/^(?:0|[1-9]\d*)$/,rt={};rt[dY]=rt[pY]=rt[gY]=rt[yY]=rt[mY]=rt[wY]=rt[EY]=rt[vY]=rt[AY]=!0;rt[ig]=rt[fb]=rt[H6]=rt[B6]=rt[ag]=rt[L6]=rt[F6]=rt[M6]=rt[sg]=rt[U6]=rt[$a]=rt[q6]=rt[og]=rt[V6]=rt[hb]=!1;var G6=typeof global=="object"&&global&&global.Object===Object&&global,SY=typeof self=="object"&&self&&self.Object===Object&&self,ui=G6||SY||Function("return this")(),k6=typeof Il=="object"&&Il&&!Il.nodeType&&Il,b6=k6&&typeof Ka=="object"&&Ka&&!Ka.nodeType&&Ka,j6=b6&&b6.exports===k6,ub=j6&&G6.process,I6=function(){try{return ub&&ub.binding&&ub.binding("util")}catch{}}(),_6=I6&&I6.isTypedArray;function TY(t,e){for(var r=-1,n=t==null?0:t.length,i=0,s=[];++r-1}function rJ(t,e){var r=this.__data__,n=dg(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}ci.prototype.clear=XY;ci.prototype.delete=ZY;ci.prototype.get=eJ;ci.prototype.has=tJ;ci.prototype.set=rJ;function oo(t){var e=-1,r=t==null?0:t.length;for(this.clear();++ea))return!1;var c=s.get(t);if(c&&s.get(e))return c==e;var f=-1,h=!0,g=r&P6?new cg:void 0;for(s.set(t,e),s.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=R6}function Z6(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Tl(t){return t!=null&&typeof t=="object"}var eB=_6?OY(_6):EJ;function RJ(t){return DJ(t)?gJ(t):vJ(t)}function BJ(){return[]}function LJ(){return!1}Ka.exports=PJ});var s8=E(me=>{"use strict";l();Object.defineProperty(me,"__esModule",{value:!0});var uo=Xn(),FJ=(b2(),ft(A2)),Ol=q2(),Qe=Xv(),fi=y1(),rB=(kc(),ft(E2)),MJ=(bP(),ft(AP)),ee=wl(),UJ=(AA(),ft(vA)),We=$s(),qJ=(l6(),ft(c6)),Ir=(bl(),ft(er)),VJ=(v6(),ft(E6)),HJ=tB();function Ng(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}function GJ(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if(r!=="default"){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}var kJ=Ng(uo),jJ=Ng(FJ),gg=GJ(MJ),QJ=Ng(VJ),WJ=Ng(HJ);function zJ(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,A=new Uint8Array(U);B!==W;){for(var _=m[B],N=0,I=U-1;(_!==0||N>>0,A[I]=_%a>>>0,_=_/a>>>0;if(_!==0)throw new Error("Non-zero carry");O=N,B++}for(var S=U-O;S!==U&&A[S]===0;)S++;for(var R=u.repeat(T);S>>0,U=new Uint8Array(W);m[T];){var A=r[m.charCodeAt(T)];if(A===255)return;for(var _=0,N=W-1;(A!==0||_>>0,U[N]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");B=_,T++}if(m[T]!==" "){for(var I=W-B;I!==W&&U[I]===0;)I++;for(var S=new Uint8Array(O+(W-I)),R=O;I!==W;)S[R++]=U[I++];return S}}}function y(m){var T=g(m);if(T)return T;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:g,decode:y}}var $J=zJ,KJ=$J,EB=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},YJ=t=>new TextEncoder().encode(t),JJ=t=>new TextDecoder().decode(t),Ab=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},bb=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return vB(this,e)}},Ib=class{constructor(e){this.decoders=e}or(e){return vB(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},vB=(t,e)=>new Ib({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),_b=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ab(e,r,n),this.decoder=new bb(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Og=({name:t,prefix:e,encode:r,decode:n})=>new _b(t,e,r,n),Dl=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=KJ(r,e);return Og({prefix:t,name:e,encode:n,decode:s=>EB(i(s))})},XJ=(t,e,r,n)=>{let i={};for(let f=0;f=8&&(a-=8,o[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},ZJ=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<Og({prefix:e,name:t,encode(i){return ZJ(i,n,r)},decode(i){return XJ(i,n,r,t)}}),eX=Og({prefix:"\0",name:"identity",encode:t=>JJ(t),decode:t=>YJ(t)}),tX=Object.freeze({__proto__:null,identity:eX}),rX=jt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),nX=Object.freeze({__proto__:null,base2:rX}),iX=jt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),sX=Object.freeze({__proto__:null,base8:iX}),oX=Dl({prefix:"9",name:"base10",alphabet:"0123456789"}),aX=Object.freeze({__proto__:null,base10:oX}),uX=jt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),cX=jt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),lX=Object.freeze({__proto__:null,base16:uX,base16upper:cX}),fX=jt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),hX=jt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),dX=jt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),pX=jt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),gX=jt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),yX=jt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mX=jt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),wX=jt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),EX=jt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),vX=Object.freeze({__proto__:null,base32:fX,base32upper:hX,base32pad:dX,base32padupper:pX,base32hex:gX,base32hexupper:yX,base32hexpad:mX,base32hexpadupper:wX,base32z:EX}),AX=Dl({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bX=Dl({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),IX=Object.freeze({__proto__:null,base36:AX,base36upper:bX}),_X=Dl({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),SX=Dl({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),TX=Object.freeze({__proto__:null,base58btc:_X,base58flickr:SX}),CX=jt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xX=jt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),NX=jt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),OX=jt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),DX=Object.freeze({__proto__:null,base64:CX,base64pad:xX,base64url:NX,base64urlpad:OX}),AB=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),PX=AB.reduce((t,e,r)=>(t[r]=e,t),[]),RX=AB.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function BX(t){return t.reduce((e,r)=>(e+=PX[r],e),"")}function LX(t){let e=[];for(let r of t){let n=RX[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var FX=Og({prefix:"\u{1F680}",name:"base256emoji",encode:BX,decode:LX}),MX=Object.freeze({__proto__:null,base256emoji:FX}),UX=bB,nB=128,qX=127,VX=~qX,HX=Math.pow(2,31);function bB(t,e,r){e=e||[],r=r||0;for(var n=r;t>=HX;)e[r++]=t&255|nB,t/=128;for(;t&VX;)e[r++]=t&255|nB,t>>>=7;return e[r]=t|0,bB.bytes=r-n+1,e}var GX=Sb,kX=128,iB=127;function Sb(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw Sb.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&iB)<=kX);return Sb.bytes=s-n,r}var jX=Math.pow(2,7),QX=Math.pow(2,14),WX=Math.pow(2,21),zX=Math.pow(2,28),$X=Math.pow(2,35),KX=Math.pow(2,42),YX=Math.pow(2,49),JX=Math.pow(2,56),XX=Math.pow(2,63),ZX=function(t){return t(IB.encode(t,e,r),e),oB=t=>IB.encodingLength(t),Tb=(t,e)=>{let r=e.byteLength,n=oB(t),i=n+oB(r),s=new Uint8Array(i+r);return sB(t,s,0),sB(r,s,n),s.set(e,i),new Cb(t,r,e,s)},Cb=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}},_B=({name:t,code:e,encode:r})=>new xb(t,e,r),xb=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Tb(this.code,r):r.then(n=>Tb(this.code,n))}else throw Error("Unknown type, must be binary type")}},SB=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),tZ=_B({name:"sha2-256",code:18,encode:SB("SHA-256")}),rZ=_B({name:"sha2-512",code:19,encode:SB("SHA-512")}),nZ=Object.freeze({__proto__:null,sha256:tZ,sha512:rZ}),TB=0,iZ="identity",CB=EB,sZ=t=>Tb(TB,CB(t)),oZ={code:TB,name:iZ,encode:CB,digest:sZ},aZ=Object.freeze({__proto__:null,identity:oZ});new TextEncoder,new TextDecoder;var aB={...tX,...nX,...sX,...aX,...lX,...vX,...IX,...TX,...DX,...MX};({...nZ,...aZ});function xB(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function uZ(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?xB(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function NB(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var uB=NB("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Eb=NB("ascii","a",t=>{let e="a";for(let r=0;r{t=t.substring(1);let e=uZ(t.length);for(let r=0;r{if(!this.initialized){let n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}},this.has=n=>(this.isInitialized(),this.keychain.has(n)),this.set=async(n,i)=>{this.isInitialized(),this.keychain.set(n,i),await this.persist()},this.get=n=>{this.isInitialized();let i=this.keychain.get(n);if(typeof i>"u"){let{message:s}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return i},this.del=async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()},this.core=e,this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Eg=class{constructor(e,r,n){this.core=e,this.logger=r,this.name=RB,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=i=>(this.isInitialized(),this.keychain.has(i)),this.getClientId=async()=>{this.isInitialized();let i=await this.getClientSeed(),s=gg.generateKeyPair(i);return gg.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let i=ee.generateKeyPair();return this.setPrivateKey(i.publicKey,i.privateKey)},this.signJWT=async i=>{this.isInitialized();let s=await this.getClientSeed(),o=gg.generateKeyPair(s),a=ee.generateRandomBytes32(),u=BB;return await gg.signJWT(a,i,u,o)},this.generateSharedKey=(i,s,o)=>{this.isInitialized();let a=this.getPrivateKey(i),u=ee.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(i,s)=>{this.isInitialized();let o=s||ee.hashKey(i);return await this.keychain.set(o,i),o},this.deleteKeyPair=async i=>{this.isInitialized(),await this.keychain.del(i)},this.deleteSymKey=async i=>{this.isInitialized(),await this.keychain.del(i)},this.encode=async(i,s,o)=>{this.isInitialized();let a=ee.validateEncoding(o),u=rB.safeJsonStringify(s);if(ee.isTypeOneEnvelope(a)){let g=a.senderPublicKey,y=a.receiverPublicKey;i=await this.generateSharedKey(g,y)}let c=this.getSymKey(i),{type:f,senderPublicKey:h}=a;return ee.encrypt({type:f,symKey:c,message:u,senderPublicKey:h})},this.decode=async(i,s,o)=>{this.isInitialized();let a=ee.validateDecoding(s,o);if(ee.isTypeOneEnvelope(a)){let u=a.receiverPublicKey,c=a.senderPublicKey;i=await this.generateSharedKey(u,c)}try{let u=this.getSymKey(i),c=ee.decrypt({symKey:u,encoded:s});return rB.safeJsonParse(c)}catch(u){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(u)}},this.getPayloadType=i=>{let s=ee.deserialize(i);return ee.decodeTypeByte(s.type)},this.getPayloadSenderPublicKey=i=>{let s=ee.deserialize(i);return s.senderPublicKey?UJ.toString(s.senderPublicKey,ee.BASE16):void 0},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.keychain=n||new wg(this.core,this.logger)}get context(){return Qe.getLoggerContext(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(Nb)}catch{e=ee.generateRandomBytes32(),await this.keychain.set(Nb,e)}return lZ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},vg=class extends fi.IMessageTracker{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=MB,this.version=UB,this.initialized=!1,this.storagePrefix=li,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}},this.set=async(n,i)=>{this.isInitialized();let s=ee.hashMessage(i),o=this.messages.get(n);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=i,this.messages.set(n,o),await this.persist()),s},this.get=n=>{this.isInitialized();let i=this.messages.get(n);return typeof i>"u"&&(i={}),i},this.has=(n,i)=>{this.isInitialized();let s=this.get(n),o=ee.hashMessage(i);return typeof s[o]<"u"},this.del=async n=>{this.isInitialized(),this.messages.delete(n),await this.persist()},this.logger=Qe.generateChildLogger(e,this.name),this.core=r}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,ee.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ee.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Pb=class extends fi.IPublisher{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new uo.EventEmitter,this.name=VB,this.queue=new Map,this.publishTimeout=We.toMiliseconds(We.TEN_SECONDS),this.needsTransportRestart=!1,this.publish=async(n,i,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}});try{let a=s?.ttl||qB,u=ee.getRelayProtocolName(s),c=s?.prompt||!1,f=s?.tag||0,h=s?.id||Ir.getBigIntRpcId().toString(),g={topic:n,message:i,opts:{ttl:a,relay:u,prompt:c,tag:f,id:h}},y=setTimeout(()=>this.queue.set(h,g),this.publishTimeout);try{await await ee.createExpiringPromise(this.rpcPublish(n,i,a,u,c,f,h),this.publishTimeout,"Failed to publish payload, please try again."),this.removeRequestFromQueue(h),this.relayer.events.emit(sr.publish,g)}catch(m){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(o=s?.internal)!=null&&o.throwOnFailedPublish)throw this.removeRequestFromQueue(h),m;return}finally{clearTimeout(y)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:i,opts:s}})}catch(a){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(a),a}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.registerEventListeners()}get context(){return Qe.getLoggerContext(this.logger)}rpcPublish(e,r,n,i,s,o,a){var u,c,f,h;let g={method:ee.getRelayProtocolApi(i.protocol).publish,params:{topic:e,message:r,ttl:n,prompt:s,tag:o},id:a};return ee.isUndefined((u=g.params)==null?void 0:u.prompt)&&((c=g.params)==null||delete c.prompt),ee.isUndefined((f=g.params)==null?void 0:f.tag)&&((h=g.params)==null||delete h.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:g}),this.relayer.request(g)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:r,message:n,opts:i}=e;await this.publish(r,n,i)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(sr.connection_stalled);return}this.checkQueue()}),this.relayer.on(sr.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},Rb=class{constructor(){this.map=new Map,this.set=(e,r)=>{let n=this.get(e);this.exists(e,r)||this.map.set(e,[...n,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,r))return;let i=n.filter(s=>s!==r);if(!i.length){this.map.delete(e);return}this.map.set(e,i)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},gZ=Object.defineProperty,yZ=Object.defineProperties,mZ=Object.getOwnPropertyDescriptors,cB=Object.getOwnPropertySymbols,wZ=Object.prototype.hasOwnProperty,EZ=Object.prototype.propertyIsEnumerable,lB=(t,e,r)=>e in t?gZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xl=(t,e)=>{for(var r in e||(e={}))wZ.call(e,r)&&lB(t,r,e[r]);if(cB)for(var r of cB(e))EZ.call(e,r)&&lB(t,r,e[r]);return t},vb=(t,e)=>yZ(t,mZ(e)),Ag=class extends fi.ISubscriber{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new Rb,this.events=new uo.EventEmitter,this.name=YB,this.version=JB,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=li,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}});try{let s=ee.getRelayProtocolName(i),o={topic:n,relay:s};this.pending.set(n,o);let a=await this.rpcSubscribe(n,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:i}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(n,i)=>{await this.restartToComplete(),this.isInitialized(),typeof i?.id<"u"?await this.unsubscribeById(n,i.id,i):await this.unsubscribeByTopic(n,i)},this.isSubscribed=async n=>this.topics.includes(n)?!0:await new Promise((i,s)=>{let o=new We.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(n)&&this.topics.includes(n)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),i(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=XB&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Qe.generateChildLogger(r,this.name),this.clientId=""}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let n=!1;try{n=this.getSubscription(e).topic===r}catch{}return n}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){let n=this.topicMap.get(e);await Promise.all(n.map(async i=>await this.unsubscribeById(e,i,r)))}async unsubscribeById(e,r,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}});try{let i=ee.getRelayProtocolName(n);await this.rpcUnsubscribe(e,r,i);let s=ee.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:n}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(e,r){let n={method:ee.getRelayProtocolApi(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(sr.connection_stalled)}return ee.hashMessage(e+this.clientId)}async rpcBatchSubscribe(e){if(!e.length)return;let r=e[0].relay,n={method:ee.getRelayProtocolApi(r.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{return await await ee.createExpiringPromise(this.relayer.request(n),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(sr.connection_stalled)}}rpcUnsubscribe(e,r,n){let i={method:ee.getRelayProtocolApi(n.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,r){this.setSubscription(e,vb(xl({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,xl({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,n){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r))}addSubscription(e,r){this.subscriptions.set(e,xl({},r)),this.topicMap.set(r.topic,e),this.events.emit(kr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let r=this.subscriptions.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(kr.deleted,vb(xl({},n),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(kr.sync)}async reset(){if(this.cached.length){let e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r"u"||!e.length)return;if(this.subscriptions.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;let r=await this.rpcBatchSubscribe(e);ee.isValidArray(r)&&this.onBatchSubscribe(r.map((n,i)=>vb(xl({},e[i]),{id:n})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;let e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e)}registerEventListeners(){this.relayer.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(sr.connect,async()=>{await this.onConnect()}),this.relayer.on(sr.disconnect,()=>{this.onDisconnect()}),this.events.on(kr.created,async e=>{let r=kr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(kr.deleted,async e=>{let r=kr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}},vZ=Object.defineProperty,fB=Object.getOwnPropertySymbols,AZ=Object.prototype.hasOwnProperty,bZ=Object.prototype.propertyIsEnumerable,hB=(t,e,r)=>e in t?vZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,IZ=(t,e)=>{for(var r in e||(e={}))AZ.call(e,r)&&hB(t,r,e[r]);if(fB)for(var r of fB(e))bZ.call(e,r)&&hB(t,r,e[r]);return t},bg=class extends fi.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new uo.EventEmitter,this.name=kB,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.request=async r=>{this.logger.debug("Publishing Request Payload");try{return await this.toEstablishConnection(),await this.provider.request(r)}catch(n){throw this.logger.debug("Failed to Publish Request"),this.logger.error(n),n}},this.onPayloadHandler=r=>{this.onProviderPayload(r)},this.onConnectHandler=()=>{this.events.emit(sr.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(sr.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(Rn.payload,this.onPayloadHandler),this.provider.on(Rn.connect,this.onConnectHandler),this.provider.on(Rn.disconnect,this.onDisconnectHandler),this.provider.on(Rn.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Qe.generateChildLogger(e.logger,this.name):Qe.pino(Qe.getDefaultLoggerOptions({level:e.logger||GB})),this.messages=new vg(this.logger,e.core),this.subscriber=new Ag(this,this.logger),this.publisher=new Pb(this,this.logger),this.relayUrl=e?.relayUrl||Lb,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${Ob}...`),await this.restartTransport(Ob)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},zB)}get context(){return Qe.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,r,n){this.isInitialized(),await this.publisher.publish(e,r,n),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now()})}async subscribe(e,r){var n;this.isInitialized();let i=((n=this.subscriber.topicMap.get(e))==null?void 0:n[0])||"";if(i)return i;let s,o=a=>{a.topic===e&&(this.subscriber.off(kr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(kr.created,o)}),new Promise(async a=>{i=await this.subscriber.subscribe(e,r),a()})]),i}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportClose(){this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ee.createExpiringPromise(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(e){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(r=>{if(!this.initialized)return r();this.subscriber.once(kr.resubscribed,()=>{r()})}),new Promise(async(r,n)=>{try{await ee.createExpiringPromise(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(i){n(i);return}r()})])}catch(r){this.logger.error(r);let n=r;if(!this.isConnectionStalled(n.message))throw r;this.provider.events.emit(Rn.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(e){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ee.isOnline())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new qJ.JsonRpcProvider(new QJ.default(ee.formatRelayRpcUrl({sdkVersion:WB,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:r,message:n}=e;await this.messages.set(r,n)}async shouldIgnoreMessageEvent(e){let{topic:r,message:n}=e;if(!n||n.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;let i=this.messages.has(r,n);return i&&this.logger.debug(`Ignoring duplicate message: ${n}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Ir.isJsonRpcRequest(e)){if(!e.method.endsWith(jB))return;let r=e.params,{topic:n,message:i,publishedAt:s}=r.data,o={topic:n,message:i,publishedAt:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(IZ({type:"event",event:r.id},o)),this.events.emit(r.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else Ir.isJsonRpcResponse(e)&&this.events.emit(sr.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(sr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let r=Ir.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(Rn.payload,this.onPayloadHandler),this.provider.off(Rn.connect,this.onConnectHandler),this.provider.off(Rn.disconnect,this.onDisconnectHandler),this.provider.off(Rn.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(sr.connection_stalled,()=>{this.restartTransport().catch(r=>this.logger.error(r))});let e=await ee.isOnline();ee.subscribeToNetworkChange(async r=>{this.initialized&&e!==r&&(e=r,r?await this.restartTransport().catch(n=>this.logger.error(n)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(n=>this.logger.error(n))))})}onProviderDisconnect(){this.events.emit(sr.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(e=>this.logger.error(e))},We.toMiliseconds(QB)))}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(e=>{let r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)});await this.restartTransport()}}},_Z=Object.defineProperty,dB=Object.getOwnPropertySymbols,SZ=Object.prototype.hasOwnProperty,TZ=Object.prototype.propertyIsEnumerable,pB=(t,e,r)=>e in t?_Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,gB=(t,e)=>{for(var r in e||(e={}))SZ.call(e,r)&&pB(t,r,e[r]);if(dB)for(var r of dB(e))TZ.call(e,r)&&pB(t,r,e[r]);return t},Ig=class extends fi.IStore{constructor(e,r,n,i=li,s=void 0){super(e,r,n,i),this.core=e,this.logger=r,this.name=n,this.map=new Map,this.version=$B,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!ee.isUndefined(o)?this.map.set(this.getKey(o),o):ee.isProposalStruct(o)?this.map.set(o.id,o):ee.isSessionStruct(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(u=>WJ.default(a[u],o[u]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});let u=gB(gB({},this.getData(o)),a);this.map.set(o,u),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),await this.persist())},this.logger=Qe.generateChildLogger(r,this.name),this.storagePrefix=i,this.getKey=s}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let r=this.map.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},_g=class{constructor(e,r){this.core=e,this.logger=r,this.name=ZB,this.version=e8,this.events=new kJ.default,this.initialized=!1,this.storagePrefix=li,this.ignoredPayloadTypes=[ee.TYPE_1],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]},this.create=async()=>{this.isInitialized();let n=ee.generateRandomBytes32(),i=await this.core.crypto.setSymKey(n),s=ee.calcExpiry(We.FIVE_MINUTES),o={protocol:HB},a={topic:i,expiry:s,relay:o,active:!1},u=ee.formatUri({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:n,relay:o});return await this.pairings.set(i,a),await this.core.relayer.subscribe(i),this.core.expirer.set(i,s),{topic:i,uri:u}},this.pair=async n=>{this.isInitialized(),this.isValidPair(n);let{topic:i,symKey:s,relay:o}=ee.parseUri(n.uri),a;if(this.pairings.keys.includes(i)&&(a=this.pairings.get(i),a.active))throw new Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);this.core.crypto.keychain.has(i)||(await this.core.crypto.setSymKey(s,i),await this.core.relayer.subscribe(i,{relay:o}));let u=ee.calcExpiry(We.FIVE_MINUTES),c={topic:i,relay:o,expiry:u,active:!1};return await this.pairings.set(i,c),this.core.expirer.set(i,u),n.activatePairing&&await this.activate({topic:i}),this.events.emit(Nl.create,c),c},this.activate=async({topic:n})=>{this.isInitialized();let i=ee.calcExpiry(We.THIRTY_DAYS);await this.pairings.update(n,{active:!0,expiry:i}),this.core.expirer.set(n,i)},this.ping=async n=>{this.isInitialized(),await this.isValidPing(n);let{topic:i}=n;if(this.pairings.keys.includes(i)){let s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=ee.createDelayedPromise();this.events.once(ee.engineEvent("pairing_ping",s),({error:c})=>{c?u(c):a()}),await o()}},this.updateExpiry=async({topic:n,expiry:i})=>{this.isInitialized(),await this.pairings.update(n,{expiry:i})},this.updateMetadata=async({topic:n,metadata:i})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:i})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async n=>{this.isInitialized(),await this.isValidDisconnect(n);let{topic:i}=n;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",ee.getSdkError("USER_DISCONNECTED")),await this.deletePairing(i))},this.sendRequest=async(n,i,s)=>{let o=Ir.formatJsonRpcRequest(i,s),a=await this.core.crypto.encode(n,o),u=Ja[i].req;return this.core.history.set(n,o),this.core.relayer.publish(n,a,u),o.id},this.sendResult=async(n,i,s)=>{let o=Ir.formatJsonRpcResult(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=Ja[u.request.method].res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.sendError=async(n,i,s)=>{let o=Ir.formatJsonRpcError(n,s),a=await this.core.crypto.encode(i,o),u=await this.core.history.get(i,n),c=Ja[u.request.method]?Ja[u.request.method].res:Ja.unregistered_method.res;await this.core.relayer.publish(i,a,c),await this.core.history.resolve(o)},this.deletePairing=async(n,i)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,ee.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),i?Promise.resolve():this.core.expirer.del(n)])},this.cleanup=async()=>{let n=this.pairings.getAll().filter(i=>ee.isExpired(i.expiry));await Promise.all(n.map(i=>this.deletePairing(i.topic)))},this.onRelayEventRequest=n=>{let{topic:i,payload:s}=n;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(i,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(i,s);default:return this.onUnknownRpcMethodRequest(i,s)}},this.onRelayEventResponse=async n=>{let{topic:i,payload:s}=n,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(n,i)=>{let{id:s}=i;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Nl.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onPairingPingResponse=(n,i)=>{let{id:s}=i;setTimeout(()=>{Ir.isJsonRpcResult(i)?this.events.emit(ee.engineEvent("pairing_ping",s),{}):Ir.isJsonRpcError(i)&&this.events.emit(ee.engineEvent("pairing_ping",s),{error:i.error})},500)},this.onPairingDeleteRequest=async(n,i)=>{let{id:s}=i;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Nl.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(n,i)=>{let{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;let a=ee.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,a),this.logger.error(a)}catch(a){await this.sendError(s,n,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=n=>{this.registeredMethods.includes(n)||this.logger.error(ee.getSdkError("WC_METHOD_UNSUPPORTED",n))},this.isValidPair=n=>{if(!ee.isValidParams(n)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() params: ${n}`);throw new Error(i)}if(!ee.isValidUrl(n.uri)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw new Error(i)}},this.isValidPing=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidDisconnect=async n=>{if(!ee.isValidParams(n)){let{message:s}=ee.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}let{topic:i}=n;await this.isValidPairingTopic(i)},this.isValidPairingTopic=async n=>{if(!ee.isValidString(n,!1)){let{message:i}=ee.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(i)}if(!this.pairings.keys.includes(n)){let{message:i}=ee.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(i)}if(ee.isExpired(this.pairings.get(n).expiry)){await this.deletePairing(n);let{message:i}=ee.getInternalError("EXPIRED",`pairing topic: ${n}`);throw new Error(i)}},this.core=e,this.logger=Qe.generateChildLogger(r,this.name),this.pairings=new Ig(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Qe.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(sr.message,async e=>{let{topic:r,message:n}=e;if(!this.pairings.keys.includes(r)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(r,n);try{Ir.isJsonRpcRequest(i)?(this.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):Ir.isJsonRpcResponse(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.core.history.delete(r,i.id))}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Gr.expired,async e=>{let{topic:r}=ee.parseExpirerTarget(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(Nl.expire,{topic:r}))})}},Sg=class extends fi.IJsonRpcHistory{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new uo.EventEmitter,this.name=t8,this.version=r8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(n,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:i,chainId:s}),this.records.has(i.id))return;let o={id:i.id,topic:n,request:{method:i.method,params:i.params||null},chainId:s,expiry:ee.calcExpiry(We.THIRTY_DAYS)};this.records.set(o.id,o),this.events.emit(en.created,o)},this.resolve=async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;let i=await this.getRecord(n.id);typeof i.response>"u"&&(i.response=Ir.isJsonRpcError(n)?{error:n.error}:{result:n.result},this.records.set(i.id,i),this.events.emit(en.updated,i))},this.get=async(n,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:i}),await this.getRecord(i)),this.delete=(n,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===n){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(en.deleted,s)}})},this.exists=async(n,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===n:!1),this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;let n={topic:r.topic,request:Ir.formatJsonRpcRequest(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let r=this.records.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(n)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(en.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(en.created,e=>{let r=en.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(en.updated,e=>{let r=en.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.events.on(en.deleted,e=>{let r=en.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e}),this.persist()}),this.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(e=>{We.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.delete(e.topic,e.id))})}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Tg=class extends fi.IExpirer{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new uo.EventEmitter,this.name=n8,this.version=i8,this.cached=[],this.initialized=!1,this.storagePrefix=li,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=n=>{try{let i=this.formatTarget(n);return typeof this.getExpiration(i)<"u"}catch{return!1}},this.set=(n,i)=>{this.isInitialized();let s=this.formatTarget(n),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Gr.created,{target:s,expiration:o})},this.get=n=>{this.isInitialized();let i=this.formatTarget(n);return this.getExpiration(i)},this.del=n=>{if(this.isInitialized(),this.has(n)){let i=this.formatTarget(n),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(Gr.deleted,{target:i,expiration:s})}},this.on=(n,i)=>{this.events.on(n,i)},this.once=(n,i)=>{this.events.once(n,i)},this.off=(n,i)=>{this.events.off(n,i)},this.removeListener=(n,i)=>{this.events.removeListener(n,i)},this.logger=Qe.generateChildLogger(r,this.name)}get context(){return Qe.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return ee.formatTopicTarget(e);if(typeof e=="number")return ee.formatIdTarget(e);let{message:r}=ee.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Gr.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:r}=ee.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let r=this.expirations.get(e);if(!r){let{message:n}=ee.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}return r}checkExpiry(e,r){let{expiry:n}=r;We.toMiliseconds(n)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Gr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(Ol.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Gr.created,e=>{let r=Gr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Gr.expired,e=>{let r=Gr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Gr.deleted,e=>{let r=Gr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=ee.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Cg=class extends fi.IVerify{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.name=yg,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async()=>{if(this.verifyDisabled||ee.isReactNative()||!ee.isBrowser())return;let n=mg;this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i)}if(!this.initialized){this.removeIframe(),this.verifyUrl=Db;try{await this.createIframe()}catch(i){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(i),this.verifyDisabled=!0}}},this.register=async n=>{this.initialized?this.sendPost(n.attestationId):(this.addToQueue(n.attestationId),await this.init())},this.resolve=async n=>{if(this.isDevEnv)return"";let i=n?.verifyUrl||mg,s;try{s=await this.fetchAttestation(n.attestationId,i)}catch(o){this.logger.info(`failed to resolve attestation: ${n.attestationId} from url: ${i}`),this.logger.info(o),s=await this.fetchAttestation(n.attestationId,Db)}return s},this.fetchAttestation=async(n,i)=>{this.logger.info(`resolving attestation: ${n} from url: ${i}`);let s=this.startAbortTimer(We.ONE_SECOND*2),o=await fetch(`${i}/attestation/${n}`,{signal:this.abortController.signal});return clearTimeout(s),o.status===200?await o.json():void 0},this.addToQueue=n=>{this.queue.push(n)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(n=>this.sendPost(n)),this.queue=[])},this.sendPost=n=>{var i;try{if(!this.iframe)return;(i=this.iframe.contentWindow)==null||i.postMessage(n,"*"),this.logger.info(`postMessage sent: ${n} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let n,i=s=>{s.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",i),n())};await Promise.race([new Promise(s=>{if(document.getElementById(yg))return s();window.addEventListener("message",i);let o=document.createElement("iframe");o.id=yg,o.src=`${this.verifyUrl}/${this.projectId}`,o.style.display="none",document.body.append(o),this.iframe=o,n=s}),new Promise((s,o)=>setTimeout(()=>{window.removeEventListener("message",i),o("verify iframe load timeout")},We.toMiliseconds(We.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.logger=Qe.generateChildLogger(r,this.name),this.verifyUrl=mg,this.abortController=new AbortController,this.isDevEnv=ee.isNode()&&p.default.env.IS_VITEST}get context(){return Qe.getLoggerContext(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),We.toMiliseconds(e))}},CZ=Object.defineProperty,yB=Object.getOwnPropertySymbols,xZ=Object.prototype.hasOwnProperty,NZ=Object.prototype.propertyIsEnumerable,mB=(t,e,r)=>e in t?CZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wB=(t,e)=>{for(var r in e||(e={}))xZ.call(e,r)&&mB(t,r,e[r]);if(yB)for(var r of yB(e))NZ.call(e,r)&&mB(t,r,e[r]);return t},xg=class t extends fi.ICore{constructor(e){super(e),this.protocol=Bb,this.version=OB,this.name=Dg,this.events=new uo.EventEmitter,this.initialized=!1,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Lb,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Qe.pino(Qe.getDefaultLoggerOptions({level:e?.logger||DB.logger}));this.logger=Qe.generateChildLogger(r,this.name),this.heartbeat=new Ol.HeartBeat,this.crypto=new Eg(this,this.logger,e?.keychain),this.history=new Sg(this,this.logger),this.expirer=new Tg(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new jJ.default(wB(wB({},PB),e?.storageOptions)),this.relayer=new bg({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new _g(this,this.logger),this.verify=new Cg(this.projectId||"",this.logger)}static async init(e){let r=new t(e);await r.initialize();let n=await r.crypto.getClientId();return await r.storage.setItem(KB,n),r}get context(){return Qe.getLoggerContext(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},OZ=xg;me.CORE_CONTEXT=Dg,me.CORE_DEFAULT=DB,me.CORE_PROTOCOL=Bb,me.CORE_STORAGE_OPTIONS=PB,me.CORE_STORAGE_PREFIX=li,me.CORE_VERSION=OB,me.CRYPTO_CLIENT_SEED=Nb,me.CRYPTO_CONTEXT=RB,me.CRYPTO_JWT_TTL=BB,me.Core=OZ,me.Crypto=Eg,me.EXPIRER_CONTEXT=n8,me.EXPIRER_DEFAULT_TTL=pZ,me.EXPIRER_EVENTS=Gr,me.EXPIRER_STORAGE_VERSION=i8,me.Expirer=Tg,me.HISTORY_CONTEXT=t8,me.HISTORY_EVENTS=en,me.HISTORY_STORAGE_VERSION=r8,me.JsonRpcHistory=Sg,me.KEYCHAIN_CONTEXT=LB,me.KEYCHAIN_STORAGE_VERSION=FB,me.KeyChain=wg,me.MESSAGES_CONTEXT=MB,me.MESSAGES_STORAGE_VERSION=UB,me.MessageTracker=vg,me.PAIRING_CONTEXT=ZB,me.PAIRING_DEFAULT_TTL=dZ,me.PAIRING_EVENTS=Nl,me.PAIRING_RPC_OPTS=Ja,me.PAIRING_STORAGE_VERSION=e8,me.PENDING_SUB_RESOLUTION_TIMEOUT=XB,me.PUBLISHER_CONTEXT=VB,me.PUBLISHER_DEFAULT_TTL=qB,me.Pairing=_g,me.RELAYER_CONTEXT=kB,me.RELAYER_DEFAULT_LOGGER=GB,me.RELAYER_DEFAULT_PROTOCOL=HB,me.RELAYER_DEFAULT_RELAY_URL=Lb,me.RELAYER_EVENTS=sr,me.RELAYER_FAILOVER_RELAY_URL=Ob,me.RELAYER_PROVIDER_EVENTS=Rn,me.RELAYER_RECONNECT_TIMEOUT=QB,me.RELAYER_SDK_VERSION=WB,me.RELAYER_STORAGE_OPTIONS=fZ,me.RELAYER_SUBSCRIBER_SUFFIX=jB,me.RELAYER_TRANSPORT_CUTOFF=zB,me.Relayer=bg,me.STORE_STORAGE_VERSION=$B,me.SUBSCRIBER_CONTEXT=YB,me.SUBSCRIBER_DEFAULT_TTL=hZ,me.SUBSCRIBER_EVENTS=kr,me.SUBSCRIBER_STORAGE_VERSION=JB,me.Store=Ig,me.Subscriber=Ag,me.VERIFY_CONTEXT=yg,me.VERIFY_FALLBACK_SERVER=Db,me.VERIFY_SERVER=mg,me.Verify=Cg,me.WALLETCONNECT_CLIENT_ID=KB,me.default=xg});var y8=E(Je=>{"use strict";l();Object.defineProperty(Je,"__esModule",{value:!0});var Ln=s8(),Pg=Xv(),u8=y1(),j=wl(),c8=Xn(),Xe=$s(),yt=(bl(),ft(er));function DZ(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var PZ=DZ(c8),Hb="wc",Gb=2,kb="client",Fg=`${Hb}@${Gb}:${kb}:`,Rg={name:kb,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},RZ={session_proposal:"session_proposal",session_update:"session_update",session_extend:"session_extend",session_ping:"session_ping",session_delete:"session_delete",session_expire:"session_expire",session_request:"session_request",session_request_sent:"session_request_sent",session_event:"session_event",proposal_expire:"proposal_expire"},BZ={database:":memory:"},Fb="WALLETCONNECT_DEEPLINK_CHOICE",LZ={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},FZ="history",MZ="0.3",l8="proposal",UZ=Xe.THIRTY_DAYS,f8="Proposal expired",h8="session",Rl=Xe.SEVEN_DAYS,d8="engine",Xa={wc_sessionPropose:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Xe.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Xe.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Xe.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Xe.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:Xe.THIRTY_SECONDS,prompt:!1,tag:1115}}},Bg={min:Xe.FIVE_MINUTES,max:Xe.SEVEN_DAYS},Bn={idle:"IDLE",active:"ACTIVE"},p8="request",g8=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],qZ=Object.defineProperty,VZ=Object.defineProperties,HZ=Object.getOwnPropertyDescriptors,o8=Object.getOwnPropertySymbols,GZ=Object.prototype.hasOwnProperty,kZ=Object.prototype.propertyIsEnumerable,a8=(t,e,r)=>e in t?qZ(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mr=(t,e)=>{for(var r in e||(e={}))GZ.call(e,r)&&a8(t,r,e[r]);if(o8)for(var r of o8(e))kZ.call(e,r)&&a8(t,r,e[r]);return t},Pl=(t,e)=>VZ(t,HZ(e)),Mb=class extends u8.IEngine{constructor(e){super(e),this.name=d8,this.events=new PZ.default,this.initialized=!1,this.ignoredPayloadTypes=[j.TYPE_1],this.requestQueue={state:Bn.idle,queue:[]},this.sessionRequestQueue={state:Bn.idle,queue:[]},this.requestQueueDelay=Xe.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(Xa)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{await this.isInitialized();let n=Pl(mr({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(n);let{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=n,c=i,f,h=!1;if(c&&(h=this.client.core.pairing.pairings.get(c).active),!c||!h){let{topic:U,uri:A}=await this.client.core.pairing.create();c=U,f=A}let g=await this.client.core.crypto.generateKeyPair(),y=mr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Ln.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:g,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:m,resolve:T,done:O}=j.createDelayedPromise(Xe.FIVE_MINUTES,f8);if(this.events.once(j.engineEvent("session_connect"),async({error:U,session:A})=>{if(U)m(U);else if(A){A.self.publicKey=g;let _=Pl(mr({},A),{requiredNamespaces:A.requiredNamespaces,optionalNamespaces:A.optionalNamespaces});await this.client.session.set(A.topic,_),await this.setExpiry(A.topic,A.expiry),c&&await this.client.core.pairing.updateMetadata({topic:c,metadata:A.peer.metadata}),T(_)}}),!c){let{message:U}=j.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw new Error(U)}let B=await this.sendRequest({topic:c,method:"wc_sessionPropose",params:y}),W=j.calcExpiry(Xe.FIVE_MINUTES);return await this.setProposal(B,mr({id:B,expiry:W},y)),{uri:f,approval:O}},this.pair=async r=>(await this.isInitialized(),await this.client.core.pairing.pair(r)),this.approve=async r=>{await this.isInitialized(),await this.isValidApprove(r);let{id:n,relayProtocol:i,namespaces:s,sessionProperties:o}=r,a=this.client.proposal.get(n),{pairingTopic:u,proposer:c,requiredNamespaces:f,optionalNamespaces:h}=a;u=u||"",j.isValidObject(f)||(f=j.getRequiredNamespacesFromNamespaces(s,"approve()"));let g=await this.client.core.crypto.generateKeyPair(),y=c.publicKey,m=await this.client.core.crypto.generateSharedKey(g,y);u&&n&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:c.metadata}),await this.sendResult({id:n,topic:u,result:{relay:{protocol:i??"irn"},responderPublicKey:g}}),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let T=mr({relay:{protocol:i??"irn"},namespaces:s,requiredNamespaces:f,optionalNamespaces:h,pairingTopic:u,controller:{publicKey:g,metadata:this.client.metadata},expiry:j.calcExpiry(Rl)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(m),await this.sendRequest({topic:m,method:"wc_sessionSettle",params:T,throwOnFailedPublish:!0});let O=Pl(mr({},T),{topic:m,pairingTopic:u,acknowledged:!1,self:T.controller,peer:{publicKey:c.publicKey,metadata:c.metadata},controller:g});return await this.client.session.set(m,O),await this.setExpiry(m,j.calcExpiry(Rl)),{topic:m,acknowledged:()=>new Promise(B=>setTimeout(()=>B(this.client.session.get(m)),500))}},this.reject=async r=>{await this.isInitialized(),await this.isValidReject(r);let{id:n,reason:i}=r,{pairingTopic:s}=this.client.proposal.get(n);s&&(await this.sendError(n,s,i),await this.client.proposal.delete(n,j.getSdkError("USER_DISCONNECTED")))},this.update=async r=>{await this.isInitialized(),await this.isValidUpdate(r);let{topic:n,namespaces:i}=r,s=await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:i}}),{done:o,resolve:a,reject:u}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_update",s),({error:c})=>{c?u(c):a()}),await this.client.session.update(n,{namespaces:i}),{acknowledged:o}},this.extend=async r=>{await this.isInitialized(),await this.isValidExtend(r);let{topic:n}=r,i=await this.sendRequest({topic:n,method:"wc_sessionExtend",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();return this.events.once(j.engineEvent("session_extend",i),({error:u})=>{u?a(u):o()}),await this.setExpiry(n,j.calcExpiry(Rl)),{acknowledged:s}},this.request=async r=>{await this.isInitialized(),await this.isValidRequest(r);let{chainId:n,request:i,topic:s,expiry:o}=r,a=yt.payloadId(),{done:u,resolve:c,reject:f}=j.createDelayedPromise(o,"Request expired. Please try again.");return this.events.once(j.engineEvent("session_request",a),({error:h,result:g})=>{h?f(h):c(g)}),await Promise.all([new Promise(async h=>{await this.sendRequest({clientRpcId:a,topic:s,method:"wc_sessionRequest",params:{request:i,chainId:n},expiry:o,throwOnFailedPublish:!0}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:n,id:a}),h()}),new Promise(async h=>{let g=await this.client.core.storage.getItem(Fb);j.handleDeeplinkRedirect({id:a,topic:s,wcDeepLink:g}),h()}),u()]).then(h=>h[2])},this.respond=async r=>{await this.isInitialized(),await this.isValidRespond(r);let{topic:n,response:i}=r,{id:s}=i;yt.isJsonRpcResult(i)?await this.sendResult({id:s,topic:n,result:i.result,throwOnFailedPublish:!0}):yt.isJsonRpcError(i)&&await this.sendError(s,n,i.error),this.cleanupAfterResponse(r)},this.ping=async r=>{await this.isInitialized(),await this.isValidPing(r);let{topic:n}=r;if(this.client.session.keys.includes(n)){let i=await this.sendRequest({topic:n,method:"wc_sessionPing",params:{}}),{done:s,resolve:o,reject:a}=j.createDelayedPromise();this.events.once(j.engineEvent("session_ping",i),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(n)&&await this.client.core.pairing.ping({topic:n})},this.emit=async r=>{await this.isInitialized(),await this.isValidEmit(r);let{topic:n,event:i,chainId:s}=r;await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:i,chainId:s}})},this.disconnect=async r=>{await this.isInitialized(),await this.isValidDisconnect(r);let{topic:n}=r;this.client.session.keys.includes(n)?(await this.sendRequest({topic:n,method:"wc_sessionDelete",params:j.getSdkError("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession(n)):await this.client.core.pairing.disconnect({topic:n})},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(n=>j.isSessionCompatible(n,r))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{let n=this.client.core.pairing.pairings.get(r.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}},this.deleteSession=async(r,n)=>{let{self:i}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(i.publicKey)&&await this.client.core.crypto.deleteKeyPair(i.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(Fb).catch(s=>this.client.logger.warn(s))},this.deleteProposal=async(r,n)=>{await Promise.all([this.client.proposal.delete(r,j.getSdkError("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(r)])},this.deletePendingSessionRequest=async(r,n,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,n),i?Promise.resolve():this.client.core.expirer.del(r)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),i&&(this.sessionRequestQueue.state=Bn.idle)},this.setExpiry=async(r,n)=>{this.client.session.keys.includes(r)&&await this.client.session.update(r,{expiry:n}),this.client.core.expirer.set(r,n)},this.setProposal=async(r,n)=>{await this.client.proposal.set(r,n),this.client.core.expirer.set(r,n.expiry)},this.setPendingSessionRequest=async r=>{let n=Xa.wc_sessionRequest.req.ttl,{id:i,topic:s,params:o,verifyContext:a}=r;await this.client.pendingRequest.set(i,{id:i,topic:s,params:o,verifyContext:a}),n&&this.client.core.expirer.set(i,j.calcExpiry(n))},this.sendRequest=async r=>{let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:u,throwOnFailedPublish:c}=r,f=yt.formatJsonRpcRequest(i,s,u);if(j.isBrowser()&&g8.includes(i)){let y=j.hashMessage(JSON.stringify(f));this.client.core.verify.register({attestationId:y})}let h=await this.client.core.crypto.encode(n,f),g=Xa[i].req;return o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,f),c?(g.internal=Pl(mr({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,g)):this.client.core.relayer.publish(n,h,g).catch(y=>this.client.logger.error(y)),f.id},this.sendResult=async r=>{let{id:n,topic:i,result:s,throwOnFailedPublish:o}=r,a=yt.formatJsonRpcResult(n,s),u=await this.client.core.crypto.encode(i,a),c=await this.client.core.history.get(i,n),f=Xa[c.request.method].res;o?(f.internal=Pl(mr({},f.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,u,f)):this.client.core.relayer.publish(i,u,f).catch(h=>this.client.logger.error(h)),await this.client.core.history.resolve(a)},this.sendError=async(r,n,i)=>{let s=yt.formatJsonRpcError(r,i),o=await this.client.core.crypto.encode(n,s),a=await this.client.core.history.get(n,r),u=Xa[a.request.method].res;this.client.core.relayer.publish(n,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let r=[],n=[];this.client.session.getAll().forEach(i=>{j.isExpired(i.expiry)&&r.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{j.isExpired(i.expiry)&&n.push(i.id)}),await Promise.all([...r.map(i=>this.deleteSession(i)),...n.map(i=>this.deleteProposal(i))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Bn.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Bn.active;let r=this.requestQueue.queue.shift();if(r)try{this.processRequest(r),await new Promise(n=>setTimeout(n,300))}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=Bn.idle},this.processRequest=r=>{let{topic:n,payload:i}=r,s=i.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(n,i);case"wc_sessionSettle":return this.onSessionSettleRequest(n,i);case"wc_sessionUpdate":return this.onSessionUpdateRequest(n,i);case"wc_sessionExtend":return this.onSessionExtendRequest(n,i);case"wc_sessionPing":return this.onSessionPingRequest(n,i);case"wc_sessionDelete":return this.onSessionDeleteRequest(n,i);case"wc_sessionRequest":return this.onSessionRequest(n,i);case"wc_sessionEvent":return this.onSessionEventRequest(n,i);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async r=>{let{topic:n,payload:i}=r,s=(await this.client.core.history.get(n,i.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(n,i);case"wc_sessionSettle":return this.onSessionSettleResponse(n,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,i);case"wc_sessionExtend":return this.onSessionExtendResponse(n,i);case"wc_sessionPing":return this.onSessionPingResponse(n,i);case"wc_sessionRequest":return this.onSessionRequestResponse(n,i);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onRelayEventUnknownPayload=r=>{let{topic:n}=r,{message:i}=j.getInternalError("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)},this.onSessionProposeRequest=async(r,n)=>{let{params:i,id:s}=n;try{this.isValidConnect(mr({},n.params));let o=j.calcExpiry(Xe.FIVE_MINUTES),a=mr({id:s,pairingTopic:r,expiry:o},i);await this.setProposal(s,a);let u=j.hashMessage(JSON.stringify(n)),c=await this.getVerifyContext(u,a.proposer.metadata);this.client.events.emit("session_proposal",{id:s,params:a,verifyContext:c})}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(r,n)=>{let{id:i}=n;if(yt.isJsonRpcResult(n)){let{result:s}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(i);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});let a=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:a});let u=s.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});let c=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:c});let f=await this.client.core.relayer.subscribe(c);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:f}),await this.client.core.pairing.activate({topic:r})}else yt.isJsonRpcError(n)&&(await this.client.proposal.delete(i,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_connect"),{error:n.error}))},this.onSessionSettleRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:c,requiredNamespaces:f,optionalNamespaces:h,sessionProperties:g,pairingTopic:y}=n.params,m=mr({topic:r,relay:o,expiry:u,namespaces:c,acknowledged:!0,pairingTopic:y,requiredNamespaces:f,optionalNamespaces:h,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},g&&{sessionProperties:g});await this.sendResult({id:n.id,topic:r,result:!0}),this.events.emit(j.engineEvent("session_connect"),{session:m}),this.cleanupDuplicatePairings(m)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(j.engineEvent("session_approve",i),{})):yt.isJsonRpcError(n)&&(await this.client.session.delete(r,j.getSdkError("USER_DISCONNECTED")),this.events.emit(j.engineEvent("session_approve",i),{error:n.error}))},this.onSessionUpdateRequest=async(r,n)=>{let{params:i,id:s}=n;try{let o=`${r}_session_update`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`);return}this.isValidUpdate(mr({topic:r},i)),await this.client.session.update(r,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:r,result:!0}),this.client.events.emit("session_update",{id:s,topic:r,params:i}),j.MemoryStore.set(o,s)}catch(o){await this.sendError(s,r,o),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,n)=>parseInt(n.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_update",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_update",i),{error:n.error})},this.onSessionExtendRequest=async(r,n)=>{let{id:i}=n;try{this.isValidExtend({topic:r}),await this.setExpiry(r,j.calcExpiry(Rl)),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_extend",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_extend",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_extend",i),{error:n.error})},this.onSessionPingRequest=async(r,n)=>{let{id:i}=n;try{this.isValidPing({topic:r}),await this.sendResult({id:i,topic:r,result:!0}),this.client.events.emit("session_ping",{id:i,topic:r})}catch(s){await this.sendError(i,r,s),this.client.logger.error(s)}},this.onSessionPingResponse=(r,n)=>{let{id:i}=n;setTimeout(()=>{yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_ping",i),{}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_ping",i),{error:n.error})},500)},this.onSessionDeleteRequest=async(r,n)=>{let{id:i}=n;try{this.isValidDisconnect({topic:r,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(Ln.RELAYER_EVENTS.publish,async()=>{s(await this.deleteSession(r))})}),this.sendResult({id:i,topic:r,result:!0})]),this.client.events.emit("session_delete",{id:i,topic:r})}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async(r,n)=>{let{id:i,params:s}=n;try{this.isValidRequest(mr({topic:r},s));let o=j.hashMessage(JSON.stringify(yt.formatJsonRpcRequest("wc_sessionRequest",s,i))),a=this.client.session.get(r),u=await this.getVerifyContext(o,a.peer.metadata),c={id:i,topic:r,params:s,verifyContext:u};await this.setPendingSessionRequest(c),this.addSessionRequestToSessionRequestQueue(c),this.processSessionRequestQueue()}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(r,n)=>{let{id:i}=n;yt.isJsonRpcResult(n)?this.events.emit(j.engineEvent("session_request",i),{result:n.result}):yt.isJsonRpcError(n)&&this.events.emit(j.engineEvent("session_request",i),{error:n.error})},this.onSessionEventRequest=async(r,n)=>{let{id:i,params:s}=n;try{let o=`${r}_session_event_${s.event.name}`,a=j.MemoryStore.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(mr({topic:r},s)),this.client.events.emit("session_event",{id:i,topic:r,params:s}),j.MemoryStore.set(o,i)}catch(o){await this.sendError(i,r,o),this.client.logger.error(o)}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Bn.idle,this.processSessionRequestQueue()},Xe.toMiliseconds(this.requestQueueDelay))},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Bn.active){this.client.logger.info("session request queue is already active.");return}let r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Bn.active,this.client.events.emit("session_request",r)}catch(n){this.client.logger.error(n)}},this.onPairingCreated=r=>{if(r.active)return;let n=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);n&&this.onSessionProposeRequest(r.topic,yt.formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer},n.id))},this.isValidConnect=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(u)}let{pairingTopic:n,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(j.isUndefined(n)||await this.isValidPairingTopic(n),!j.isValidRelays(a,!0)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!j.isUndefined(i)&&j.isValidObject(i)!==0&&this.validateNamespaces(i,"requiredNamespaces"),!j.isUndefined(s)&&j.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,n)=>{let i=j.isValidRequiredNamespaces(r,"connect()",n);if(i)throw new Error(i.message)},this.isValidApprove=async r=>{if(!j.isValidParams(r))throw new Error(j.getInternalError("MISSING_OR_INVALID",`approve() params: ${r}`).message);let{id:n,namespaces:i,relayProtocol:s,sessionProperties:o}=r;await this.isValidProposalId(n);let a=this.client.proposal.get(n),u=j.isValidNamespaces(i,"approve()");if(u)throw new Error(u.message);let c=j.isConformingNamespaces(a.requiredNamespaces,i,"approve()");if(c)throw new Error(c.message);if(!j.isValidString(s,!0)){let{message:f}=j.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(f)}j.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}let{id:n,reason:i}=r;if(await this.isValidProposalId(n),!j.isValidErrorReason(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!j.isValidParams(r)){let{message:c}=j.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(c)}let{relay:n,controller:i,namespaces:s,expiry:o}=r;if(!j.isValidRelay(n)){let{message:c}=j.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}let a=j.isValidController(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=j.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(j.isExpired(o)){let{message:c}=j.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(c)}},this.isValidUpdate=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(u)}let{topic:n,namespaces:i}=r;await this.isValidSessionTopic(n);let s=this.client.session.get(n),o=j.isValidNamespaces(i,"update()");if(o)throw new Error(o.message);let a=j.isConformingNamespaces(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionTopic(n)},this.isValidRequest=async r=>{if(!j.isValidParams(r)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(u)}let{topic:n,request:i,chainId:s,expiry:o}=r;await this.isValidSessionTopic(n);let{namespaces:a}=this.client.session.get(n);if(!j.isValidNamespacesChainId(a,s)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!j.isValidRequest(i)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(u)}if(!j.isValidNamespacesRequest(a,s,i.method)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(u)}if(o&&!j.isValidRequestExpiry(o,Bg)){let{message:u}=j.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Bg.min} and ${Bg.max}`);throw new Error(u)}},this.isValidRespond=async r=>{if(!j.isValidParams(r)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(s)}let{topic:n,response:i}=r;if(await this.isValidSessionTopic(n),!j.isValidResponse(i)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw new Error(s)}},this.isValidPing=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.isValidEmit=async r=>{if(!j.isValidParams(r)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}let{topic:n,event:i,chainId:s}=r;await this.isValidSessionTopic(n);let{namespaces:o}=this.client.session.get(n);if(!j.isValidNamespacesChainId(o,s)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!j.isValidEvent(i)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!j.isValidNamespacesEvent(o,s,i.name)){let{message:a}=j.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!j.isValidParams(r)){let{message:i}=j.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(i)}let{topic:n}=r;await this.isValidSessionOrPairingTopic(n)},this.getVerifyContext=async(r,n)=>{let i={verified:{verifyUrl:n.verifyUrl||Ln.VERIFY_SERVER,validation:"UNKNOWN",origin:n.url||""}};try{let s=await this.client.core.verify.resolve({attestationId:r,verifyUrl:n.verifyUrl});s&&(i.verified.origin=s.origin,i.verified.isScam=s.isScam,i.verified.validation=s.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(s){this.client.logger.info(s)}return this.client.logger.info(`Verify context: ${JSON.stringify(i)}`),i},this.validateSessionProps=(r,n)=>{Object.values(r).forEach(i=>{if(!j.isValidString(i,!1)){let{message:s}=j.getInternalError("MISSING_OR_INVALID",`${n} must be in Record format. Received: ${JSON.stringify(i)}`);throw new Error(s)}})}}async isInitialized(){if(!this.initialized){let{message:e}=j.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Ln.RELAYER_EVENTS.message,async e=>{let{topic:r,message:n}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(n)))return;let i=await this.client.core.crypto.decode(r,n);try{yt.isJsonRpcRequest(i)?(this.client.core.history.set(r,i),this.onRelayEventRequest({topic:r,payload:i})):yt.isJsonRpcResponse(i)?(await this.client.core.history.resolve(i),await this.onRelayEventResponse({topic:r,payload:i}),this.client.core.history.delete(r,i.id)):this.onRelayEventUnknownPayload({topic:r,payload:i})}catch(s){this.client.logger.error(s)}})}registerExpirerEvents(){this.client.core.expirer.on(Ln.EXPIRER_EVENTS.expired,async e=>{let{topic:r,id:n}=j.parseExpirerTarget(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,j.getInternalError("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession(r,!0),this.client.events.emit("session_expire",{topic:r})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Ln.PAIRING_EVENTS.create,e=>this.onPairingCreated(e))}isValidPairingTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:r}=j.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!j.isValidString(e,!1)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(!this.client.session.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:r}=j.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j.isValidString(e,!1)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{let{message:r}=j.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!j.isValidId(e)){let{message:r}=j.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){let{message:r}=j.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(j.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:r}=j.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}},Ub=class extends Ln.Store{constructor(e,r){super(e,r,l8,Fg),this.core=e,this.logger=r}},qb=class extends Ln.Store{constructor(e,r){super(e,r,h8,Fg),this.core=e,this.logger=r}},Vb=class extends Ln.Store{constructor(e,r){super(e,r,p8,Fg,n=>n.id),this.core=e,this.logger=r}},Lg=class t extends u8.ISignClient{constructor(e){super(e),this.protocol=Hb,this.version=Gb,this.name=Rg.name,this.events=new c8.EventEmitter,this.on=(n,i)=>this.events.on(n,i),this.once=(n,i)=>this.events.once(n,i),this.off=(n,i)=>this.events.off(n,i),this.removeListener=(n,i)=>this.events.removeListener(n,i),this.removeAllListeners=n=>this.events.removeAllListeners(n),this.connect=async n=>{try{return await this.engine.connect(n)}catch(i){throw this.logger.error(i.message),i}},this.pair=async n=>{try{return await this.engine.pair(n)}catch(i){throw this.logger.error(i.message),i}},this.approve=async n=>{try{return await this.engine.approve(n)}catch(i){throw this.logger.error(i.message),i}},this.reject=async n=>{try{return await this.engine.reject(n)}catch(i){throw this.logger.error(i.message),i}},this.update=async n=>{try{return await this.engine.update(n)}catch(i){throw this.logger.error(i.message),i}},this.extend=async n=>{try{return await this.engine.extend(n)}catch(i){throw this.logger.error(i.message),i}},this.request=async n=>{try{return await this.engine.request(n)}catch(i){throw this.logger.error(i.message),i}},this.respond=async n=>{try{return await this.engine.respond(n)}catch(i){throw this.logger.error(i.message),i}},this.ping=async n=>{try{return await this.engine.ping(n)}catch(i){throw this.logger.error(i.message),i}},this.emit=async n=>{try{return await this.engine.emit(n)}catch(i){throw this.logger.error(i.message),i}},this.disconnect=async n=>{try{return await this.engine.disconnect(n)}catch(i){throw this.logger.error(i.message),i}},this.find=n=>{try{return this.engine.find(n)}catch(i){throw this.logger.error(i.message),i}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}},this.name=e?.name||Rg.name,this.metadata=e?.metadata||j.getAppMetadata();let r=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:Pg.pino(Pg.getDefaultLoggerOptions({level:e?.logger||Rg.logger}));this.core=e?.core||new Ln.Core(e),this.logger=Pg.generateChildLogger(r,this.name),this.session=new qb(this.core,this.logger),this.proposal=new Ub(this.core,this.logger),this.pendingRequest=new Vb(this.core,this.logger),this.engine=new Mb(this)}static async init(e){let r=new t(e);return await r.initialize(),r}get context(){return Pg.getLoggerContext(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},jZ=Lg;Je.ENGINE_CONTEXT=d8,Je.ENGINE_QUEUE_STATES=Bn,Je.ENGINE_RPC_OPTS=Xa,Je.HISTORY_CONTEXT=FZ,Je.HISTORY_EVENTS=LZ,Je.HISTORY_STORAGE_VERSION=MZ,Je.METHODS_TO_VERIFY=g8,Je.PROPOSAL_CONTEXT=l8,Je.PROPOSAL_EXPIRY=UZ,Je.PROPOSAL_EXPIRY_MESSAGE=f8,Je.REQUEST_CONTEXT=p8,Je.SESSION_CONTEXT=h8,Je.SESSION_EXPIRY=Rl,Je.SESSION_REQUEST_EXPIRY_BOUNDARIES=Bg,Je.SIGN_CLIENT_CONTEXT=kb,Je.SIGN_CLIENT_DEFAULT=Rg,Je.SIGN_CLIENT_EVENTS=RZ,Je.SIGN_CLIENT_PROTOCOL=Hb,Je.SIGN_CLIENT_STORAGE_OPTIONS=BZ,Je.SIGN_CLIENT_STORAGE_PREFIX=Fg,Je.SIGN_CLIENT_VERSION=Gb,Je.SignClient=jZ,Je.WALLETCONNECT_DEEPLINK_CHOICE=Fb,Je.default=Lg});var Mg=E(rs=>{"use strict";l();Object.defineProperty(rs,"__esModule",{value:!0});rs.OptionalOperation=rs.Operation=void 0;var QZ;(function(t){t.SIGN_TRANSACTION="mvx_signTransaction",t.SIGN_TRANSACTIONS="mvx_signTransactions",t.SIGN_MESSAGE="mvx_signMessage"})(QZ=rs.Operation||(rs.Operation={}));var WZ;(function(t){t.SIGN_LOGIN_TOKEN="mvx_signLoginToken",t.SIGN_NATIVE_AUTH_TOKEN="mvx_signNativeAuthToken",t.CANCEL_ACTION="mvx_cancelAction"})(WZ=rs.OptionalOperation||(rs.OptionalOperation={}))});var jb=E(Fn=>{"use strict";l();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.WALLETCONNECT_SIGN_LOGIN_DELAY=Fn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Fn.WALLETCONNECT_MULTIVERSX_METHODS=Fn.WALLETCONNECT_MULTIVERSX_NAMESPACE=void 0;var m8=Mg();Fn.WALLETCONNECT_MULTIVERSX_NAMESPACE="mvx";Fn.WALLETCONNECT_MULTIVERSX_METHODS=Object.values(m8.Operation);Fn.WALLETCONNECT_MULTIVERSX_OPTIONAL_METHODS=Object.values(m8.OptionalOperation);Fn.WALLETCONNECT_SIGN_LOGIN_DELAY=200});var zb=E(tn=>{"use strict";l();Object.defineProperty(tn,"__esModule",{value:!0});tn.WalletConnectV2ProviderErrorMessagesEnum=tn.ErrBadAddress=tn.ErrNotImplemented=tn.Err=void 0;var Bl=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};tn.Err=Bl;var Qb=class extends Bl{constructor(){super("Method not yet implemented")}};tn.ErrNotImplemented=Qb;var Wb=class extends Bl{constructor(e,r){super(`Bad address: ${e}`,r)}};tn.ErrBadAddress=Wb;var zZ;(function(t){t.unableToInit="WalletConnect is unable to init",t.notInitialized="WalletConnect is not initialized",t.unableToConnect="WalletConnect is unable to connect",t.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",t.unableToSignLoginToken="WalletConnect could not sign login token",t.unableToSign="WalletConnect could not sign the message",t.unableToLogin="WalletConnect is unable to login",t.unableToHandleTopic="WalletConnect: Unable to handle topic update",t.unableToHandleEvent="WalletConnect: Unable to handle events",t.unableToHandleCleanup="WalletConnect: Unable to handle cleanup",t.sessionNotConnected="WalletConnect Session is not connected",t.sessionDeleted="WalletConnect Session Deleted",t.sessionExpired="WalletConnect Session Expired",t.alreadyLoggedOut="WalletConnect: Already logged out",t.pingFailed="WalletConnect Ping Failed",t.invalidAddress="WalletConnect: Invalid address",t.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",t.invalidMessageResponse="WalletConnect could not sign the message",t.invalidMessageSignature="WalletConnect: Invalid message signature",t.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",t.invalidCustomRequestResponse="WalletConnect could not send the custom request",t.transactionError="Transaction canceled",t.connectionError="WalletConnect could not establish a connection",t.invalidGuardian="WalletConnect: Invalid Guardian"})(zZ=tn.WalletConnectV2ProviderErrorMessagesEnum||(tn.WalletConnectV2ProviderErrorMessagesEnum={}))});var Kb=E(Ug=>{"use strict";l();Object.defineProperty(Ug,"__esModule",{value:!0});Ug.Logger=void 0;var $b=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};Ug.Logger=$b});var w8=E(()=>{"use strict";l();global.Buffer||(global.Buffer=Ls().Buffer)});var v8=E(E8=>{"use strict";l();Object.defineProperty(E8,"__esModule",{value:!0})});var b8=E(A8=>{"use strict";l();Object.defineProperty(A8,"__esModule",{value:!0})});var I8=E(Za=>{"use strict";l();var $Z=Za&&Za.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Za,"__esModule",{value:!0});Za.RelayedTransactionV1Builder=void 0;var KZ=$Z(kt()),Yb=ht(),YZ=Be(),JZ=bn(),XZ=zn(),Jb=class{setInnerTransaction(e){return this.innerTransaction=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}setRelayedTransactionVersion(e){return this.relayedTransactionVersion=e,this}setRelayedTransactionOptions(e){return this.relayedTransactionOptions=e,this}setRelayedTransactionGuardian(e){return this.relayedTransactionGuardian=e,this}build(){if(!this.innerTransaction||!this.netConfig||!this.relayerAddress||!this.innerTransaction.getSignature())throw new YZ.ErrInvalidRelayedV1BuilderArguments;let e=this.prepareInnerTransaction(),r=`relayedTx@${d.Buffer.from(e).toString("hex")}`,n=new XZ.TransactionPayload(r),i=this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length()+this.innerTransaction.getGasLimit().valueOf(),s=new JZ.Transaction({nonce:this.relayerNonce,sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:i,data:n,chainID:this.netConfig.ChainID,version:this.relayedTransactionVersion,options:this.relayedTransactionOptions,guardian:this.relayedTransactionGuardian});return this.relayerNonce&&s.setNonce(this.relayerNonce),s}prepareInnerTransaction(){if(!this.innerTransaction)return"";let e={nonce:this.innerTransaction.getNonce().valueOf(),sender:new Yb.Address(this.innerTransaction.getSender().bech32()).pubkey().toString("base64"),receiver:new Yb.Address(this.innerTransaction.getReceiver().bech32()).pubkey().toString("base64"),value:new KZ.default(this.innerTransaction.getValue().toString(),10).toNumber(),gasPrice:this.innerTransaction.getGasPrice().valueOf(),gasLimit:this.innerTransaction.getGasLimit().valueOf(),data:this.innerTransaction.getData().valueOf().toString("base64"),signature:this.innerTransaction.getSignature().toString("base64"),chainID:d.Buffer.from(this.innerTransaction.getChainID().valueOf()).toString("base64"),version:this.innerTransaction.getVersion().valueOf(),options:this.innerTransaction.getOptions().valueOf()==0?void 0:this.innerTransaction.getOptions().valueOf(),guardian:this.innerTransaction.getGuardian().bech32()?new Yb.Address(this.innerTransaction.getGuardian().bech32()).pubkey().toString("base64"):void 0,guardianSignature:this.innerTransaction.getGuardianSignature().toString("hex")?this.innerTransaction.getGuardianSignature().toString("base64"):void 0,sndUserName:this.innerTransaction.getSenderUsername()?d.Buffer.from(this.innerTransaction.getSenderUsername()).toString("base64"):void 0,rcvUserName:this.innerTransaction.getReceiverUsername()?d.Buffer.from(this.innerTransaction.getReceiverUsername()).toString("base64"):void 0};return JSON.stringify(e)}};Za.RelayedTransactionV1Builder=Jb});var _8=E(qg=>{"use strict";l();Object.defineProperty(qg,"__esModule",{value:!0});qg.Code=void 0;var Xb=class t{constructor(e){this.hex=e}static fromBuffer(e){return new t(e.toString("hex"))}toString(){return this.hex}valueOf(){return d.Buffer.from(this.hex,"hex")}};qg.Code=Xb});var T8=E(S8=>{"use strict";l();Object.defineProperty(S8,"__esModule",{value:!0})});var O8=E(tu=>{"use strict";l();Object.defineProperty(tu,"__esModule",{value:!0});tu.bech32m=tu.bech32=void 0;var Vg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",x8={};for(let t=0;t>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function C8(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=eu(e)^n>>5}e=eu(e);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=e)return"Excess padding";if(i<u)throw new TypeError("Exceeds length limit");o=o.toLowerCase();let c=C8(o);if(typeof c=="string")throw new Error(c);let f=o+"1";for(let h=0;h>5)throw new Error("Non 5-bit word");c=eu(c)^g,f+=Vg.charAt(g)}for(let h=0;h<6;++h)c=eu(c);c^=e;for(let h=0;h<6;++h){let g=c>>(5-h)*5&31;f+=Vg.charAt(g)}return f}function n(o,a){if(a=a||90,o.length<8)return o+" too short";if(o.length>a)return"Exceeds length limit";let u=o.toLowerCase(),c=o.toUpperCase();if(o!==u&&o!==c)return"Mixed-case string "+o;o=u;let f=o.lastIndexOf("1");if(f===-1)return"No separator character for "+o;if(f===0)return"Missing prefix for "+o;let h=o.slice(0,f),g=o.slice(f+1);if(g.length<6)return"Data too short";let y=C8(h);if(typeof y=="string")return y;let m=[];for(let T=0;T=g.length)&&m.push(B)}return y!==e?"Invalid checksum for "+o:{prefix:h,words:m}}function i(o,a){let u=n(o,a);if(typeof u=="object")return u}function s(o,a){let u=n(o,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:s,encode:r,toWords:ZZ,fromWordsUnsafe:eee,fromWords:tee}}tu.bech32=N8("bech32");tu.bech32m=N8("bech32m")});var P8=E(jr=>{"use strict";l();Object.defineProperty(jr,"__esModule",{value:!0});jr.TokenTransferProperties=jr.TransactionMetadataTransfer=jr.TransactionMetadata=jr.TransactionToDecode=jr.TransactionDecoder=void 0;var D8=O8(),eI=class{getTransactionMetadata(e){let r=this.getNormalTransactionMetadata(e),n=this.getEsdtTransactionMetadata(r);if(n)return n;let i=this.getNftTransferMetadata(r);if(i)return i;let s=this.getMultiTransferMetadata(r);return s||r}getNormalTransactionMetadata(e){let r=new co;if(r.sender=e.sender,r.receiver=e.receiver,r.value=BigInt(e.value),e.data){let i=this.base64Decode(e.data).split("@"),s=i.slice(1);if(s.every(o=>this.isSmartContractArgument(o))&&(r.functionName=i[0],r.functionArgs=s),r.functionName==="relayedTx"&&r.functionArgs&&r.functionArgs.length===1)try{let o=JSON.parse(this.hexToString(r.functionArgs[0]));return o.value=o.value.toString(),o.sender=this.bech32Encode(this.base64ToHex(o.sender)),o.receiver=this.bech32Encode(this.base64ToHex(o.receiver)),this.getNormalTransactionMetadata(o)}catch{}if(r.functionName==="relayedTxV2"&&r.functionArgs&&r.functionArgs.length===4)try{let o=new Hg;return o.sender=e.receiver,o.receiver=this.bech32Encode(r.functionArgs[0]),o.data=this.base64Encode(this.hexToString(r.functionArgs[2])),o.value="0",this.getNormalTransactionMetadata(o)}catch{}}return r}getMultiTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="MultiESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<3||!this.isAddressValid(r[0]))return;let n=this.bech32Encode(r[0]),i=this.hexToNumber(r[1]),s=new co;s.transfers||(s.transfers=[]);let o=2;for(let a=0;ao&&(s.functionName=this.hexToString(r[o++]),s.functionArgs=r.slice(o++)),s}getNftTransferMetadata(e){if(e.sender!==e.receiver||e.functionName!=="ESDTNFTTransfer")return;let r=e.functionArgs;if(!r||r.length<4||!this.isAddressValid(r[3]))return;let n=this.hexToString(r[0]),i=r[1],s=this.hexToBigInt(r[2]),o=this.bech32Encode(r[3]),a=new co;return a.sender=e.sender,a.receiver=o,a.value=s,r.length>4&&(a.functionName=this.hexToString(r[4]),a.functionArgs=r.slice(5)),a.transfers=[{value:s,properties:{collection:n,identifier:`${n}-${i}`}}],a}base64Encode(e){return d.Buffer.from(e).toString("base64")}base64Decode(e){return d.Buffer.from(e,"base64").toString("binary")}hexToNumber(e){return parseInt(e,16)}getEsdtTransactionMetadata(e){if(e.functionName!=="ESDTTransfer")return;let r=e.functionArgs;if(!r||r.length<2)return;let n=this.hexToString(r[0]),i=this.hexToBigInt(r[1]),s=new co;return s.sender=e.sender,s.receiver=e.receiver,r.length>2&&(s.functionName=this.hexToString(r[2]),s.functionArgs=r.slice(3)),s.transfers=[{value:i,properties:{identifier:n}}],s.value=i,s}bech32Encode(e){let r=d.Buffer.from(e,"hex"),n=D8.bech32.toWords(r);return D8.bech32.encode("erd",n)}isAddressValid(e){return d.Buffer.from(e,"hex").length==32}isSmartContractArgument(e){return!(!this.isHex(e)||e.length%2!==0)}isHex(e){return new RegExp(/[^a-f0-9]/gi).test(e)===!1}base64ToHex(e){return d.Buffer.from(e,"base64").toString("hex")}hexToString(e){return d.Buffer.from(e,"hex").toString("ascii")}hexToBigInt(e){return BigInt(e?"0x"+e:0)}};jr.TransactionDecoder=eI;var Hg=class{constructor(){this.sender="",this.receiver="",this.data="",this.value="0"}};jr.TransactionToDecode=Hg;var co=class{constructor(){this.sender="",this.receiver="",this.value=BigInt(0)}};jr.TransactionMetadata=co;var tI=class{constructor(){this.value=BigInt(0)}};jr.TransactionMetadataTransfer=tI;var rI=class{};jr.TokenTransferProperties=rI});var nI=E(Gg=>{"use strict";l();Object.defineProperty(Gg,"__esModule",{value:!0});Gg.ReturnCode=void 0;var Ge=class t{constructor(e){this.text=e}static fromBuffer(e){let r=e.toString();return new t(r)}toString(){return this.text}valueOf(){return this.text}equals(e){return e?this.text==e.text:!1}isSuccess(){return this.equals(t.Ok)||this.equals(t.None)}};Gg.ReturnCode=Ge;Ge.None=new Ge("");Ge.Ok=new Ge("ok");Ge.FunctionNotFound=new Ge("function not found");Ge.FunctionWrongSignature=new Ge("wrong signature for function");Ge.ContractNotFound=new Ge("contract not found");Ge.UserError=new Ge("user error");Ge.OutOfGas=new Ge("out of gas");Ge.AccountCollision=new Ge("account collision");Ge.OutOfFunds=new Ge("out of funds");Ge.CallStackOverFlow=new Ge("call stack overflow");Ge.ContractInvalid=new Ge("contract invalid");Ge.ExecutionFailed=new Ge("execution failed");Ge.Unknown=new Ge("unknown")});var L8=E(kg=>{"use strict";l();Object.defineProperty(kg,"__esModule",{value:!0});kg.ResultsParser=void 0;var ree=P8(),R8=ht(),B8=Be(),ns=aa(),nee=Yo(),ru=nI(),nu;(function(t){t.OnTransactionCompleted="completedTxEvent",t.OnSignalError="signalError",t.OnWriteLog="writeLog"})(nu||(nu={}));var iI;(function(t){t.TooMuchGas="@too much gas provided for processing"})(iI||(iI={}));var iee={argsSerializer:new nee.ArgSerializer},sI=class{constructor(e){e=Object.assign(Object.assign({},iee),e),this.argsSerializer=e.argsSerializer}parseQueryResponse(e,r){let n=e.getReturnDataParts(),i=this.argsSerializer.buffersToValues(n,r.output);return{returnCode:new ru.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedQueryResponse(e){return{returnCode:new ru.ReturnCode(e.returnCode.toString()),returnMessage:e.returnMessage,values:e.getReturnDataParts()}}parseOutcome(e,r){let n=this.parseUntypedOutcome(e),i=this.argsSerializer.buffersToValues(n.values,r.output);return{returnCode:n.returnCode,returnMessage:n.returnMessage,values:i,firstValue:i[0],secondValue:i[1],thirdValue:i[2],lastValue:i[i.length-1]}}parseUntypedOutcome(e){let r,n=this.parseTransactionMetadata(e);if(r=this.createBundleOnSimpleMoveBalance(e),r)return ns.Logger.trace("parseUntypedOutcome(): on simple move balance"),r;if(r=this.createBundleOnInvalidTransaction(e),r)return ns.Logger.trace("parseUntypedOutcome(): on invalid transaction"),r;if(r=this.createBundleOnEasilyFoundResultWithReturnData(e.contractResults),r)return ns.Logger.trace("parseUntypedOutcome(): on easily found result with return data"),r;if(r=this.createBundleOnSignalError(e.logs),r)return ns.Logger.trace("parseUntypedOutcome(): on signal error"),r;if(r=this.createBundleOnTooMuchGasWarning(e.logs),r)return ns.Logger.trace("parseUntypedOutcome(): on 'too much gas' warning"),r;if(r=this.createBundleOnWriteLogWhereFirstTopicEqualsAddress(e.logs,e.sender),r)return ns.Logger.trace("parseUntypedOutcome(): on writelog with topics[0] == tx.sender"),r;if(r=this.createBundleWithCustomHeuristics(e,n),r)return ns.Logger.trace("parseUntypedOutcome(): with custom heuristics"),r;if(r=this.createBundleWithFallbackHeuristics(e,n),r)return ns.Logger.trace("parseUntypedOutcome(): with fallback heuristics"),r;throw new B8.ErrCannotParseContractResults(`transaction ${e.hash.toString()}`)}parseTransactionMetadata(e){return new ree.TransactionDecoder().getTransactionMetadata({sender:e.sender.bech32(),receiver:e.receiver.bech32(),data:e.data.toString("base64"),value:e.value.toString()})}createBundleOnSimpleMoveBalance(e){let r=e.contractResults.items.length==0,n=e.logs.events.length==0;return r&&n?{returnCode:ru.ReturnCode.None,returnMessage:ru.ReturnCode.None.toString(),values:[]}:null}createBundleOnInvalidTransaction(e){return e.status.isInvalid()&&e.receipt.data?{returnCode:ru.ReturnCode.OutOfFunds,returnMessage:e.receipt.data,values:[]}:null}createBundleOnEasilyFoundResultWithReturnData(e){let r=e.items.find(o=>o.nonce.valueOf()!=0&&o.data.startsWith("@"));if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.returnMessage||n.toString();return{returnCode:n,returnMessage:s,values:i}}createBundleOnSignalError(e){let r=e.findSingleOrNoneEvent(nu.OnSignalError);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnTooMuchGasWarning(e){let r=e.findSingleOrNoneEvent(nu.OnWriteLog,a=>a.findFirstOrNoneTopic(u=>u.toString().startsWith(iI.TooMuchGas))!=null);if(!r)return null;let{returnCode:n,returnDataParts:i}=this.sliceDataFieldInParts(r.data),s=r.getLastTopic(),o=s?.toString()||n.toString();return{returnCode:n,returnMessage:o,values:i}}createBundleOnWriteLogWhereFirstTopicEqualsAddress(e,r){let n=new R8.Address(r.bech32()).hex(),i=e.findSingleOrNoneEvent(nu.OnWriteLog,u=>u.findFirstOrNoneTopic(c=>c.hex()==n)!=null);if(!i)return null;let{returnCode:s,returnDataParts:o}=this.sliceDataFieldInParts(i.data),a=s.toString();return{returnCode:s,returnMessage:a,values:o}}createBundleWithCustomHeuristics(e,r){return null}createBundleWithFallbackHeuristics(e,r){let n=new R8.Address(r.receiver);for(let i of e.contractResults.items){let s=i.logs.findSingleOrNoneEvent(nu.OnWriteLog,o=>{var a;let u=o.address.bech32()==e.sender.bech32(),c=((a=o.topics[0])===null||a===void 0?void 0:a.hex())==n.hex();return u&&c});if(s){let{returnCode:o,returnDataParts:a}=this.sliceDataFieldInParts(s.data),u=o.toString();return{returnCode:o,returnMessage:u,values:a}}}return null}sliceDataFieldInParts(e){let r=1;e.startsWith("ESDTTransfer")&&(r=3);let n=this.argsSerializer.stringToBuffers(e),i=n[r]||d.Buffer.from([]),s=n.slice(r+1);if(i.length==0)throw new B8.ErrCannotParseContractResults("no return code");return{returnCode:ru.ReturnCode.fromBuffer(i),returnDataParts:s}}parseEvent(e,r){var n,i;let s={},o=e.topics.map(y=>d.Buffer.from(y.valueOf())).slice(1),a=((n=e.dataPayload)===null||n===void 0?void 0:n.valueOf())||d.Buffer.from([]),u=((i=e.additionalData)===null||i===void 0?void 0:i.map(y=>d.Buffer.from(y.valueOf())))||[];u.length==0&&a.length>0&&u.push(d.Buffer.from(a));let c=r.inputs.filter(y=>y.indexed),f=this.argsSerializer.buffersToValues(o,c);for(let y=0;y!y.indexed),g=this.argsSerializer.buffersToValues(u,h);for(let y=0;y{"use strict";l();var see=At&&At.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),or=At&&At.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&see(e,t,r)};Object.defineProperty(At,"__esModule",{value:!0});or(Yo(),At);or(_8(),At);or(vw(),At);or(gE(),At);or(Sc(),At);or(_E(),At);or(EE(),At);or(T8(),At);or(CE(),At);or(Tc(),At);or(L8(),At);or(nI(),At);or(mv(),At);or(BE(),At);or(St(),At)});var M8=E(jg=>{"use strict";l();Object.defineProperty(jg,"__esModule",{value:!0});jg.RelayedTransactionV2Builder=void 0;var F8=Be(),Ll=oI(),oee=bn(),aee=zn(),aI=class{setInnerTransaction(e){return this.innerTransaction=e,this}setInnerTransactionGasLimit(e){return this.innerTransactionGasLimit=e,this}setNetworkConfig(e){return this.netConfig=e,this}setRelayerAddress(e){return this.relayerAddress=e,this}setRelayerNonce(e){return this.relayerNonce=e,this}build(){if(!this.innerTransaction||!this.innerTransactionGasLimit||!this.relayerAddress||!this.netConfig||!this.innerTransaction.getSignature())throw new F8.ErrInvalidRelayedV2BuilderArguments;if(this.innerTransaction.getGasLimit()!=0)throw new F8.ErrGasLimitShouldBe0ForInnerTransaction;let{argumentsString:e}=new Ll.ArgSerializer().valuesToString([new Ll.AddressValue(this.innerTransaction.getReceiver()),new Ll.U64Value(this.innerTransaction.getNonce().valueOf()),new Ll.BytesValue(this.innerTransaction.getData().valueOf()),new Ll.BytesValue(this.innerTransaction.getSignature())]),r=`relayedTxV2@${e}`,n=new aee.TransactionPayload(r),i=new oee.Transaction({sender:this.relayerAddress,receiver:this.innerTransaction.getSender(),value:0,gasLimit:this.innerTransactionGasLimit.valueOf()+this.netConfig.MinGasLimit+this.netConfig.GasPerDataByte*n.length(),data:n,chainID:this.netConfig.ChainID});return this.relayerNonce&&i.setNonce(this.relayerNonce),i}};jg.RelayedTransactionV2Builder=aI});var cI=E(at=>{"use strict";l();var uee=at&&at.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),cee=at&&at.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),U8=at&&at.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&uee(e,t,r);return cee(e,t),e},lee=at&&at.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(at,"__esModule",{value:!0});at.addressToHex=at.bufferToHex=at.utf8ToHex=at.bigIntToHex=at.bigIntToBuffer=at.bufferToBigInt=at.stringToBuffer=void 0;var fee=lee(kt()),hee=ht(),uI=U8(dc()),q8=U8(bh());function dee(t){return d.Buffer.from(t)}at.stringToBuffer=dee;function pee(t){return t.length==0?new fee.default(0):uI.bufferToBigInt(t)}at.bufferToBigInt=pee;function gee(t){return t==0?d.Buffer.from([]):uI.bigIntToBuffer(t)}at.bigIntToBuffer=gee;function yee(t){return t==0?"":uI.getHexMagnitudeOfBigInt(t)}at.bigIntToHex=yee;function mee(t){let e=d.Buffer.from(t).toString("hex");return q8.zeroPadStringIfOddLength(e)}at.utf8ToHex=mee;function wee(t){let e=t.toString("hex");return q8.zeroPadStringIfOddLength(e)}at.bufferToHex=wee;function Eee(t){return hee.Address.fromBech32(t.toString()).pubkey().toString("hex")}at.addressToHex=Eee});var H8=E(Qg=>{"use strict";l();Object.defineProperty(Qg,"__esModule",{value:!0});Qg.TokenOperationsFactory=void 0;var lI=Ss(),vee=aa(),V8=gc(),Aee=bn(),bee=zn(),ne=cI(),fI=class{constructor(e){this.config=e,this.trueAsHex=ne.utf8ToHex("true")}issueFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issue",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.initialSupply),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}notifyAboutUnsettingBurnRoleGlobally(){vee.Logger.info(` ========== IMPORTANT! ========== You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally). -Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).`)}issueSemiFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueSemiFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}issueNonFungible(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["issueNonFungible",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerMetaESDT(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerMetaESDT",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.bigIntToHex(e.numDecimals),...e.canFreeze?[ne.utf8ToHex("canFreeze"),this.trueAsHex]:[],...e.canWipe?[ne.utf8ToHex("canWipe"),this.trueAsHex]:[],...e.canPause?[ne.utf8ToHex("canPause"),this.trueAsHex]:[],...e.canTransferNFTCreateRole?[ne.utf8ToHex("canTransferNFTCreateRole"),this.trueAsHex]:[],...e.canChangeOwner?[ne.utf8ToHex("canChangeOwner"),this.trueAsHex]:[],...e.canUpgrade?[ne.utf8ToHex("canUpgrade"),this.trueAsHex]:[],...e.canAddSpecialRoles?[ne.utf8ToHex("canAddSpecialRoles"),this.trueAsHex]:[]];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}registerAndSetAllRoles(e){this.notifyAboutUnsettingBurnRoleGlobally();let r=["registerAndSetAllRoles",ne.utf8ToHex(e.tokenName),ne.utf8ToHex(e.tokenTicker),ne.utf8ToHex(e.tokenType),ne.bigIntToHex(e.numDecimals)];return this.createTransaction({sender:e.issuer,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,value:this.config.issueCost,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitIssue,dataParts:r})}setBurnRoleGlobally(e){let r=["setBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}unsetBurnRoleGlobally(e){let r=["unsetBurnRoleGlobally",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitToggleBurnRoleGlobally,dataParts:r})}setSpecialRoleOnFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleLocalMint?[ne.utf8ToHex("ESDTRoleLocalMint")]:[],...e.addRoleLocalBurn?[ne.utf8ToHex("ESDTRoleLocalBurn")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnSemiFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTAddQuantity?[ne.utf8ToHex("ESDTRoleNFTAddQuantity")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}setSpecialRoleOnMetaESDT(e){return this.setSpecialRoleOnSemiFungible(e)}setSpecialRoleOnNonFungible(e){let r=["setSpecialRole",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user),...e.addRoleNFTCreate?[ne.utf8ToHex("ESDTRoleNFTCreate")]:[],...e.addRoleNFTBurn?[ne.utf8ToHex("ESDTRoleNFTBurn")]:[],...e.addRoleNFTUpdateAttributes?[ne.utf8ToHex("ESDTRoleNFTUpdateAttributes")]:[],...e.addRoleNFTAddURI?[ne.utf8ToHex("ESDTRoleNFTAddURI")]:[],...e.addRoleESDTTransferRole?[ne.utf8ToHex("ESDTTransferRole")]:[]];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitSetSpecialRole,dataParts:r})}nftCreate(e){let r=["ESDTNFTCreate",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.initialQuantity),ne.utf8ToHex(e.name),ne.bigIntToHex(e.royalties),ne.utf8ToHex(e.hash),ne.bufferToHex(e.attributes),...e.uris.map(ne.utf8ToHex)],i=(e.name+e.hash+e.attributes+e.uris.join("")).length*this.config.gasLimitStorePerByte.valueOf();return this.createTransaction({sender:e.creator,receiver:e.creator,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTCreate.valueOf()+i.valueOf(),dataParts:r})}pause(e){let r=["pause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}unpause(e){let r=["unPause",ne.utf8ToHex(e.tokenIdentifier)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitPausing,dataParts:r})}freeze(e){let r=["freeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}unfreeze(e){let r=["unFreeze",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitFreezing,dataParts:r})}wipe(e){let r=["wipe",ne.utf8ToHex(e.tokenIdentifier),ne.addressToHex(e.user)];return this.createTransaction({sender:e.manager,receiver:this.config.esdtContractAddress,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitWiping,dataParts:r})}localMint(e){let r=["ESDTLocalMint",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToMint)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalMint,dataParts:r})}localBurn(e){let r=["ESDTLocalBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.supplyToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTLocalBurn,dataParts:r})}updateAttributes(e){let r=["ESDTNFTUpdateAttributes",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bufferToHex(e.attributes)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTUpdateAttributes,dataParts:r})}addQuantity(e){let r=["ESDTNFTAddQuantity",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToAdd)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTAddQuantity,dataParts:r})}burnQuantity(e){let r=["ESDTNFTBurn",ne.utf8ToHex(e.tokenIdentifier),ne.bigIntToHex(e.tokenNonce),ne.bigIntToHex(e.quantityToBurn)];return this.createTransaction({sender:e.manager,receiver:e.manager,nonce:e.transactionNonce,gasPrice:e.gasPrice,gasLimitHint:e.gasLimit,executionGasLimit:this.config.gasLimitESDTNFTBurn,dataParts:r})}createTransaction({sender:e,receiver:r,nonce:n,value:i,gasPrice:s,gasLimitHint:o,executionGasLimit:a,dataParts:u}){let l=this.buildTransactionPayload(u),f=o||this.computeGasLimit(l,a),d=new pB.TransactionVersion(Xb.TRANSACTION_VERSION_DEFAULT),g=new pB.TransactionOptions(Xb.TRANSACTION_OPTIONS_DEFAULT);return new BZ.Transaction({chainID:this.config.chainID,sender:e,receiver:r,gasLimit:f,gasPrice:s,nonce:n||0,value:i||0,data:l,version:d,options:g})}buildTransactionPayload(e){let r=e.join(Xb.ARGUMENTS_SEPARATOR);return new LZ.TransactionPayload(r)}computeGasLimit(e,r){return this.config.minGasLimit.valueOf()+this.config.gasLimitPerByte.valueOf()*e.length()+r.valueOf()}};Gg.TokenOperationsFactory=Zb});var yB=m(kg=>{"use strict";c();Object.defineProperty(kg,"__esModule",{value:!0});kg.TokenOperationsFactoryConfig=void 0;var FZ=ht(),e_=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=FZ.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};kg.TokenOperationsFactoryConfig=e_});var wB=m(jg=>{"use strict";c();Object.defineProperty(jg,"__esModule",{value:!0});jg.TokenOperationsOutcomeParser=void 0;var MZ=ht(),t_=Be(),mB=Jb(),r_=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=h.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new t_.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new t_.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new t_.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return mB.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return mB.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return MZ.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};jg.TokenOperationsOutcomeParser=r_});var EB=m(ci=>{"use strict";c();var UZ=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),n_=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&UZ(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});n_(gB(),ci);n_(yB(),ci);n_(wB(),ci)});var vB=m(Ze=>{"use strict";c();var qZ=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ct=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qZ(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});Q8();Ct(ra(),Ze);Ct(ht(),Ze);Ct(sE(),Ze);Ct(Be(),Ze);Ct(tE(),Ze);Ct($8(),Ze);Ct(K8(),Ze);Ct(na(),Ze);Ct(cc(),Ze);Ct(Y8(),Ze);Ct(lB(),Ze);Ct(fB(),Ze);Ct($b(),Ze);Ct(EB(),Ze);Ct(Em(),Ze);Ct(wn(),Ze);Ct(jn(),Ze);Ct(ed(),Ze);Ct(Zw(),Ze);Ct(wr(),Ze)});var TB=m(xt=>{"use strict";c();var VZ=xt&&xt.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(xt,"__esModule",{value:!0});xt.sleep=xt.getMetadata=xt.applyTransactionSignature=xt.getAddressFromSession=xt.addressIsValid=xt.getConnectionParams=xt.getCurrentTopic=xt.getCurrentSession=void 0;var _B=vB(),AB=jh(),HZ=cl(),Qg=Db(),li=Bb(),i_=Fb(),bB=Bg();function IB(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(SB(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}xt.getCurrentSession=IB;function GZ(t,e){if(!e)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=IB(t,e);if(!r?.topic)throw new Error(li.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}xt.getCurrentTopic=GZ;function SB(t,e){var r,n,i;let s=[...Qg.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes(bB.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push(bB.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}xt.getConnectionParams=SB;function kZ(t){try{return!_B.Address.fromBech32(t).isEmpty()}catch{return!1}}xt.addressIsValid=kZ;function jZ(t){let e=t.namespaces[Qg.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}xt.getAddressFromSession=jZ;function QZ({transaction:t,response:e}){if(!e)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw i_.Logger.error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(li.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(_B.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new AB.Signature(r)),n&&t.applyGuardianSignature(new AB.Signature(n)),t}xt.applyTransactionSignature=QZ;function WZ(t){if(t)return Object.assign(Object.assign({},t),{url:HZ.getAppMetadata().url})}xt.getMetadata=WZ;function $Z(t){return VZ(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}xt.sleep=$Z});var Cl=m(yr=>{"use strict";c();var bt=yr&&yr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},zZ=yr&&yr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yr,"__esModule",{value:!0});yr.WalletConnectV2Provider=yr.OptionalOperation=yr.Operation=yr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var KZ=jh(),YZ=zZ(k8()),s_=cl(),oo=Db(),ye=Bb();Object.defineProperty(yr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=Fb(),Zi=Bg();Object.defineProperty(yr,"Operation",{enumerable:!0,get:function(){return Zi.Operation}});Object.defineProperty(yr,"OptionalOperation",{enumerable:!0,get:function(){return Zi.OptionalOperation}});var jt=TB(),o_=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return bt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:jt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield YZ.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=jt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Le.Logger.error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return bt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield jt.sleep(oo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=jt.getAddressFromSession(n),o=n.namespaces[oo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?Zi.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:Zi.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||jt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:s_.getSdkError("USER_DISCONNECTED")});else{let r=jt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:s_.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new KZ.Signature(n))}catch{throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return jt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:Zi.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];jt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${oo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:jt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=jt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return bt(this,void 0,void 0,function*(){return e?jt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Le.Logger.error(`${ye.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return bt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=jt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&jt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:l}=a,f=e.session.get(o),d=Object.assign(Object.assign({},f),{namespaces:l});this.onSessionConnected({session:d})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>bt(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>bt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=jt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,l;return bt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!s_.isValidArray(f))return;for(let d of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(d.topic,0);else try{yield(l=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||l===void 0?void 0:l.unsubscribe(d.topic)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};yr.WalletConnectV2Provider=o_});var xB=m((Fye,CB)=>{"use strict";c();CB.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var DB=m((Uye,OB)=>{"use strict";c();var NB=typeof Symbol<"u"&&Symbol,JZ=xB();OB.exports=function(){return typeof NB!="function"||typeof Symbol!="function"||typeof NB("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:JZ()}});var BB=m((Vye,RB)=>{"use strict";c();var PB={foo:{}},XZ=Object;RB.exports=function(){return{__proto__:PB}.foo===PB.foo&&!({__proto__:null}instanceof XZ)}});var MB=m((Gye,FB)=>{"use strict";c();var ZZ="Function.prototype.bind called on incompatible ",eee=Object.prototype.toString,tee=Math.max,ree="[object Function]",LB=function(e,r){for(var n=[],i=0;i{"use strict";c();var see=MB();UB.exports=Function.prototype.bind||see});var VB=m((Wye,qB)=>{"use strict";c();var oee=Function.prototype.call,aee=Object.prototype.hasOwnProperty,uee=Wg();qB.exports=uee.call(oee,aee)});var es=m((zye,QB)=>{"use strict";c();var Pe,iu=SyntaxError,jB=Function,nu=TypeError,a_=function(t){try{return jB('"use strict"; return ('+t+").constructor;")()}catch{}},ao=Object.getOwnPropertyDescriptor;if(ao)try{ao({},"")}catch{ao=null}var u_=function(){throw new nu},cee=ao?function(){try{return arguments.callee,u_}catch{try{return ao(arguments,"callee").get}catch{return u_}}}():u_,tu=DB()(),lee=BB()(),Mt=Object.getPrototypeOf||(lee?function(t){return t.__proto__}:null),ru={},fee=typeof Uint8Array>"u"||!Mt?Pe:Mt(Uint8Array),uo={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":tu&&Mt?Mt([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":ru,"%AsyncGenerator%":ru,"%AsyncGeneratorFunction%":ru,"%AsyncIteratorPrototype%":ru,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Pe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pe:FinalizationRegistry,"%Function%":jB,"%GeneratorFunction%":ru,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":tu&&Mt?Mt(Mt([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!tu||!Mt?Pe:Mt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pe:Promise,"%Proxy%":typeof Proxy>"u"?Pe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!tu||!Mt?Pe:Mt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":tu&&Mt?Mt(""[Symbol.iterator]()):Pe,"%Symbol%":tu?Symbol:Pe,"%SyntaxError%":iu,"%ThrowTypeError%":cee,"%TypedArray%":fee,"%TypeError%":nu,"%Uint8Array%":typeof Uint8Array>"u"?Pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Pe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pe:WeakSet};if(Mt)try{null.error}catch(t){HB=Mt(Mt(t)),uo["%Error.prototype%"]=HB}var HB,hee=function t(e){var r;if(e==="%AsyncFunction%")r=a_("async function () {}");else if(e==="%GeneratorFunction%")r=a_("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=a_("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&Mt&&(r=Mt(i.prototype))}return uo[e]=r,r},GB={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},xl=Wg(),$g=VB(),dee=xl.call(Function.call,Array.prototype.concat),pee=xl.call(Function.apply,Array.prototype.splice),kB=xl.call(Function.call,String.prototype.replace),zg=xl.call(Function.call,String.prototype.slice),gee=xl.call(Function.call,RegExp.prototype.exec),yee=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,mee=/\\(\\)?/g,wee=function(e){var r=zg(e,0,1),n=zg(e,-1);if(r==="%"&&n!=="%")throw new iu("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new iu("invalid intrinsic syntax, expected opening `%`");var i=[];return kB(e,yee,function(s,o,a,u){i[i.length]=a?kB(u,mee,"$1"):o||s}),i},Eee=function(e,r){var n=e,i;if($g(GB,n)&&(i=GB[n],n="%"+i[0]+"%"),$g(uo,n)){var s=uo[n];if(s===ru&&(s=hee(n)),typeof s>"u"&&!r)throw new nu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new iu("intrinsic "+e+" does not exist!")};QB.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new nu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new nu('"allowMissing" argument must be a boolean');if(gee(/^%?[^%]*%?$/,e)===null)throw new iu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=wee(e),i=n.length>0?n[0]:"",s=Eee("%"+i+"%",r),o=s.name,a=s.value,u=!1,l=s.alias;l&&(i=l[0],pee(n,dee([0,1],l)));for(var f=1,d=!0;f=n.length){var T=ao(a,g);d=!!T,d&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[g]}else d=$g(a,g),a=a[g];d&&!u&&(uo[o]=a)}}return a}});var f_=m((Yye,WB)=>{"use strict";c();var vee=es(),c_=vee("%Object.defineProperty%",!0),l_=function(){if(c_)try{return c_({},"a",{value:1}),!0}catch{return!1}return!1};l_.hasArrayLengthDefineBug=function(){if(!l_())return null;try{return c_([],"length",{value:1}).length!==1}catch{return!0}};WB.exports=l_});var h_=m((Xye,$B)=>{"use strict";c();var Aee=es(),Kg=Aee("%Object.getOwnPropertyDescriptor%",!0);if(Kg)try{Kg([],"length")}catch{Kg=null}$B.exports=Kg});var YB=m((e0e,KB)=>{"use strict";c();var bee=f_()(),d_=es(),Nl=bee&&d_("%Object.defineProperty%",!0);if(Nl)try{Nl({},"a",{value:1})}catch{Nl=!1}var _ee=d_("%SyntaxError%"),su=d_("%TypeError%"),zB=h_();KB.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new su("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new su("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new su("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new su("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new su("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new su("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!zB&&zB(e,r);if(Nl)Nl(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new _ee("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var rL=m((r0e,tL)=>{"use strict";c();var eL=es(),JB=YB(),Iee=f_()(),XB=h_(),ZB=eL("%TypeError%"),See=eL("%Math.floor%");tL.exports=function(e,r){if(typeof e!="function")throw new ZB("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||See(r)!==r)throw new ZB("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&XB){var o=XB(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(Iee?JB(e,"length",r,!0,!0):JB(e,"length",r)),e}});var aL=m((i0e,Yg)=>{"use strict";c();var p_=Wg(),ou=es(),Tee=rL(),Cee=ou("%TypeError%"),iL=ou("%Function.prototype.apply%"),sL=ou("%Function.prototype.call%"),oL=ou("%Reflect.apply%",!0)||p_.call(sL,iL),Ol=ou("%Object.defineProperty%",!0),xee=ou("%Math.max%");if(Ol)try{Ol({},"a",{value:1})}catch{Ol=null}Yg.exports=function(e){if(typeof e!="function")throw new Cee("a function is required");var r=oL(p_,sL,arguments);return Tee(r,1+xee(0,e.length-(arguments.length-1)),!0)};var nL=function(){return oL(p_,iL,arguments)};Ol?Ol(Yg.exports,"apply",{value:nL}):Yg.exports.apply=nL});var fL=m((o0e,lL)=>{"use strict";c();var uL=es(),cL=aL(),Nee=cL(uL("String.prototype.indexOf"));lL.exports=function(e,r){var n=uL(e,!!r);return typeof n=="function"&&Nee(e,".prototype.")>-1?cL(n):n}});var hL=m(()=>{c()});var PL=m((f0e,DL)=>{c();var I_=typeof Map=="function"&&Map.prototype,g_=Object.getOwnPropertyDescriptor&&I_?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Xg=I_&&g_&&typeof g_.get=="function"?g_.get:null,dL=I_&&Map.prototype.forEach,S_=typeof Set=="function"&&Set.prototype,y_=Object.getOwnPropertyDescriptor&&S_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Zg=S_&&y_&&typeof y_.get=="function"?y_.get:null,pL=S_&&Set.prototype.forEach,Oee=typeof WeakMap=="function"&&WeakMap.prototype,Pl=Oee?WeakMap.prototype.has:null,Dee=typeof WeakSet=="function"&&WeakSet.prototype,Rl=Dee?WeakSet.prototype.has:null,Pee=typeof WeakRef=="function"&&WeakRef.prototype,gL=Pee?WeakRef.prototype.deref:null,Ree=Boolean.prototype.valueOf,Bee=Object.prototype.toString,Lee=Function.prototype.toString,Fee=String.prototype.match,T_=String.prototype.slice,rs=String.prototype.replace,Mee=String.prototype.toUpperCase,yL=String.prototype.toLowerCase,SL=RegExp.prototype.test,mL=Array.prototype.concat,Rn=Array.prototype.join,Uee=Array.prototype.slice,wL=Math.floor,E_=typeof BigInt=="function"?BigInt.prototype.valueOf:null,m_=Object.getOwnPropertySymbols,v_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,au=typeof Symbol=="function"&&typeof Symbol.iterator=="object",er=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===au||"symbol")?Symbol.toStringTag:null,TL=Object.prototype.propertyIsEnumerable,EL=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function vL(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||SL.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-wL(-t):wL(t);if(n!==t){var i=String(n),s=T_.call(e,i.length+1);return rs.call(i,r,"$&_")+"."+rs.call(rs.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return rs.call(e,r,"$&_")}var A_=hL(),AL=A_.custom,bL=xL(AL)?AL:null;DL.exports=function t(e,r,n,i){var s=r||{};if(ts(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ts(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=ts(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ts(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ts(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return OL(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?vL(e,u):u}if(typeof e=="bigint"){var l=String(e)+"n";return a?vL(e,l):l}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return b_(e)?"[Array]":"[Object]";var d=rte(s,n);if(typeof i>"u")i=[];else if(NL(i,e)>=0)return"[Circular]";function g(k,K,pe){if(K&&(i=Uee.call(i),i.push(K)),pe){var ue={depth:s.depth};return ts(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(k,ue,n+1,i)}return t(k,s,n+1,i)}if(typeof e=="function"&&!_L(e)){var w=$ee(e),E=Jg(e,g);return"[Function"+(w?": "+w:" (anonymous)")+"]"+(E.length>0?" { "+Rn.call(E,", ")+" }":"")}if(xL(e)){var T=au?rs.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):v_.call(e);return typeof e=="object"&&!au?Dl(T):T}if(Zee(e)){for(var D="<"+yL.call(String(e.nodeName)),B=e.attributes||[],W=0;W",D}if(b_(e)){if(e.length===0)return"[]";var U=Jg(e,g);return d&&!tte(U)?"["+__(U,d)+"]":"[ "+Rn.call(U,", ")+" ]"}if(Hee(e)){var A=Jg(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!TL.call(e,"cause")?"{ ["+String(e)+"] "+Rn.call(mL.call("[cause]: "+g(e.cause),A),", ")+" }":A.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Rn.call(A,", ")+" }"}if(typeof e=="object"&&o){if(bL&&typeof e[bL]=="function"&&A_)return A_(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(zee(e)){var I=[];return dL&&dL.call(e,function(k,K){I.push(g(K,e,!0)+" => "+g(k,e))}),IL("Map",Xg.call(e),I,d)}if(Jee(e)){var N=[];return pL&&pL.call(e,function(k){N.push(g(k,e))}),IL("Set",Zg.call(e),N,d)}if(Kee(e))return w_("WeakMap");if(Xee(e))return w_("WeakSet");if(Yee(e))return w_("WeakRef");if(kee(e))return Dl(g(Number(e)));if(Qee(e))return Dl(g(E_.call(e)));if(jee(e))return Dl(Ree.call(e));if(Gee(e))return Dl(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Vee(e)&&!_L(e)){var _=Jg(e,g),S=EL?EL(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",J=!S&&er&&Object(e)===e&&er in e?T_.call(ns(e),8,-1):R?"Object":"",Q=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",V=Q+(J||R?"["+Rn.call(mL.call([],J||[],R||[]),": ")+"] ":"");return _.length===0?V+"{}":d?V+"{"+__(_,d)+"}":V+"{ "+Rn.call(_,", ")+" }"}return String(e)};function CL(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function qee(t){return rs.call(String(t),/"/g,""")}function b_(t){return ns(t)==="[object Array]"&&(!er||!(typeof t=="object"&&er in t))}function Vee(t){return ns(t)==="[object Date]"&&(!er||!(typeof t=="object"&&er in t))}function _L(t){return ns(t)==="[object RegExp]"&&(!er||!(typeof t=="object"&&er in t))}function Hee(t){return ns(t)==="[object Error]"&&(!er||!(typeof t=="object"&&er in t))}function Gee(t){return ns(t)==="[object String]"&&(!er||!(typeof t=="object"&&er in t))}function kee(t){return ns(t)==="[object Number]"&&(!er||!(typeof t=="object"&&er in t))}function jee(t){return ns(t)==="[object Boolean]"&&(!er||!(typeof t=="object"&&er in t))}function xL(t){if(au)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!v_)return!1;try{return v_.call(t),!0}catch{}return!1}function Qee(t){if(!t||typeof t!="object"||!E_)return!1;try{return E_.call(t),!0}catch{}return!1}var Wee=Object.prototype.hasOwnProperty||function(t){return t in this};function ts(t,e){return Wee.call(t,e)}function ns(t){return Bee.call(t)}function $ee(t){if(t.name)return t.name;var e=Fee.call(Lee.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function NL(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return OL(T_.call(t,0,e.maxStringLength),e)+n}var i=rs.call(rs.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ete);return CL(i,"single",e)}function ete(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Mee.call(e.toString(16))}function Dl(t){return"Object("+t+")"}function w_(t){return t+" { ? }"}function IL(t,e,r,n){var i=n?__(r,n):Rn.call(r,", ");return t+" ("+e+") {"+i+"}"}function tte(t){for(var e=0;e=0)return!1;return!0}function rte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Rn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Rn.call(Array(e+1),r)}}function __(t,e){if(t.length===0)return"";var r=` -`+e.prev+e.base;return r+Rn.call(t,","+r)+` -`+e.prev}function Jg(t,e){var r=b_(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";c();var C_=es(),uu=fL(),nte=PL(),ite=C_("%TypeError%"),ey=C_("%WeakMap%",!0),ty=C_("%Map%",!0),ste=uu("WeakMap.prototype.get",!0),ote=uu("WeakMap.prototype.set",!0),ate=uu("WeakMap.prototype.has",!0),ute=uu("Map.prototype.get",!0),cte=uu("Map.prototype.set",!0),lte=uu("Map.prototype.has",!0),x_=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},fte=function(t,e){var r=x_(t,e);return r&&r.value},hte=function(t,e,r){var n=x_(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},dte=function(t,e){return!!x_(t,e)};RL.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new ite("Side channel does not contain "+nte(s))},get:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ste(e,s)}else if(ty){if(r)return ute(r,s)}else if(n)return fte(n,s)},has:function(s){if(ey&&s&&(typeof s=="object"||typeof s=="function")){if(e)return ate(e,s)}else if(ty){if(r)return lte(r,s)}else if(n)return dte(n,s);return!1},set:function(s,o){ey&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ey),ote(e,s,o)):ty?(r||(r=new ty),cte(r,s,o)):(n||(n={key:{},next:null}),hte(n,s,o))}};return i}});var ry=m((g0e,LL)=>{"use strict";c();var pte=String.prototype.replace,gte=/%20/g,N_={RFC1738:"RFC1738",RFC3986:"RFC3986"};LL.exports={default:N_.RFC3986,formatters:{RFC1738:function(t){return pte.call(t,gte,"+")},RFC3986:function(t){return String(t)}},RFC1738:N_.RFC1738,RFC3986:N_.RFC3986}});var D_=m((m0e,ML)=>{"use strict";c();var yte=ry(),O_=Object.prototype.hasOwnProperty,co=Array.isArray,Bn=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mte=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(co(n)){for(var i=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===yte.RFC1738&&(l===40||l===41)){a+=o.charAt(u);continue}if(l<128){a=a+Bn[l];continue}if(l<2048){a=a+(Bn[192|l>>6]+Bn[128|l&63]);continue}if(l<55296||l>=57344){a=a+(Bn[224|l>>12]+Bn[128|l>>6&63]+Bn[128|l&63]);continue}u+=1,l=65536+((l&1023)<<10|o.charCodeAt(u)&1023),a+=Bn[240|l>>18]+Bn[128|l>>12&63]+Bn[128|l>>6&63]+Bn[128|l&63]}return a},bte=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";c();var VL=BL(),R_=D_(),Bl=ry(),Cte=Object.prototype.hasOwnProperty,UL={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},lo=Array.isArray,xte=String.prototype.split,Nte=Array.prototype.push,HL=function(t,e){Nte.apply(t,lo(e)?e:[e])},Ote=Date.prototype.toISOString,qL=Bl.default,Qt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:R_.encode,encodeValuesOnly:!1,format:qL,formatter:Bl.formatters[qL],indices:!1,serializeDate:function(e){return Ote.call(e)},skipNulls:!1,strictNullHandling:!1},Dte=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},P_={},Pte=function t(e,r,n,i,s,o,a,u,l,f,d,g,w,E,T){for(var D=e,B=T,W=0,U=!1;(B=B.get(P_))!==void 0&&!U;){var A=B.get(e);if(W+=1,typeof A<"u"){if(A===W)throw new RangeError("Cyclic object value");U=!0}typeof B.get(P_)>"u"&&(W=0)}if(typeof a=="function"?D=a(r,D):D instanceof Date?D=f(D):n==="comma"&&lo(D)&&(D=R_.maybeMap(D,function(re){return re instanceof Date?f(re):re})),D===null){if(i)return o&&!w?o(r,Qt.encoder,E,"key",d):r;D=""}if(Dte(D)||R_.isBuffer(D)){if(o){var I=w?r:o(r,Qt.encoder,E,"key",d);if(n==="comma"&&w){for(var N=xte.call(String(D),","),_="",S=0;S"u")return R;var J;if(n==="comma"&&lo(D))J=[{value:D.length>0?D.join(",")||null:void 0}];else if(lo(a))J=a;else{var Q=Object.keys(D);J=u?Q.sort(u):Q}for(var V=0;V"u"?Qt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Qt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Qt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Qt.encode,encoder:typeof e.encoder=="function"?e.encoder:Qt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Qt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Qt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Qt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Qt.strictNullHandling}};GL.exports=function(t,e){var r=t,n=Rte(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):lo(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in UL?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=UL[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var l=VL(),f=0;f0?w+g:""}});var WL=m((A0e,QL)=>{"use strict";c();var cu=D_(),B_=Object.prototype.hasOwnProperty,Bte=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:cu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Lte=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},jL=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Fte="utf8=%26%2310003%3B",Mte="utf8=%E2%9C%93",Ute=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,l=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(E=Bte(E)?[E]:E),B_.call(n,w)?n[w]=cu.combine(n[w],E):n[w]=E}return n},qte=function(t,e,r,n){for(var i=n?e:jL(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,l=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(l)&&a!==u&&String(l)===u&&l>=0&&r.parseArrays&&l<=r.arrayLimit?(o=[],o[l]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Vte=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),l=u?s.slice(0,u.index):s,f=[];if(l){if(!n.plainObjects&&B_.call(Object.prototype,l)&&!n.allowPrototypes)return;f.push(l)}for(var d=0;n.depth>0&&(u=a.exec(s))!==null&&d"u"?Ut.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Ut.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Ut.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Ut.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Ut.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Ut.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Ut.comma,decoder:typeof e.decoder=="function"?e.decoder:Ut.decoder,delimiter:typeof e.delimiter=="string"||cu.isRegExp(e.delimiter)?e.delimiter:Ut.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Ut.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Ut.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Ut.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Ut.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Ut.strictNullHandling}};QL.exports=function(t,e){var r=Hte(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Ute(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";c();var Gte=kL(),kte=WL(),jte=ry();$L.exports={formats:jte,parse:kte,stringify:Gte}});var L_=m(ut=>{"use strict";c();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var KL=m(lu=>{"use strict";c();Object.defineProperty(lu,"__esModule",{value:!0});lu.ErrCannotSignedMessage=lu.ErrCannotGetSignedTransactions=void 0;var F_=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};lu.ErrCannotGetSignedTransactions=F_;var M_=class extends Error{constructor(){super("Cannot get signed message")}};lu.ErrCannotSignedMessage=M_});var YL=m(ny=>{"use strict";c();Object.defineProperty(ny,"__esModule",{value:!0});ny.PlainSignedTransaction=void 0;var U_=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};ny.PlainSignedTransaction=U_});var Ll=m(os=>{"use strict";c();var is=os&&os.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})},Qte=os&&os.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(os,"__esModule",{value:!0});os.WalletProvider=void 0;var q_=Qte(zL()),ss=L_(),V_=KL(),Wte=YL(),H_=class t{constructor(e){this.walletUrl=e}login(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return is(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return is(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return is(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return is(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ss.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=q_.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new V_.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return is(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ss.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return is(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=q_.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ss.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ss.WALLET_PROVIDER_CALLBACK_PARAM]===ss.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new V_.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new V_.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=t.prepareWalletTransaction(o);for(let u in a)a.hasOwnProperty(u)&&!i.hasOwnProperty(u)&&(i[u]=[]),i[u].push(a[u])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};os.WalletProvider=H_});var G_=m((R0e,JL)=>{"use strict";c();JL.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";c();var $te=G_(),fo=Object.prototype.toString;function Q_(t){return fo.call(t)==="[object Array]"}function k_(t){return typeof t>"u"}function zte(t){return t!==null&&!k_(t)&&t.constructor!==null&&!k_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Kte(t){return fo.call(t)==="[object ArrayBuffer]"}function Yte(t){return typeof FormData<"u"&&t instanceof FormData}function Jte(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function Xte(t){return typeof t=="string"}function Zte(t){return typeof t=="number"}function XL(t){return t!==null&&typeof t=="object"}function iy(t){if(fo.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function ere(t){return fo.call(t)==="[object Date]"}function tre(t){return fo.call(t)==="[object File]"}function rre(t){return fo.call(t)==="[object Blob]"}function ZL(t){return fo.call(t)==="[object Function]"}function nre(t){return XL(t)&&ZL(t.pipe)}function ire(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function sre(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function ore(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function W_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),Q_(t))for(var r=0,n=t.length;r{"use strict";c();var fu=mr();function tF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}rF.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(fu.isURLSearchParams(r))i=r.toString();else{var s=[];fu.forEach(r,function(u,l){u===null||typeof u>"u"||(fu.isArray(u)?l=l+"[]":u=[u],fu.forEach(u,function(d){fu.isDate(d)?d=d.toISOString():fu.isObject(d)&&(d=JSON.stringify(d)),s.push(tF(l)+"="+tF(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var iF=m((q0e,nF)=>{"use strict";c();var cre=mr();function sy(){this.handlers=[]}sy.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};sy.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};sy.prototype.forEach=function(e){cre.forEach(this.handlers,function(n){n!==null&&e(n)})};nF.exports=sy});var oF=m((H0e,sF)=>{"use strict";c();var lre=mr();sF.exports=function(e,r){lre.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var z_=m((k0e,aF)=>{"use strict";c();aF.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,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}});var K_=m((Q0e,uF)=>{"use strict";c();var fre=z_();uF.exports=function(e,r,n,i,s){var o=new Error(e);return fre(o,r,n,i,s)}});var lF=m(($0e,cF)=>{"use strict";c();var hre=K_();cF.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(hre("Request failed with status code "+n.status,n.config,null,n.request,n))}});var hF=m((K0e,fF)=>{"use strict";c();var oy=mr();fF.exports=oy.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),oy.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),oy.isString(s)&&u.push("path="+s),oy.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var pF=m((J0e,dF)=>{"use strict";c();dF.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var yF=m((Z0e,gF)=>{"use strict";c();gF.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var wF=m((tme,mF)=>{"use strict";c();var dre=pF(),pre=yF();mF.exports=function(e,r){return e&&!dre(r)?pre(e,r):r}});var vF=m((nme,EF)=>{"use strict";c();var Y_=mr(),gre=["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"];EF.exports=function(e){var r={},n,i,s;return e&&Y_.forEach(e.split(` -`),function(a){if(s=a.indexOf(":"),n=Y_.trim(a.substr(0,s)).toLowerCase(),i=Y_.trim(a.substr(s+1)),n){if(r[n]&&gre.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var _F=m((sme,bF)=>{"use strict";c();var AF=mr();bF.exports=AF.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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 n=i(window.location.href),function(o){var a=AF.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Fl=m((ame,IF)=>{"use strict";c();function J_(t){this.message=t}J_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};J_.prototype.__CANCEL__=!0;IF.exports=J_});var Z_=m((cme,SF)=>{"use strict";c();var ay=mr(),yre=lF(),mre=hF(),wre=$_(),Ere=wF(),vre=vF(),Are=_F(),X_=K_(),bre=Ml(),_re=Fl();SF.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function l(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}ay.isFormData(s)&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+g)}var w=Ere(e.baseURL,e.url);f.open(e.method.toUpperCase(),wre(w,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function E(){if(f){var D="getAllResponseHeaders"in f?vre(f.getAllResponseHeaders()):null,B=!a||a==="text"||a==="json"?f.responseText:f.response,W={data:B,status:f.status,statusText:f.statusText,headers:D,config:e,request:f};yre(function(A){n(A),l()},function(A){i(A),l()},W),f=null}}if("onloadend"in f?f.onloadend=E:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(E)},f.onabort=function(){f&&(i(X_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(X_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",W=e.transitional||bre.transitional;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),i(X_(B,e,W.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},ay.isStandardBrowserEnv()){var T=(e.withCredentials||Are(w))&&e.xsrfCookieName?mre.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&ay.forEach(o,function(B,W){typeof s>"u"&&W.toLowerCase()==="content-type"?delete o[W]:f.setRequestHeader(W,B)}),ay.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(D){f&&(i(!D||D&&D.type?new _re("canceled"):D),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),f.send(s)})}});var Ml=m((fme,xF)=>{"use strict";c();var Wt=mr(),TF=oF(),Ire=z_(),Sre={"Content-Type":"application/x-www-form-urlencoded"};function CF(t,e){!Wt.isUndefined(t)&&Wt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Tre(){var t;return typeof XMLHttpRequest<"u"?t=Z_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=Z_()),t}function Cre(t,e,r){if(Wt.isString(t))try{return(e||JSON.parse)(t),Wt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var uy={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Tre(),transformRequest:[function(e,r){return TF(r,"Accept"),TF(r,"Content-Type"),Wt.isFormData(e)||Wt.isArrayBuffer(e)||Wt.isBuffer(e)||Wt.isStream(e)||Wt.isFile(e)||Wt.isBlob(e)?e:Wt.isArrayBufferView(e)?e.buffer:Wt.isURLSearchParams(e)?(CF(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Wt.isObject(e)||r&&r["Content-Type"]==="application/json"?(CF(r,"application/json"),Cre(e)):e}],transformResponse:[function(e){var r=this.transitional||uy.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&Wt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Ire(o,this,"E_JSON_PARSE"):o}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, */*"}}};Wt.forEach(["delete","get","head"],function(e){uy.headers[e]={}});Wt.forEach(["post","put","patch"],function(e){uy.headers[e]=Wt.merge(Sre)});xF.exports=uy});var OF=m((dme,NF)=>{"use strict";c();var xre=mr(),Nre=Ml();NF.exports=function(e,r,n){var i=this||Nre;return xre.forEach(n,function(o){e=o.call(i,e,r)}),e}});var eI=m((gme,DF)=>{"use strict";c();DF.exports=function(e){return!!(e&&e.__CANCEL__)}});var BF=m((mme,RF)=>{"use strict";c();var PF=mr(),tI=OF(),Ore=eI(),Dre=Ml(),Pre=Fl();function rI(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Pre("canceled")}RF.exports=function(e){rI(e),e.headers=e.headers||{},e.data=tI.call(e,e.data,e.headers,e.transformRequest),e.headers=PF.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),PF.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||Dre.adapter;return r(e).then(function(i){return rI(e),i.data=tI.call(e,i.data,i.headers,e.transformResponse),i},function(i){return Ore(i)||(rI(e),i&&i.response&&(i.response.data=tI.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var nI=m((Eme,LF)=>{"use strict";c();var Ir=mr();LF.exports=function(e,r){r=r||{};var n={};function i(f,d){return Ir.isPlainObject(f)&&Ir.isPlainObject(d)?Ir.merge(f,d):Ir.isPlainObject(d)?Ir.merge({},d):Ir.isArray(d)?d.slice():d}function s(f){if(Ir.isUndefined(r[f])){if(!Ir.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!Ir.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(Ir.isUndefined(r[f])){if(!Ir.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var l={url:o,method:o,data:o,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:u};return Ir.forEach(Object.keys(e).concat(Object.keys(r)),function(d){var g=l[d]||s,w=g(d);Ir.isUndefined(w)&&g!==u||(n[d]=w)}),n}});var iI=m((Ame,FF)=>{c();FF.exports={version:"0.24.0"}});var qF=m((_me,UF)=>{"use strict";c();var Rre=iI().version,sI={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){sI[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var MF={};sI.transitional=function(e,r,n){function i(s,o){return"[Axios v"+Rre+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!MF[o]&&(MF[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Bre(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}UF.exports={assertOptions:Bre,validators:sI}});var QF=m((Sme,jF)=>{"use strict";c();var GF=mr(),Lre=$_(),VF=iF(),HF=BF(),cy=nI(),kF=qF(),hu=kF.validators;function Ul(t){this.defaults=t,this.interceptors={request:new VF,response:new VF}}Ul.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=cy(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&kF.assertOptions(r,{silentJSONParsing:hu.transitional(hu.boolean),forcedJSONParsing:hu.transitional(hu.boolean),clarifyTimeoutError:hu.transitional(hu.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var o;if(!i){var a=[HF,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var l=n.shift(),f=n.shift();try{u=l(u)}catch(d){f(d);break}}try{o=HF(u)}catch(d){return Promise.reject(d)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};Ul.prototype.getUri=function(e){return e=cy(this.defaults,e),Lre(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};GF.forEach(["delete","get","head","options"],function(e){Ul.prototype[e]=function(r,n){return this.request(cy(n||{},{method:e,url:r,data:(n||{}).data}))}});GF.forEach(["post","put","patch"],function(e){Ul.prototype[e]=function(r,n,i){return this.request(cy(i||{},{method:e,url:r,data:n}))}});jF.exports=Ul});var $F=m((Cme,WF)=>{"use strict";c();var Fre=Fl();function du(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";c();zF.exports=function(e){return function(n){return e.apply(null,n)}}});var JF=m((Dme,YF)=>{"use strict";c();YF.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var eM=m((Rme,oI)=>{"use strict";c();var XF=mr(),Mre=G_(),ly=QF(),Ure=nI(),qre=Ml();function ZF(t){var e=new ly(t),r=Mre(ly.prototype.request,e);return XF.extend(r,ly.prototype,e),XF.extend(r,e),r.create=function(i){return ZF(Ure(t,i))},r}var Ln=ZF(qre);Ln.Axios=ly;Ln.Cancel=Fl();Ln.CancelToken=$F();Ln.isCancel=eI();Ln.VERSION=iI().version;Ln.all=function(e){return Promise.all(e)};Ln.spread=KF();Ln.isAxiosError=JF();oI.exports=Ln;oI.exports.default=Ln});var rM=m((Lme,tM)=>{c();tM.exports=eM()});var nM=m(fy=>{"use strict";c();Object.defineProperty(fy,"__esModule",{value:!0});fy.NativeAuthClientConfig=void 0;var aI=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};fy.NativeAuthClientConfig=aI});var cI=m(pu=>{"use strict";c();var ho=pu&&pu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{l(n.next(f))}catch(d){o(d)}}function u(f){try{l(n.throw(f))}catch(d){o(d)}}function l(f){f.done?s(f.value):i(f.value).then(a,u)}l((n=n.apply(t,e||[])).next())})};Object.defineProperty(pu,"__esModule",{value:!0});pu.NativeAuthClient=void 0;var Vre=rM(),Hre=nM(),uI=class{constructor(e){this.config=Object.assign(new Hre.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return ho(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return ho(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return ho(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return ho(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return ho(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return ho(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(h.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return ho(this,void 0,void 0,function*(){return yield Vre.default.get(e,{headers:this.config.extraRequestHeaders})})}};pu.NativeAuthClient=uI});var uM=m(py=>{"use strict";c();Object.defineProperty(py,"__esModule",{value:!0});py.TransactionStatus=void 0;var lI=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};py.TransactionStatus=lI});var mu=m(Vt=>{"use strict";c();var Gre=Vt&&Vt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kre=Vt&&Vt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),jre=Vt&&Vt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Gre(e,t,r);return kre(e,t),e};Object.defineProperty(Vt,"__esModule",{value:!0});Vt.zeroPadStringIfOddLength=Vt.isPaddedHex=Vt.numberToPaddedHex=Vt.Nonce=Vt.Address=void 0;var cM=jre(Rm()),Qre="erd",fI=class t{constructor(e){this.value=e}static fromPubkey(e){let r=cM.toWords(e),n=cM.encode(Qre,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Vt.Address=fI;var hI=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return lM(this.value)}};Vt.Nonce=hI;function lM(t){let e=t.toString(16);return fM(e)}Vt.numberToPaddedHex=lM;function Wre(t){t=t||"";let e=h.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Vt.isPaddedHex=Wre;function fM(t){return t=t||"",t.length%2==1?"0"+t:t}Vt.zeroPadStringIfOddLength=fM});var dM=m(gy=>{"use strict";c();Object.defineProperty(gy,"__esModule",{value:!0});gy.TransactionReceipt=void 0;var hM=mu(),dI=class t{constructor(){this.value="",this.sender=new hM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new hM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};gy.TransactionReceipt=dI});var pM=m(Fn=>{"use strict";c();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ErrContractQuery=Fn.ErrNetworkProvider=Fn.ErrUnexpectedCondition=Fn.Err=void 0;var wu=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Fn.Err=wu;var pI=class extends wu{constructor(e){super(`Unexpected condition: [${e}]`)}};Fn.ErrUnexpectedCondition=pI;var gI=class extends wu{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Fn.ErrNetworkProvider=gI;var yI=class extends wu{constructor(e){super(e.message.replace("executeQuery:",""))}};Fn.ErrContractQuery=yI});var yM=m(cs=>{"use strict";c();Object.defineProperty(cs,"__esModule",{value:!0});cs.TransactionEventTopic=cs.TransactionEventData=cs.TransactionEvent=void 0;var gM=mu(),mI=class t{constructor(e){this.address=new gM.Address(""),this.identifier="",this.topics=[],this.dataPayload=new ql(h.Buffer.from("","utf8")),this.data="",Object.assign(this,e)}static fromHttpResponse(e){let r=new t;r.address=new gM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(i=>new yy(i));let n=h.Buffer.from(e.data||"","base64");return r.dataPayload=new ql(n),r.data=n.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};cs.TransactionEvent=mI;var ql=class{constructor(e){this.raw=e}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};cs.TransactionEventData=ql;var yy=class{constructor(e){this.raw=h.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};cs.TransactionEventTopic=yy});var EI=m(my=>{"use strict";c();Object.defineProperty(my,"__esModule",{value:!0});my.TransactionLogs=void 0;var $re=pM(),mM=mu(),zre=yM(),wI=class t{constructor(e){this.address=new mM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new mM.Address(e.address),r.events=(e.events||[]).map(n=>zre.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new $re.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};my.TransactionLogs=wI});var EM=m(Eu=>{"use strict";c();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.ContractResultItem=Eu.ContractResults=void 0;var wM=EI(),wy=mu(),vI=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>Vl.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>Vl.fromApiHttpResponse(n));return new t(r)}};Eu.ContractResults=vI;var Vl=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new wy.Address(""),this.sender=new wy.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new wM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=h.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new wy.Address(e.receiver),r.sender=new wy.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=wM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Eu.ContractResultItem=Vl});var vM=m(ls=>{"use strict";c();var Kre=ls&&ls.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ls,"__esModule",{value:!0});ls.EsdtContractAddress=ls.MaxUint64AsBigNumber=void 0;var Yre=Kre(Gt()),Jre=mu();ls.MaxUint64AsBigNumber=new Yre.default("18446744073709551615");ls.EsdtContractAddress=new Jre.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var AM=m(vu=>{"use strict";c();var Xre=vu&&vu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(vu,"__esModule",{value:!0});vu.ContractQueryResponse=void 0;var Zre=Xre(Gt()),ene=vM(),AI=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new Zre.default(e.gasRemaining||e.GasRemaining||0),o=ene.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>h.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};vu.ContractQueryResponse=AI});var bM=m(Ey=>{"use strict";c();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.ContractQueryRequest=void 0;var bI=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Ey.ContractQueryRequest=bI});var RM=m((zwe,PM)=>{c();PM.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var fs=m(go=>{c();var _I,tne=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];go.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};go.getSymbolTotalCodewords=function(e){return tne[e]};go.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};go.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');_I=e};go.isKanjiModeEnabled=function(){return typeof _I<"u"};go.toSJIS=function(e){return _I(e)}});var by=m(kr=>{c();kr.L={bit:1};kr.M={bit:0};kr.Q={bit:3};kr.H={bit:2};function rne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return kr.L;case"m":case"medium":return kr.M;case"q":case"quartile":return kr.Q;case"h":case"high":return kr.H;default:throw new Error("Unknown EC Level: "+t)}}kr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};kr.from=function(e,r){if(kr.isValid(e))return e;try{return rne(e)}catch{return r}}});var FM=m((eEe,LM)=>{c();function BM(){this.buffer=[],this.length=0}BM.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};LM.exports=BM});var UM=m((rEe,MM)=>{c();function Hl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Hl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Hl.prototype.get=function(t,e){return this.data[t*this.size+e]};Hl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};MM.exports=Hl});var qM=m(_y=>{c();var nne=fs().getSymbolSize;_y.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=nne(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{c();var ine=fs().getSymbolSize,VM=7;HM.getPositions=function(e){let r=ine(e);return[[0,0],[r-VM,0],[0,r-VM]]}});var kM=m(et=>{c();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var yo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=yo.N1+(i-5)),o=f,i=1),f=e.get(l,u),f===a?s++:(s>=5&&(n+=yo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=yo.N1+(i-5)),s>=5&&(n+=yo.N1+(s-5))}return n};et.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*yo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{c();var hs=by(),Iy=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Sy=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];II.getBlocksCount=function(e,r){switch(r){case hs.L:return Iy[(e-1)*4+0];case hs.M:return Iy[(e-1)*4+1];case hs.Q:return Iy[(e-1)*4+2];case hs.H:return Iy[(e-1)*4+3];default:return}};II.getTotalCodewordsCount=function(e,r){switch(r){case hs.L:return Sy[(e-1)*4+0];case hs.M:return Sy[(e-1)*4+1];case hs.Q:return Sy[(e-1)*4+2];case hs.H:return Sy[(e-1)*4+3];default:return}}});var jM=m(Cy=>{c();var Gl=new Uint8Array(512),Ty=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Gl[r]=e,Ty[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Gl[r]=Gl[r-255]})();Cy.log=function(e){if(e<1)throw new Error("log("+e+")");return Ty[e]};Cy.exp=function(e){return Gl[e]};Cy.mul=function(e,r){return e===0||r===0?0:Gl[Ty[e]+Ty[r]]}});var QM=m(kl=>{c();var TI=jM();kl.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{c();var WM=QM();function CI(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}CI.prototype.initialize=function(e){this.degree=e,this.genPoly=WM.generateECPolynomial(this.degree)};CI.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=WM.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};$M.exports=CI});var xI=m(KM=>{c();KM.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var NI=m(fi=>{c();var YM="[0-9]+",one="[A-Z $%*+\\-./:]+",jl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";jl=jl.replace(/u/g,"\\u");var ane="(?:(?![A-Z0-9 $%*+\\-./:]|"+jl+`)(?:.|[\r -]))+`;fi.KANJI=new RegExp(jl,"g");fi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");fi.BYTE=new RegExp(ane,"g");fi.NUMERIC=new RegExp(YM,"g");fi.ALPHANUMERIC=new RegExp(one,"g");var une=new RegExp("^"+jl+"$"),cne=new RegExp("^"+YM+"$"),lne=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");fi.testKanji=function(e){return une.test(e)};fi.testNumeric=function(e){return cne.test(e)};fi.testAlphanumeric=function(e){return lne.test(e)}});var ds=m(Nt=>{c();var fne=xI(),OI=NI();Nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Nt.MIXED={bit:-1};Nt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!fne.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Nt.getBestModeForData=function(e){return OI.testNumeric(e)?Nt.NUMERIC:OI.testAlphanumeric(e)?Nt.ALPHANUMERIC:OI.testKanji(e)?Nt.KANJI:Nt.BYTE};Nt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Nt.isValid=function(e){return e&&e.bit&&e.ccBits};function hne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Nt.NUMERIC;case"alphanumeric":return Nt.ALPHANUMERIC;case"kanji":return Nt.KANJI;case"byte":return Nt.BYTE;default:throw new Error("Unknown mode: "+t)}}Nt.from=function(e,r){if(Nt.isValid(e))return e;try{return hne(e)}catch{return r}}});var tU=m(mo=>{c();var xy=fs(),dne=SI(),JM=by(),ps=ds(),DI=xI(),ZM=7973,XM=xy.getBCHDigit(ZM);function pne(t,e,r){for(let n=1;n<=40;n++)if(e<=mo.getCapacity(n,r,t))return n}function eU(t,e){return ps.getCharCountIndicator(t,e)+4}function gne(t,e){let r=0;return t.forEach(function(n){let i=eU(n.mode,e);r+=i+n.getBitsLength()}),r}function yne(t,e){for(let r=1;r<=40;r++)if(gne(t,r)<=mo.getCapacity(r,e,ps.MIXED))return r}mo.from=function(e,r){return DI.isValid(e)?parseInt(e,10):r};mo.getCapacity=function(e,r,n){if(!DI.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ps.BYTE);let i=xy.getSymbolTotalCodewords(e),s=dne.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ps.MIXED)return o;let a=o-eU(n,e);switch(n){case ps.NUMERIC:return Math.floor(a/10*3);case ps.ALPHANUMERIC:return Math.floor(a/11*2);case ps.KANJI:return Math.floor(a/13);case ps.BYTE:default:return Math.floor(a/8)}};mo.getBestVersionForData=function(e,r){let n,i=JM.from(r,JM.M);if(Array.isArray(e)){if(e.length>1)return yne(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return pne(n.mode,n.getLength(),i)};mo.getEncodedBits=function(e){if(!DI.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;xy.getBCHDigit(r)-XM>=0;)r^=ZM<{c();var PI=fs(),nU=1335,mne=21522,rU=PI.getBCHDigit(nU);iU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;PI.getBCHDigit(i)-rU>=0;)i^=nU<{c();var wne=ds();function Au(t){this.mode=wne.NUMERIC,this.data=t.toString()}Au.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Au.prototype.getLength=function(){return this.data.length};Au.prototype.getBitsLength=function(){return Au.getBitsLength(this.data.length)};Au.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};oU.exports=Au});var cU=m((OEe,uU)=>{c();var Ene=ds(),RI=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function bu(t){this.mode=Ene.ALPHANUMERIC,this.data=t}bu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};bu.prototype.getLength=function(){return this.data.length};bu.prototype.getBitsLength=function(){return bu.getBitsLength(this.data.length)};bu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=RI.indexOf(this.data[r])*45;n+=RI.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(RI.indexOf(this.data[r]),6)};uU.exports=bu});var fU=m((PEe,lU)=>{"use strict";c();lU.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var dU=m((BEe,hU)=>{c();var vne=fU(),Ane=ds();function _u(t){this.mode=Ane.BYTE,typeof t=="string"&&(t=vne(t)),this.data=new Uint8Array(t)}_u.getBitsLength=function(e){return e*8};_u.prototype.getLength=function(){return this.data.length};_u.prototype.getBitsLength=function(){return _u.getBitsLength(this.data.length)};_u.prototype.write=function(t){for(let e=0,r=this.data.length;e{c();var bne=ds(),_ne=fs();function Iu(t){this.mode=bne.KANJI,this.data=t}Iu.getBitsLength=function(e){return e*13};Iu.prototype.getLength=function(){return this.data.length};Iu.prototype.getBitsLength=function(){return Iu.getBitsLength(this.data.length)};Iu.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};pU.exports=Iu});var yU=m((UEe,BI)=>{"use strict";c();var Ql={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Ql.PriorityQueue.make();s.push(e,0);for(var o,a,u,l,f,d,g,w,E;!s.empty();){o=s.pop(),a=o.value,l=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(d=f[u],g=l+d,w=i[u],E=typeof i[u]>"u",(E||w>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Ql.single_source_shortest_paths(t,e,r);return Ql.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Ql.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof BI<"u"&&(BI.exports=Ql)});var IU=m(Su=>{c();var He=ds(),EU=aU(),vU=cU(),AU=dU(),bU=gU(),Wl=NI(),Ny=fs(),Ine=yU();function mU(t){return unescape(encodeURIComponent(t)).length}function $l(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function _U(t){let e=$l(Wl.NUMERIC,He.NUMERIC,t),r=$l(Wl.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ny.isKanjiModeEnabled()?(n=$l(Wl.BYTE,He.BYTE,t),i=$l(Wl.KANJI,He.KANJI,t)):(n=$l(Wl.BYTE_KANJI,He.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function LI(t,e){switch(e){case He.NUMERIC:return EU.getBitsLength(t);case He.ALPHANUMERIC:return vU.getBitsLength(t);case He.KANJI:return bU.getBitsLength(t);case He.BYTE:return AU.getBitsLength(t)}}function Sne(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function Tne(t){let e=[];for(let r=0;r{c();var Dy=fs(),FI=by(),xne=FM(),Nne=UM(),One=qM(),Dne=GM(),qI=kM(),VI=SI(),Pne=zM(),Oy=tU(),Rne=sU(),Bne=ds(),MI=IU();function Lne(t,e){let r=t.size,n=Dne.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function Fne(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function UI(t,e,r){let n=t.size,i=Rne.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function qne(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let l=!1;o>>s&1)===1),t.set(i,a-u,l),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Vne(t,e,r){let n=new xne;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Bne.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Dy.getSymbolTotalCodewords(t),s=VI.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u{"use strict";l();Object.defineProperty(Wg,"__esModule",{value:!0});Wg.TokenOperationsFactoryConfig=void 0;var Iee=ht(),hI=class{constructor(e){this.minGasPrice=1e9,this.minGasLimit=5e4,this.gasLimitPerByte=1500,this.gasLimitIssue=6e7,this.gasLimitToggleBurnRoleGlobally=6e7,this.gasLimitESDTLocalMint=3e5,this.gasLimitESDTLocalBurn=3e5,this.gasLimitSetSpecialRole=6e7,this.gasLimitPausing=6e7,this.gasLimitFreezing=6e7,this.gasLimitWiping=6e7,this.gasLimitESDTNFTCreate=3e6,this.gasLimitESDTNFTUpdateAttributes=1e6,this.gasLimitESDTNFTAddQuantity=1e6,this.gasLimitESDTNFTBurn=1e6,this.gasLimitStorePerByte=5e4,this.issueCost="50000000000000000",this.esdtContractAddress=Iee.Address.fromBech32("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u"),this.chainID=e}};Wg.TokenOperationsFactoryConfig=hI});var j8=E(zg=>{"use strict";l();Object.defineProperty(zg,"__esModule",{value:!0});zg.TokenOperationsOutcomeParser=void 0;var _ee=ht(),dI=Be(),k8=cI(),pI=class{parseIssueFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issue");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueNonFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueNonFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseIssueSemiFungible(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"issueSemiFungible");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterMetaESDT(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerMetaESDT");return{tokenIdentifier:this.extractTokenIdentifier(r)}}parseRegisterAndSetAllRoles(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"registerAndSetAllRoles"),n=this.extractTokenIdentifier(r),s=this.findSingleEventByIdentifier(e,"ESDTSetRole").topics.slice(3).map(o=>o.valueOf().toString());return{tokenIdentifier:n,roles:s}}parseSetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseUnsetBurnRoleGlobally(e){return this.ensureNoError(e),{}}parseSetSpecialRole(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTSetRole"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=r.topics.slice(3).map(o=>o.valueOf().toString());return{userAddress:n,tokenIdentifier:i,roles:s}}parseNFTCreate(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTCreate"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,initialQuantity:s}}parseLocalMint(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalMint"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,mintedSupply:o}}parseLocalBurn(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTLocalBurn"),n=r.address.toString(),i=this.extractTokenIdentifier(r),s=this.extractNonce(r),o=this.extractAmount(r);return{userAddress:n,tokenIdentifier:i,nonce:s,burntSupply:o}}parsePause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTPause");return{}}parseUnpause(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnPause");return{}}parseFreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUnfreeze(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTUnFreeze"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseWipe(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTWipe"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{userAddress:this.extractAddress(r),tokenIdentifier:n,nonce:i,balance:s}}parseUpdateAttributes(e){var r;this.ensureNoError(e);let n=this.findSingleEventByIdentifier(e,"ESDTNFTUpdateAttributes"),i=this.extractTokenIdentifier(n),s=this.extractNonce(n),o=(r=n.topics[3])===null||r===void 0?void 0:r.valueOf();return{tokenIdentifier:i,nonce:s,attributes:o}}parseAddQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTAddQuantity"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,addedQuantity:s}}parseBurnQuantity(e){this.ensureNoError(e);let r=this.findSingleEventByIdentifier(e,"ESDTNFTBurn"),n=this.extractTokenIdentifier(r),i=this.extractNonce(r),s=this.extractAmount(r);return{tokenIdentifier:n,nonce:i,burntQuantity:s}}ensureNoError(e){var r;for(let n of e.logs.events)if(n.identifier=="signalError"){let i=d.Buffer.from(n.data.substring(1),"hex").toString(),s=(r=n.topics[1])===null||r===void 0?void 0:r.valueOf().toString();throw new dI.ErrCannotParseTransactionOutcome(e.hash,`encountered signalError: ${s} (${i})`)}}findSingleEventByIdentifier(e,r){let n=this.gatherAllEvents(e).filter(i=>i.identifier==r);if(n.length==0)throw new dI.ErrCannotParseTransactionOutcome(e.hash,`cannot find event of type ${r}`);if(n.length>1)throw new dI.ErrCannotParseTransactionOutcome(e.hash,`more than one event of type ${r}`);return n[0]}gatherAllEvents(e){let r=[];r.push(...e.logs.events);for(let n of e.contractResults.items)r.push(...n.logs.events);return r}extractTokenIdentifier(e){var r;return(r=e.topics[0])===null||r===void 0?void 0:r.valueOf().toString()}extractNonce(e){var r;return k8.bufferToBigInt((r=e.topics[1])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAmount(e){var r;return k8.bufferToBigInt((r=e.topics[2])===null||r===void 0?void 0:r.valueOf()).toFixed(0)}extractAddress(e){var r;return _ee.Address.fromBuffer((r=e.topics[3])===null||r===void 0?void 0:r.valueOf()).toString()}};zg.TokenOperationsOutcomeParser=pI});var Q8=E(hi=>{"use strict";l();var See=hi&&hi.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gI=hi&&hi.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&See(e,t,r)};Object.defineProperty(hi,"__esModule",{value:!0});gI(H8(),hi);gI(G8(),hi);gI(j8(),hi)});var W8=E(Ze=>{"use strict";l();var Tee=Ze&&Ze.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Ct=Ze&&Ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Tee(e,t,r)};Object.defineProperty(Ze,"__esModule",{value:!0});w8();Ct(oa(),Ze);Ct(ht(),Ze);Ct(fE(),Ze);Ct(Be(),Ze);Ct(aE(),Ze);Ct(v8(),Ze);Ct(b8(),Ze);Ct(aa(),Ze);Ct(gc(),Ze);Ct(I8(),Ze);Ct(M8(),Ze);Ct(Bd(),Ze);Ct(oI(),Ze);Ct(Q8(),Ze);Ct(_m(),Ze);Ct(bn(),Ze);Ct(zn(),Ze);Ct(ud(),Ze);Ct(sE(),Ze);Ct(vr(),Ze)});var X8=E(xt=>{"use strict";l();var Cee=xt&&xt.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(xt,"__esModule",{value:!0});xt.sleep=xt.getMetadata=xt.applyTransactionSignature=xt.getAddressFromSession=xt.addressIsValid=xt.getConnectionParams=xt.getCurrentTopic=xt.getCurrentSession=void 0;var K8=W8(),z8=vc(),xee=wl(),$g=jb(),di=zb(),yI=Kb(),$8=Mg();function Y8(t,e){if(!e)throw new Error(di.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=e.find(J8(t)).filter(n=>n.acknowledged);if(r.length>0){let n=r.length-1;return r[n]}if(e.session.length>0){let n=e.session.keys.length-1;return e.session.get(e.session.keys[n])}throw yI.Logger.error(di.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),new Error(di.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}xt.getCurrentSession=Y8;function Nee(t,e){if(!e)throw new Error(di.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Y8(t,e);if(!r?.topic)throw new Error(di.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);return r.topic}xt.getCurrentTopic=Nee;function J8(t,e){var r,n,i;let s=[...$g.WALLETCONNECT_MULTIVERSX_METHODS,...(r=e?.methods)!==null&&r!==void 0?r:[]];!((n=e?.methods)===null||n===void 0)&&n.includes($8.OptionalOperation.SIGN_LOGIN_TOKEN)||s.push($8.OptionalOperation.SIGN_LOGIN_TOKEN);let o=[`${$g.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${t}`],a=(i=e?.events)!==null&&i!==void 0?i:[];return{requiredNamespaces:{[$g.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:s,chains:o,events:a}}}}xt.getConnectionParams=J8;function Oee(t){try{return!K8.Address.fromBech32(t).isEmpty()}catch{return!1}}xt.addressIsValid=Oee;function Dee(t){let e=t.namespaces[$g.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(e&&e.accounts){let r=e.accounts[0],[n,i,s]=r.split(":");return s}return""}xt.getAddressFromSession=Dee;function Pee({transaction:t,response:e}){if(!e)throw yI.Logger.error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);let{signature:r,guardianSignature:n,version:i,options:s,guardian:o}=e,a=t.getGuardian().bech32();if(a&&a!==o)throw yI.Logger.error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian),new Error(di.WalletConnectV2ProviderErrorMessagesEnum.invalidGuardian);return o&&t.setGuardian(K8.Address.fromBech32(o)),i&&t.setVersion(i),s!=null&&t.setOptions(s),t.applySignature(new z8.Signature(r)),n&&t.applyGuardianSignature(new z8.Signature(n)),t}xt.applyTransactionSignature=Pee;function Ree(t){if(t)return Object.assign(Object.assign({},t),{url:xee.getAppMetadata().url})}xt.getMetadata=Ree;function Bee(t){return Cee(this,void 0,void 0,function*(){return yield new Promise(e=>setTimeout(()=>{e()},t))})}xt.sleep=Bee});var Fl=E(wr=>{"use strict";l();var bt=wr&&wr.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},Lee=wr&&wr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wr,"__esModule",{value:!0});wr.WalletConnectV2Provider=wr.OptionalOperation=wr.Operation=wr.WalletConnectV2ProviderErrorMessagesEnum=void 0;var Fee=vc(),Mee=Lee(y8()),mI=wl(),lo=jb(),ye=zb();Object.defineProperty(wr,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return ye.WalletConnectV2ProviderErrorMessagesEnum}});var Le=Kb(),is=Mg();Object.defineProperty(wr,"Operation",{enumerable:!0,get:function(){return is.Operation}});Object.defineProperty(wr,"OptionalOperation",{enumerable:!0,get:function(){return is.OptionalOperation}});var Qt=X8(),wI=class{constructor(e,r,n,i,s){this.chainId="",this.address="",this.signature="",this.isInitializing=!1,this.processingTopic="",this.options={},this.onClientConnect=e,this.chainId=r,this.walletConnectV2Relay=n,this.walletConnectV2ProjectId=i,this.options=s}reset(){this.address="",this.signature="",this.walletConnector=void 0,this.session=void 0,this.pairings=void 0}init(){var e,r;return bt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{if(!this.isInitializing){this.isInitializing=!0,this.reset();let n=!((e=this.options)===null||e===void 0)&&e.metadata?{metadata:Qt.getMetadata((r=this.options)===null||r===void 0?void 0:r.metadata)}:{},i=yield Mee.default.init(Object.assign(Object.assign(Object.assign({},this.options),{relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId}),n));this.walletConnector=i,this.isInitializing=!1,yield this.subscribeToEvents(i),yield this.checkPersistedState(i)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,r)=>e(!!(this.isInitialized()&&typeof this.session<"u")))}connect(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let r=Qt.getConnectionParams(this.chainId,e);try{return yield this.walletConnector.connect(Object.assign({pairingTopic:e?.topic},r))}catch{throw this.reset(),Le.Logger.error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(e?.topic?ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting:ye.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect)}})}login(e){var r;return bt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout({topic:(r=this.session)===null||r===void 0?void 0:r.topic}));try{if(e&&e.approval){let n=yield e.approval();if(e.token){yield Qt.sleep(lo.WALLETCONNECT_SIGN_LOGIN_DELAY);let i=Qt.getAddressFromSession(n),o=n.namespaces[lo.WALLETCONNECT_MULTIVERSX_NAMESPACE].methods.includes(is.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN)?is.OptionalOperation.SIGN_NATIVE_AUTH_TOKEN:is.OptionalOperation.SIGN_LOGIN_TOKEN,{signature:a}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:n.topic,request:{method:o,params:{token:e.token,address:i}}});if(!a)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:a})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw this.reset(),Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.processingTopic===(e?.topic||Qt.getCurrentTopic(this.chainId,this.walletConnector)))return!0;if(e?.topic)this.processingTopic=e.topic,yield this.walletConnector.disconnect({topic:e.topic,reason:mI.getSdkError("USER_DISCONNECTED")});else{let r=Qt.getCurrentTopic(this.chainId,this.walletConnector);this.processingTopic=r,yield this.walletConnector.disconnect({topic:r,reason:mI.getSdkError("USER_DISCONNECTED")}),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0})}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.processingTopic=""}return!0})}getAddress(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e,r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(s=(i=(n=(r=(e=this.walletConnector)===null||e===void 0?void 0:e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!0}))!==null&&s!==void 0?s:[]})}signMessage(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let r=yield this.getAddress(),{signature:n}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:is.Operation.SIGN_MESSAGE,params:{address:r,message:e.message.toString()}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new Fee.Signature(n))}catch{throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToSign)}return e})}signTransaction(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.toPlainObject();if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let n=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:is.Operation.SIGN_TRANSACTION,params:{transaction:r}}});return Qt.applyTransactionSignature({transaction:e,response:n})}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let r=e.map(n=>{if(this.chainId!==n.getChainID().valueOf())throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return n.toPlainObject()});try{let{signatures:n}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:{method:is.Operation.SIGN_TRANSACTIONS,params:{transactions:r}}});if(!n)throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);if(!Array.isArray(n)||e.length!==n.length)throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[i,s]of e.entries()){let o=n[i];Qt.applyTransactionSignature({transaction:s,response:o})}return e}catch{throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var r;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((r=e?.request)===null||r===void 0)&&r.method){try{let n=Object.assign({},e.request),{method:i}=n,{response:s}=yield this.walletConnector.request({chainId:`${lo.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`,topic:Qt.getCurrentTopic(this.chainId,this.walletConnector),request:Object.assign(Object.assign({},n),{method:i})});s||Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse)}return}})}ping(){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session>"u"&&Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{let e=Qt.getCurrentTopic(this.chainId,this.walletConnector);return yield this.walletConnector.ping({topic:e}),!0}catch{return Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return bt(this,void 0,void 0,function*(){return e?Qt.addressIsValid(e.address)?(this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin(),this.address):(Le.Logger.error(`${ye.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector&&(yield this.logout()),""):""})}onSessionConnected(e){return bt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session;let r=Qt.getAddressFromSession(e.session);return r?(yield this.loginAccount({address:r,signature:e.signature}),r):""})}handleTopicUpdateEvent({topic:e}){return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"){Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return}try{let r=yield this.getPairings();if(this.address&&!this.isInitializing&&r)if(r?.length===0)this.onClientConnect.onClientLogout();else{let n=r[r.length-1];n?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=yield this.getPairings()}})}handleSessionEvents({topic:e,params:r}){var n;return bt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.session&&((n=this.session)===null||n===void 0?void 0:n.topic)!==e)return;let{event:i}=r;if(i?.name&&Qt.getCurrentTopic(this.chainId,this.walletConnector)===e){let s=i.data;this.onClientConnect.onClientEvent(s)}})}subscribeToEvents(e){var r,n,i,s;return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{var u;if(!this.session||((u=this.session)===null||u===void 0?void 0:u.topic)!==o)return;let{namespaces:c}=a,f=e.session.get(o),h=Object.assign(Object.assign({},f),{namespaces:c});this.onSessionConnected({session:h})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",({topic:o})=>bt(this,void 0,void 0,function*(){var a;this.isInitializing&&(this.onClientConnect.onClientLogout(),this.reset()),!(!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o)&&(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),e.on("session_expire",({topic:o})=>bt(this,void 0,void 0,function*(){var a;!this.session||((a=this.session)===null||a===void 0?void 0:a.topic)!==o||(Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout(),this.reset(),yield this.cleanupPendingPairings({deletePairings:!0}))})),(n=(r=e.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0||n.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(i=e.core)===null||i===void 0?void 0:i.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return bt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(ye.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=yield this.getPairings(),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let r=Qt.getCurrentSession(this.chainId,e);if(r)return yield this.onSessionConnected({session:r}),r}})}cleanupPendingPairings(e={}){var r,n,i,s,o,a,u,c;return bt(this,void 0,void 0,function*(){if(!(typeof this.walletConnector>"u"))try{let f=(i=(n=(r=this.walletConnector.core)===null||r===void 0?void 0:r.pairing)===null||n===void 0?void 0:n.pairings)===null||i===void 0?void 0:i.getAll({active:!1});if(!mI.isValidArray(f))return;for(let h of f)if(e.deletePairings)(o=(s=this.walletConnector.core)===null||s===void 0?void 0:s.expirer)===null||o===void 0||o.set(h.topic,0);else try{yield(c=(u=(a=this.walletConnector.core)===null||a===void 0?void 0:a.relayer)===null||u===void 0?void 0:u.subscriber)===null||c===void 0?void 0:c.unsubscribe(h.topic)}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}}catch{Le.Logger.error(ye.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleCleanup)}})}};wr.WalletConnectV2Provider=wI});var eL=E((T0e,Z8)=>{"use strict";l();Z8.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[r]=i;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==i||o.enumerable!==!0)return!1}return!0}});var nL=E((x0e,rL)=>{"use strict";l();var tL=typeof Symbol<"u"&&Symbol,Uee=eL();rL.exports=function(){return typeof tL!="function"||typeof Symbol!="function"||typeof tL("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Uee()}});var oL=E((O0e,sL)=>{"use strict";l();var iL={foo:{}},qee=Object;sL.exports=function(){return{__proto__:iL}.foo===iL.foo&&!({__proto__:null}instanceof qee)}});var cL=E((P0e,uL)=>{"use strict";l();var Vee="Function.prototype.bind called on incompatible ",Hee=Object.prototype.toString,Gee=Math.max,kee="[object Function]",aL=function(e,r){for(var n=[],i=0;i{"use strict";l();var Wee=cL();lL.exports=Function.prototype.bind||Wee});var hL=E((F0e,fL)=>{"use strict";l();var zee=Function.prototype.call,$ee=Object.prototype.hasOwnProperty,Kee=Kg();fL.exports=Kee.call(zee,$ee)});var ss=E((U0e,mL)=>{"use strict";l();var Pe,au=SyntaxError,yL=Function,ou=TypeError,EI=function(t){try{return yL('"use strict"; return ('+t+").constructor;")()}catch{}},fo=Object.getOwnPropertyDescriptor;if(fo)try{fo({},"")}catch{fo=null}var vI=function(){throw new ou},Yee=fo?function(){try{return arguments.callee,vI}catch{try{return fo(arguments,"callee").get}catch{return vI}}}():vI,iu=nL()(),Jee=oL()(),qt=Object.getPrototypeOf||(Jee?function(t){return t.__proto__}:null),su={},Xee=typeof Uint8Array>"u"||!qt?Pe:qt(Uint8Array),ho={"%AggregateError%":typeof AggregateError>"u"?Pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Pe:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&qt?qt([][Symbol.iterator]()):Pe,"%AsyncFromSyncIteratorPrototype%":Pe,"%AsyncFunction%":su,"%AsyncGenerator%":su,"%AsyncGeneratorFunction%":su,"%AsyncIteratorPrototype%":su,"%Atomics%":typeof Atomics>"u"?Pe:Atomics,"%BigInt%":typeof BigInt>"u"?Pe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Pe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Pe:FinalizationRegistry,"%Function%":yL,"%GeneratorFunction%":su,"%Int8Array%":typeof Int8Array>"u"?Pe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Pe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&qt?qt(qt([][Symbol.iterator]())):Pe,"%JSON%":typeof JSON=="object"?JSON:Pe,"%Map%":typeof Map>"u"?Pe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!iu||!qt?Pe:qt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Pe:Promise,"%Proxy%":typeof Proxy>"u"?Pe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Pe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!iu||!qt?Pe:qt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&qt?qt(""[Symbol.iterator]()):Pe,"%Symbol%":iu?Symbol:Pe,"%SyntaxError%":au,"%ThrowTypeError%":Yee,"%TypedArray%":Xee,"%TypeError%":ou,"%Uint8Array%":typeof Uint8Array>"u"?Pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Pe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Pe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Pe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Pe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Pe:WeakSet};if(qt)try{null.error}catch(t){dL=qt(qt(t)),ho["%Error.prototype%"]=dL}var dL,Zee=function t(e){var r;if(e==="%AsyncFunction%")r=EI("async function () {}");else if(e==="%GeneratorFunction%")r=EI("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=EI("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&qt&&(r=qt(i.prototype))}return ho[e]=r,r},pL={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ml=Kg(),Yg=hL(),ete=Ml.call(Function.call,Array.prototype.concat),tte=Ml.call(Function.apply,Array.prototype.splice),gL=Ml.call(Function.call,String.prototype.replace),Jg=Ml.call(Function.call,String.prototype.slice),rte=Ml.call(Function.call,RegExp.prototype.exec),nte=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ite=/\\(\\)?/g,ste=function(e){var r=Jg(e,0,1),n=Jg(e,-1);if(r==="%"&&n!=="%")throw new au("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new au("invalid intrinsic syntax, expected opening `%`");var i=[];return gL(e,nte,function(s,o,a,u){i[i.length]=a?gL(u,ite,"$1"):o||s}),i},ote=function(e,r){var n=e,i;if(Yg(pL,n)&&(i=pL[n],n="%"+i[0]+"%"),Yg(ho,n)){var s=ho[n];if(s===su&&(s=Zee(n)),typeof s>"u"&&!r)throw new ou("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new au("intrinsic "+e+" does not exist!")};mL.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new ou("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ou('"allowMissing" argument must be a boolean');if(rte(/^%?[^%]*%?$/,e)===null)throw new au("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ste(e),i=n.length>0?n[0]:"",s=ote("%"+i+"%",r),o=s.name,a=s.value,u=!1,c=s.alias;c&&(i=c[0],tte(n,ete([0,1],c)));for(var f=1,h=!0;f=n.length){var T=fo(a,g);h=!!T,h&&"get"in T&&!("originalValue"in T.get)?a=T.get:a=a[g]}else h=Yg(a,g),a=a[g];h&&!u&&(ho[o]=a)}}return a}});var II=E((V0e,wL)=>{"use strict";l();var ate=ss(),AI=ate("%Object.defineProperty%",!0),bI=function(){if(AI)try{return AI({},"a",{value:1}),!0}catch{return!1}return!1};bI.hasArrayLengthDefineBug=function(){if(!bI())return null;try{return AI([],"length",{value:1}).length!==1}catch{return!0}};wL.exports=bI});var _I=E((G0e,EL)=>{"use strict";l();var ute=ss(),Xg=ute("%Object.getOwnPropertyDescriptor%",!0);if(Xg)try{Xg([],"length")}catch{Xg=null}EL.exports=Xg});var bL=E((j0e,AL)=>{"use strict";l();var cte=II()(),SI=ss(),Ul=cte&&SI("%Object.defineProperty%",!0);if(Ul)try{Ul({},"a",{value:1})}catch{Ul=!1}var lte=SI("%SyntaxError%"),uu=SI("%TypeError%"),vL=_I();AL.exports=function(e,r,n){if(!e||typeof e!="object"&&typeof e!="function")throw new uu("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new uu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new uu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new uu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new uu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new uu("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,u=!!vL&&vL(e,r);if(Ul)Ul(e,r,{configurable:o===null&&u?u.configurable:!o,enumerable:i===null&&u?u.enumerable:!i,value:n,writable:s===null&&u?u.writable:!s});else if(a||!i&&!s&&!o)e[r]=n;else throw new lte("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var xL=E((W0e,CL)=>{"use strict";l();var TL=ss(),IL=bL(),fte=II()(),_L=_I(),SL=TL("%TypeError%"),hte=TL("%Math.floor%");CL.exports=function(e,r){if(typeof e!="function")throw new SL("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||hte(r)!==r)throw new SL("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&_L){var o=_L(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(fte?IL(e,"length",r,!0,!0):IL(e,"length",r)),e}});var RL=E(($0e,Zg)=>{"use strict";l();var TI=Kg(),cu=ss(),dte=xL(),pte=cu("%TypeError%"),OL=cu("%Function.prototype.apply%"),DL=cu("%Function.prototype.call%"),PL=cu("%Reflect.apply%",!0)||TI.call(DL,OL),ql=cu("%Object.defineProperty%",!0),gte=cu("%Math.max%");if(ql)try{ql({},"a",{value:1})}catch{ql=null}Zg.exports=function(e){if(typeof e!="function")throw new pte("a function is required");var r=PL(TI,DL,arguments);return dte(r,1+gte(0,e.length-(arguments.length-1)),!0)};var NL=function(){return PL(TI,OL,arguments)};ql?ql(Zg.exports,"apply",{value:NL}):Zg.exports.apply=NL});var ML=E((Y0e,FL)=>{"use strict";l();var BL=ss(),LL=RL(),yte=LL(BL("String.prototype.indexOf"));FL.exports=function(e,r){var n=BL(e,!!r);return typeof n=="function"&&yte(e,".prototype.")>-1?LL(n):n}});var UL=E(()=>{l()});var iF=E((tme,nF)=>{l();var FI=typeof Map=="function"&&Map.prototype,CI=Object.getOwnPropertyDescriptor&&FI?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,ty=FI&&CI&&typeof CI.get=="function"?CI.get:null,qL=FI&&Map.prototype.forEach,MI=typeof Set=="function"&&Set.prototype,xI=Object.getOwnPropertyDescriptor&&MI?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ry=MI&&xI&&typeof xI.get=="function"?xI.get:null,VL=MI&&Set.prototype.forEach,mte=typeof WeakMap=="function"&&WeakMap.prototype,Hl=mte?WeakMap.prototype.has:null,wte=typeof WeakSet=="function"&&WeakSet.prototype,Gl=wte?WeakSet.prototype.has:null,Ete=typeof WeakRef=="function"&&WeakRef.prototype,HL=Ete?WeakRef.prototype.deref:null,vte=Boolean.prototype.valueOf,Ate=Object.prototype.toString,bte=Function.prototype.toString,Ite=String.prototype.match,UI=String.prototype.slice,as=String.prototype.replace,_te=String.prototype.toUpperCase,GL=String.prototype.toLowerCase,JL=RegExp.prototype.test,kL=Array.prototype.concat,Mn=Array.prototype.join,Ste=Array.prototype.slice,jL=Math.floor,DI=typeof BigInt=="function"?BigInt.prototype.valueOf:null,NI=Object.getOwnPropertySymbols,PI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,lu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",tr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===lu||!0)?Symbol.toStringTag:null,XL=Object.prototype.propertyIsEnumerable,QL=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function WL(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||JL.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-jL(-t):jL(t);if(n!==t){var i=String(n),s=UI.call(e,i.length+1);return as.call(i,r,"$&_")+"."+as.call(as.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return as.call(e,r,"$&_")}var RI=UL(),zL=RI.custom,$L=eF(zL)?zL:null;nF.exports=function t(e,r,n,i){var s=r||{};if(os(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(os(s,"maxStringLength")&&(typeof s.maxStringLength=="number"?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=os(s,"customInspect")?s.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(os(s,"indent")&&s.indent!==null&&s.indent!==" "&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(os(s,"numericSeparator")&&typeof s.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=s.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return rF(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?WL(e,u):u}if(typeof e=="bigint"){var c=String(e)+"n";return a?WL(e,c):c}var f=typeof s.depth>"u"?5:s.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return BI(e)?"[Array]":"[Object]";var h=kte(s,n);if(typeof i>"u")i=[];else if(tF(i,e)>=0)return"[Circular]";function g(k,K,ge){if(K&&(i=Ste.call(i),i.push(K)),ge){var ue={depth:s.depth};return os(s,"quoteStyle")&&(ue.quoteStyle=s.quoteStyle),t(k,ue,n+1,i)}return t(k,s,n+1,i)}if(typeof e=="function"&&!KL(e)){var y=Bte(e),m=ey(e,g);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(m.length>0?" { "+Mn.call(m,", ")+" }":"")}if(eF(e)){var T=lu?as.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):PI.call(e);return typeof e=="object"&&!lu?Vl(T):T}if(Vte(e)){for(var O="<"+GL.call(String(e.nodeName)),B=e.attributes||[],W=0;W",O}if(BI(e)){if(e.length===0)return"[]";var U=ey(e,g);return h&&!Gte(U)?"["+LI(U,h)+"]":"[ "+Mn.call(U,", ")+" ]"}if(xte(e)){var A=ey(e,g);return!("cause"in Error.prototype)&&"cause"in e&&!XL.call(e,"cause")?"{ ["+String(e)+"] "+Mn.call(kL.call("[cause]: "+g(e.cause),A),", ")+" }":A.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Mn.call(A,", ")+" }"}if(typeof e=="object"&&o){if($L&&typeof e[$L]=="function"&&RI)return RI(e,{depth:f-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Lte(e)){var _=[];return qL&&qL.call(e,function(k,K){_.push(g(K,e,!0)+" => "+g(k,e))}),YL("Map",ty.call(e),_,h)}if(Ute(e)){var N=[];return VL&&VL.call(e,function(k){N.push(g(k,e))}),YL("Set",ry.call(e),N,h)}if(Fte(e))return OI("WeakMap");if(qte(e))return OI("WeakSet");if(Mte(e))return OI("WeakRef");if(Ote(e))return Vl(g(Number(e)));if(Pte(e))return Vl(g(DI.call(e)));if(Dte(e))return Vl(vte.call(e));if(Nte(e))return Vl(g(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(e===global)return"{ [object globalThis] }";if(!Cte(e)&&!KL(e)){var I=ey(e,g),S=QL?QL(e)===Object.prototype:e instanceof Object||e.constructor===Object,R=e instanceof Object?"":"null prototype",J=!S&&tr&&Object(e)===e&&tr in e?UI.call(us(e),8,-1):R?"Object":"",Q=S||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",V=Q+(J||R?"["+Mn.call(kL.call([],J||[],R||[]),": ")+"] ":"");return I.length===0?V+"{}":h?V+"{"+LI(I,h)+"}":V+"{ "+Mn.call(I,", ")+" }"}return String(e)};function ZL(t,e,r){var n=(r.quoteStyle||e)==="double"?'"':"'";return n+t+n}function Tte(t){return as.call(String(t),/"/g,""")}function BI(t){return us(t)==="[object Array]"&&(!tr||!(typeof t=="object"&&tr in t))}function Cte(t){return us(t)==="[object Date]"&&(!tr||!(typeof t=="object"&&tr in t))}function KL(t){return us(t)==="[object RegExp]"&&(!tr||!(typeof t=="object"&&tr in t))}function xte(t){return us(t)==="[object Error]"&&(!tr||!(typeof t=="object"&&tr in t))}function Nte(t){return us(t)==="[object String]"&&(!tr||!(typeof t=="object"&&tr in t))}function Ote(t){return us(t)==="[object Number]"&&(!tr||!(typeof t=="object"&&tr in t))}function Dte(t){return us(t)==="[object Boolean]"&&(!tr||!(typeof t=="object"&&tr in t))}function eF(t){if(lu)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!PI)return!1;try{return PI.call(t),!0}catch{}return!1}function Pte(t){if(!t||typeof t!="object"||!DI)return!1;try{return DI.call(t),!0}catch{}return!1}var Rte=Object.prototype.hasOwnProperty||function(t){return t in this};function os(t,e){return Rte.call(t,e)}function us(t){return Ate.call(t)}function Bte(t){if(t.name)return t.name;var e=Ite.call(bte.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function tF(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;re.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return rF(UI.call(t,0,e.maxStringLength),e)+n}var i=as.call(as.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Hte);return ZL(i,"single",e)}function Hte(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+_te.call(e.toString(16))}function Vl(t){return"Object("+t+")"}function OI(t){return t+" { ? }"}function YL(t,e,r,n){var i=n?LI(r,n):Mn.call(r,", ");return t+" ("+e+") {"+i+"}"}function Gte(t){for(var e=0;e=0)return!1;return!0}function kte(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=Mn.call(Array(t.indent+1)," ");else return null;return{base:r,prev:Mn.call(Array(e+1),r)}}function LI(t,e){if(t.length===0)return"";var r=` +`+e.prev+e.base;return r+Mn.call(t,","+r)+` +`+e.prev}function ey(t,e){var r=BI(t),n=[];if(r){n.length=t.length;for(var i=0;i{"use strict";l();var qI=ss(),fu=ML(),jte=iF(),Qte=qI("%TypeError%"),ny=qI("%WeakMap%",!0),iy=qI("%Map%",!0),Wte=fu("WeakMap.prototype.get",!0),zte=fu("WeakMap.prototype.set",!0),$te=fu("WeakMap.prototype.has",!0),Kte=fu("Map.prototype.get",!0),Yte=fu("Map.prototype.set",!0),Jte=fu("Map.prototype.has",!0),VI=function(t,e){for(var r=t,n;(n=r.next)!==null;r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},Xte=function(t,e){var r=VI(t,e);return r&&r.value},Zte=function(t,e,r){var n=VI(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},ere=function(t,e){return!!VI(t,e)};sF.exports=function(){var e,r,n,i={assert:function(s){if(!i.has(s))throw new Qte("Side channel does not contain "+jte(s))},get:function(s){if(ny&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Wte(e,s)}else if(iy){if(r)return Kte(r,s)}else if(n)return Xte(n,s)},has:function(s){if(ny&&s&&(typeof s=="object"||typeof s=="function")){if(e)return $te(e,s)}else if(iy){if(r)return Jte(r,s)}else if(n)return ere(n,s);return!1},set:function(s,o){ny&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new ny),zte(e,s,o)):iy?(r||(r=new iy),Yte(r,s,o)):(n||(n={key:{},next:null}),Zte(n,s,o))}};return i}});var sy=E((sme,aF)=>{"use strict";l();var tre=String.prototype.replace,rre=/%20/g,HI={RFC1738:"RFC1738",RFC3986:"RFC3986"};aF.exports={default:HI.RFC3986,formatters:{RFC1738:function(t){return tre.call(t,rre,"+")},RFC3986:function(t){return String(t)}},RFC1738:HI.RFC1738,RFC3986:HI.RFC3986}});var kI=E((ame,cF)=>{"use strict";l();var nre=sy(),GI=Object.prototype.hasOwnProperty,po=Array.isArray,Un=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),ire=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(po(n)){for(var i=[],s=0;s=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||s===nre.RFC1738&&(c===40||c===41)){a+=o.charAt(u);continue}if(c<128){a=a+Un[c];continue}if(c<2048){a=a+(Un[192|c>>6]+Un[128|c&63]);continue}if(c<55296||c>=57344){a=a+(Un[224|c>>12]+Un[128|c>>6&63]+Un[128|c&63]);continue}u+=1,c=65536+((c&1023)<<10|o.charCodeAt(u)&1023),a+=Un[240|c>>18]+Un[128|c>>12&63]+Un[128|c>>6&63]+Un[128|c&63]}return a},cre=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=[],i=0;i{"use strict";l();var hF=oF(),QI=kI(),kl=sy(),pre=Object.prototype.hasOwnProperty,lF={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},go=Array.isArray,gre=String.prototype.split,yre=Array.prototype.push,dF=function(t,e){yre.apply(t,go(e)?e:[e])},mre=Date.prototype.toISOString,fF=kl.default,Wt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:QI.encode,encodeValuesOnly:!1,format:fF,formatter:kl.formatters[fF],indices:!1,serializeDate:function(e){return mre.call(e)},skipNulls:!1,strictNullHandling:!1},wre=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},jI={},Ere=function t(e,r,n,i,s,o,a,u,c,f,h,g,y,m,T){for(var O=e,B=T,W=0,U=!1;(B=B.get(jI))!==void 0&&!U;){var A=B.get(e);if(W+=1,typeof A<"u"){if(A===W)throw new RangeError("Cyclic object value");U=!0}typeof B.get(jI)>"u"&&(W=0)}if(typeof a=="function"?O=a(r,O):O instanceof Date?O=f(O):n==="comma"&&go(O)&&(O=QI.maybeMap(O,function(re){return re instanceof Date?f(re):re})),O===null){if(i)return o&&!y?o(r,Wt.encoder,m,"key",h):r;O=""}if(wre(O)||QI.isBuffer(O)){if(o){var _=y?r:o(r,Wt.encoder,m,"key",h);if(n==="comma"&&y){for(var N=gre.call(String(O),","),I="",S=0;S"u")return R;var J;if(n==="comma"&&go(O))J=[{value:O.length>0?O.join(",")||null:void 0}];else if(go(a))J=a;else{var Q=Object.keys(O);J=u?Q.sort(u):Q}for(var V=0;V"u"?Wt.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Wt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Wt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Wt.encode,encoder:typeof e.encoder=="function"?e.encoder:Wt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Wt.encodeValuesOnly,filter:s,format:n,formatter:i,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Wt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Wt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Wt.strictNullHandling}};pF.exports=function(t,e){var r=t,n=vre(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):go(n.filter)&&(s=n.filter,i=s);var o=[];if(typeof r!="object"||r===null)return"";var a;e&&e.arrayFormat in lF?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=lF[a];i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);for(var c=hF(),f=0;f0?y+g:""}});var wF=E((fme,mF)=>{"use strict";l();var hu=kI(),WI=Object.prototype.hasOwnProperty,Are=Array.isArray,Vt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:hu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},bre=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},yF=function(t,e){return t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Ire="utf8=%26%2310003%3B",_re="utf8=%E2%9C%93",Sre=function(e,r){var n={},i=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=r.parameterLimit===1/0?void 0:r.parameterLimit,o=i.split(r.delimiter,s),a=-1,u,c=r.charset;if(r.charsetSentinel)for(u=0;u-1&&(m=Are(m)?[m]:m),WI.call(n,y)?n[y]=hu.combine(n[y],m):n[y]=m}return n},Tre=function(t,e,r,n){for(var i=n?e:yF(e,r),s=t.length-1;s>=0;--s){var o,a=t[s];if(a==="[]"&&r.parseArrays)o=[].concat(i);else{o=r.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,c=parseInt(u,10);!r.parseArrays&&u===""?o={0:i}:!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&r.parseArrays&&c<=r.arrayLimit?(o=[],o[c]=i):u!=="__proto__"&&(o[u]=i)}i=o}return i},Cre=function(e,r,n,i){if(e){var s=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=n.depth>0&&o.exec(s),c=u?s.slice(0,u.index):s,f=[];if(c){if(!n.plainObjects&&WI.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var h=0;n.depth>0&&(u=a.exec(s))!==null&&h"u"?Vt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Vt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Vt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Vt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Vt.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Vt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Vt.comma,decoder:typeof e.decoder=="function"?e.decoder:Vt.decoder,delimiter:typeof e.delimiter=="string"||hu.isRegExp(e.delimiter)?e.delimiter:Vt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Vt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Vt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Vt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Vt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Vt.strictNullHandling}};mF.exports=function(t,e){var r=xre(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?Object.create(null):{};for(var n=typeof t=="string"?Sre(t,r):t,i=r.plainObjects?Object.create(null):{},s=Object.keys(n),o=0;o{"use strict";l();var Nre=gF(),Ore=wF(),Dre=sy();EF.exports={formats:Dre,parse:Ore,stringify:Nre}});var zI=E(ut=>{"use strict";l();Object.defineProperty(ut,"__esModule",{value:!0});ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ut.WALLET_PROVIDER_CALLBACK_PARAM=ut.WALLET_PROVIDER_SIGN_MESSAGE_URL=ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL=ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ut.WALLET_PROVIDER_SEND_TRANSACTION_URL=ut.WALLET_PROVIDER_DISCONNECT_URL=ut.WALLET_PROVIDER_CONNECT_URL=ut.WALLET_PROVIDER_TESTNET=ut.WALLET_PROVIDER_DEVNET=ut.WALLET_PROVIDER_MAINNET=void 0;ut.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ut.WALLET_PROVIDER_CONNECT_URL="hook/login";ut.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ut.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ut.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ut.WALLET_PROVIDER_GUARD_TRANSACTION_URL="hook/2fa";ut.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ut.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ut.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var AF=E(du=>{"use strict";l();Object.defineProperty(du,"__esModule",{value:!0});du.ErrCannotSignedMessage=du.ErrCannotGetSignedTransactions=void 0;var $I=class extends Error{constructor(){super("Cannot get signed transaction(s)")}};du.ErrCannotGetSignedTransactions=$I;var KI=class extends Error{constructor(){super("Cannot get signed message")}};du.ErrCannotSignedMessage=KI});var bF=E(oy=>{"use strict";l();Object.defineProperty(oy,"__esModule",{value:!0});oy.PlainSignedTransaction=void 0;var YI=class{constructor(e){this.nonce=0,this.value="",this.receiver="",this.sender="",this.gasPrice=0,this.gasLimit=0,this.data="",this.chainID="",this.version=0,this.signature="",Object.assign(this,e)}};oy.PlainSignedTransaction=YI});var jl=E(fs=>{"use strict";l();var cs=fs&&fs.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})},Pre=fs&&fs.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(fs,"__esModule",{value:!0});fs.WalletProvider=void 0;var JI=Pre(vF()),ls=zI(),XI=AF(),Rre=bF(),ZI=class t{constructor(e){this.walletUrl=e}login(e){return cs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ls.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(r,e?.redirectDelayMilliseconds),r})}redirect(e,r){return cs(this,void 0,void 0,function*(){r?yield this.redirectLater(e,r):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,r){return cs(this,void 0,void 0,function*(){yield new Promise(n=>{setTimeout(()=>{window.location.href=e,n(!0)},r)})})}logout(e){return cs(this,void 0,void 0,function*(){let r=this.buildWalletUrl({endpoint:ls.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(r,e?.redirectDelayMilliseconds),!0})}signMessage(e,r){return cs(this,void 0,void 0,function*(){let n=this.buildWalletUrl({endpoint:ls.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:r?.callbackUrl,params:{message:e.message.toString()}});return yield this.redirect(n),n})}getMessageSignatureFromWalletUrl(){var e,r;let n=window.location.search.slice(1);console.info("getMessageSignatureFromWalletUrl(), url:",n);let i=JI.default.parse(n);if((((e=i.status)===null||e===void 0?void 0:e.toString())||"")!=="signed")throw new XI.ErrCannotSignedMessage;return((r=i.signature)===null||r===void 0?void 0:r.toString())||""}guardTransactions(e,r){return cs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ls.WALLET_PROVIDER_GUARD_TRANSACTION_URL,e,r)})}signTransactions(e,r){return cs(this,void 0,void 0,function*(){this.redirectTransactionsToEndpoint(ls.WALLET_PROVIDER_SIGN_TRANSACTION_URL,e,r)})}signTransaction(e,r){return cs(this,void 0,void 0,function*(){yield this.signTransactions([e],r)})}getTransactionsFromWalletUrl(){let e=JI.default.parse(window.location.search.slice(1));return t.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(ls.WALLET_PROVIDER_CALLBACK_PARAM)&&e[ls.WALLET_PROVIDER_CALLBACK_PARAM]===ls.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var r;console.info("getTxSignReturnValue(), urlParams:",e);let n=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of n)if(!e[o]||!Array.isArray(e[o]))throw new XI.ErrCannotGetSignedTransactions;let i=e.nonce.length;for(let o of n)if(e[o].length!==i)throw new XI.ErrCannotGetSignedTransactions;let s=[];for(let o=0;o{let a=t.prepareWalletTransaction(o);for(let u in a)a.hasOwnProperty(u)&&!i.hasOwnProperty(u)&&(i[u]=[]),i[u].push(a[u])});let s=this.buildWalletUrl({endpoint:e,callbackUrl:n?.callbackUrl,params:i});window.location.href=s}};fs.WalletProvider=ZI});var e_=E((Ime,IF)=>{"use strict";l();IF.exports=function(e,r){return function(){for(var i=new Array(arguments.length),s=0;s{"use strict";l();var Bre=e_(),yo=Object.prototype.toString;function n_(t){return yo.call(t)==="[object Array]"}function t_(t){return typeof t>"u"}function Lre(t){return t!==null&&!t_(t)&&t.constructor!==null&&!t_(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Fre(t){return yo.call(t)==="[object ArrayBuffer]"}function Mre(t){return typeof FormData<"u"&&t instanceof FormData}function Ure(t){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function qre(t){return typeof t=="string"}function Vre(t){return typeof t=="number"}function _F(t){return t!==null&&typeof t=="object"}function ay(t){if(yo.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Hre(t){return yo.call(t)==="[object Date]"}function Gre(t){return yo.call(t)==="[object File]"}function kre(t){return yo.call(t)==="[object Blob]"}function SF(t){return yo.call(t)==="[object Function]"}function jre(t){return _F(t)&&SF(t.pipe)}function Qre(t){return typeof URLSearchParams<"u"&&t instanceof URLSearchParams}function Wre(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function zre(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function i_(t,e){if(!(t===null||typeof t>"u"))if(typeof t!="object"&&(t=[t]),n_(t))for(var r=0,n=t.length;r{"use strict";l();var pu=Er();function CF(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}xF.exports=function(e,r,n){if(!r)return e;var i;if(n)i=n(r);else if(pu.isURLSearchParams(r))i=r.toString();else{var s=[];pu.forEach(r,function(u,c){u===null||typeof u>"u"||(pu.isArray(u)?c=c+"[]":u=[u],pu.forEach(u,function(h){pu.isDate(h)?h=h.toISOString():pu.isObject(h)&&(h=JSON.stringify(h)),s.push(CF(c)+"="+CF(h))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}});var OF=E((Nme,NF)=>{"use strict";l();var Yre=Er();function uy(){this.handlers=[]}uy.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};uy.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)};uy.prototype.forEach=function(e){Yre.forEach(this.handlers,function(n){n!==null&&e(n)})};NF.exports=uy});var PF=E((Dme,DF)=>{"use strict";l();var Jre=Er();DF.exports=function(e,r){Jre.forEach(e,function(i,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=i,delete e[s])})}});var o_=E((Rme,RF)=>{"use strict";l();RF.exports=function(e,r,n,i,s){return e.config=r,n&&(e.code=n),e.request=i,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}});var a_=E((Lme,BF)=>{"use strict";l();var Xre=o_();BF.exports=function(e,r,n,i,s){var o=new Error(e);return Xre(o,r,n,i,s)}});var FF=E((Mme,LF)=>{"use strict";l();var Zre=a_();LF.exports=function(e,r,n){var i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):r(Zre("Request failed with status code "+n.status,n.config,null,n.request,n))}});var UF=E((qme,MF)=>{"use strict";l();var cy=Er();MF.exports=cy.isStandardBrowserEnv()?function(){return{write:function(r,n,i,s,o,a){var u=[];u.push(r+"="+encodeURIComponent(n)),cy.isNumber(i)&&u.push("expires="+new Date(i).toGMTString()),cy.isString(s)&&u.push("path="+s),cy.isString(o)&&u.push("domain="+o),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var VF=E((Hme,qF)=>{"use strict";l();qF.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}});var GF=E((kme,HF)=>{"use strict";l();HF.exports=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e}});var jF=E((Qme,kF)=>{"use strict";l();var ene=VF(),tne=GF();kF.exports=function(e,r){return e&&!ene(r)?tne(e,r):r}});var WF=E((zme,QF)=>{"use strict";l();var u_=Er(),rne=["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"];QF.exports=function(e){var r={},n,i,s;return e&&u_.forEach(e.split(` +`),function(a){if(s=a.indexOf(":"),n=u_.trim(a.substr(0,s)).toLowerCase(),i=u_.trim(a.substr(s+1)),n){if(r[n]&&rne.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([i]):r[n]=r[n]?r[n]+", "+i:i}}),r}});var KF=E((Kme,$F)=>{"use strict";l();var zF=Er();$F.exports=zF.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function i(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{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 n=i(window.location.href),function(o){var a=zF.isString(o)?i(o):o;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}()});var Ql=E((Jme,YF)=>{"use strict";l();function c_(t){this.message=t}c_.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")};c_.prototype.__CANCEL__=!0;YF.exports=c_});var f_=E((Zme,JF)=>{"use strict";l();var ly=Er(),nne=FF(),ine=UF(),sne=s_(),one=jF(),ane=WF(),une=KF(),l_=a_(),cne=Wl(),lne=Ql();JF.exports=function(e){return new Promise(function(n,i){var s=e.data,o=e.headers,a=e.responseType,u;function c(){e.cancelToken&&e.cancelToken.unsubscribe(u),e.signal&&e.signal.removeEventListener("abort",u)}ly.isFormData(s)&&delete o["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var h=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(h+":"+g)}var y=one(e.baseURL,e.url);f.open(e.method.toUpperCase(),sne(y,e.params,e.paramsSerializer),!0),f.timeout=e.timeout;function m(){if(f){var O="getAllResponseHeaders"in f?ane(f.getAllResponseHeaders()):null,B=!a||a==="text"||a==="json"?f.responseText:f.response,W={data:B,status:f.status,statusText:f.statusText,headers:O,config:e,request:f};nne(function(A){n(A),c()},function(A){i(A),c()},W),f=null}}if("onloadend"in f?f.onloadend=m:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(m)},f.onabort=function(){f&&(i(l_("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){i(l_("Network Error",e,null,f)),f=null},f.ontimeout=function(){var B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",W=e.transitional||cne.transitional;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),i(l_(B,e,W.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",f)),f=null},ly.isStandardBrowserEnv()){var T=(e.withCredentials||une(y))&&e.xsrfCookieName?ine.read(e.xsrfCookieName):void 0;T&&(o[e.xsrfHeaderName]=T)}"setRequestHeader"in f&&ly.forEach(o,function(B,W){typeof s>"u"&&W.toLowerCase()==="content-type"?delete o[W]:f.setRequestHeader(W,B)}),ly.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),a&&a!=="json"&&(f.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&f.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(u=function(O){f&&(i(!O||O&&O.type?new lne("canceled"):O),f.abort(),f=null)},e.cancelToken&&e.cancelToken.subscribe(u),e.signal&&(e.signal.aborted?u():e.signal.addEventListener("abort",u))),s||(s=null),f.send(s)})}});var Wl=E((twe,eM)=>{"use strict";l();var zt=Er(),XF=PF(),fne=o_(),hne={"Content-Type":"application/x-www-form-urlencoded"};function ZF(t,e){!zt.isUndefined(t)&&zt.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function dne(){var t;return typeof XMLHttpRequest<"u"?t=f_():typeof p.default<"u"&&Object.prototype.toString.call(p.default)==="[object process]"&&(t=f_()),t}function pne(t,e,r){if(zt.isString(t))try{return(e||JSON.parse)(t),zt.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var fy={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:dne(),transformRequest:[function(e,r){return XF(r,"Accept"),XF(r,"Content-Type"),zt.isFormData(e)||zt.isArrayBuffer(e)||zt.isBuffer(e)||zt.isStream(e)||zt.isFile(e)||zt.isBlob(e)?e:zt.isArrayBufferView(e)?e.buffer:zt.isURLSearchParams(e)?(ZF(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):zt.isObject(e)||r&&r["Content-Type"]==="application/json"?(ZF(r,"application/json"),pne(e)):e}],transformResponse:[function(e){var r=this.transitional||fy.transitional,n=r&&r.silentJSONParsing,i=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||i&&zt.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?fne(o,this,"E_JSON_PARSE"):o}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, */*"}}};zt.forEach(["delete","get","head"],function(e){fy.headers[e]={}});zt.forEach(["post","put","patch"],function(e){fy.headers[e]=zt.merge(hne)});eM.exports=fy});var rM=E((nwe,tM)=>{"use strict";l();var gne=Er(),yne=Wl();tM.exports=function(e,r,n){var i=this||yne;return gne.forEach(n,function(o){e=o.call(i,e,r)}),e}});var h_=E((swe,nM)=>{"use strict";l();nM.exports=function(e){return!!(e&&e.__CANCEL__)}});var oM=E((awe,sM)=>{"use strict";l();var iM=Er(),d_=rM(),mne=h_(),wne=Wl(),Ene=Ql();function p_(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ene("canceled")}sM.exports=function(e){p_(e),e.headers=e.headers||{},e.data=d_.call(e,e.data,e.headers,e.transformRequest),e.headers=iM.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),iM.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var r=e.adapter||wne.adapter;return r(e).then(function(i){return p_(e),i.data=d_.call(e,i.data,i.headers,e.transformResponse),i},function(i){return mne(i)||(p_(e),i&&i.response&&(i.response.data=d_.call(e,i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})}});var g_=E((cwe,aM)=>{"use strict";l();var _r=Er();aM.exports=function(e,r){r=r||{};var n={};function i(f,h){return _r.isPlainObject(f)&&_r.isPlainObject(h)?_r.merge(f,h):_r.isPlainObject(h)?_r.merge({},h):_r.isArray(h)?h.slice():h}function s(f){if(_r.isUndefined(r[f])){if(!_r.isUndefined(e[f]))return i(void 0,e[f])}else return i(e[f],r[f])}function o(f){if(!_r.isUndefined(r[f]))return i(void 0,r[f])}function a(f){if(_r.isUndefined(r[f])){if(!_r.isUndefined(e[f]))return i(void 0,e[f])}else return i(void 0,r[f])}function u(f){if(f in r)return i(e[f],r[f]);if(f in e)return i(void 0,e[f])}var c={url:o,method:o,data:o,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:u};return _r.forEach(Object.keys(e).concat(Object.keys(r)),function(h){var g=c[h]||s,y=g(h);_r.isUndefined(y)&&g!==u||(n[h]=y)}),n}});var y_=E((fwe,uM)=>{l();uM.exports={version:"0.24.0"}});var fM=E((dwe,lM)=>{"use strict";l();var vne=y_().version,m_={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){m_[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var cM={};m_.transitional=function(e,r,n){function i(s,o){return"[Axios v"+vne+"] Transitional option '"+s+"'"+o+(n?". "+n:"")}return function(s,o,a){if(e===!1)throw new Error(i(o," has been removed"+(r?" in "+r:"")));return r&&!cM[o]&&(cM[o]=!0,console.warn(i(o," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(s,o,a):!0}};function Ane(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),i=n.length;i-- >0;){var s=n[i],o=e[s];if(o){var a=t[s],u=a===void 0||o(a,s,t);if(u!==!0)throw new TypeError("option "+s+" must be "+u);continue}if(r!==!0)throw Error("Unknown option "+s)}}lM.exports={assertOptions:Ane,validators:m_}});var mM=E((gwe,yM)=>{"use strict";l();var pM=Er(),bne=s_(),hM=OF(),dM=oM(),hy=g_(),gM=fM(),gu=gM.validators;function zl(t){this.defaults=t,this.interceptors={request:new hM,response:new hM}}zl.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=hy(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&gM.assertOptions(r,{silentJSONParsing:gu.transitional(gu.boolean),forcedJSONParsing:gu.transitional(gu.boolean),clarifyTimeoutError:gu.transitional(gu.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(e)===!1||(i=i&&g.synchronous,n.unshift(g.fulfilled,g.rejected))});var s=[];this.interceptors.response.forEach(function(g){s.push(g.fulfilled,g.rejected)});var o;if(!i){var a=[dM,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(s),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var u=e;n.length;){var c=n.shift(),f=n.shift();try{u=c(u)}catch(h){f(h);break}}try{o=dM(u)}catch(h){return Promise.reject(h)}for(;s.length;)o=o.then(s.shift(),s.shift());return o};zl.prototype.getUri=function(e){return e=hy(this.defaults,e),bne(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")};pM.forEach(["delete","get","head","options"],function(e){zl.prototype[e]=function(r,n){return this.request(hy(n||{},{method:e,url:r,data:(n||{}).data}))}});pM.forEach(["post","put","patch"],function(e){zl.prototype[e]=function(r,n,i){return this.request(hy(i||{},{method:e,url:r,data:n}))}});yM.exports=zl});var EM=E((mwe,wM)=>{"use strict";l();var Ine=Ql();function yu(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(i){e=i});var r=this;this.promise.then(function(n){if(r._listeners){var i,s=r._listeners.length;for(i=0;i{"use strict";l();vM.exports=function(e){return function(n){return e.apply(null,n)}}});var IM=E((Awe,bM)=>{"use strict";l();bM.exports=function(e){return typeof e=="object"&&e.isAxiosError===!0}});var TM=E((Iwe,w_)=>{"use strict";l();var _M=Er(),_ne=e_(),dy=mM(),Sne=g_(),Tne=Wl();function SM(t){var e=new dy(t),r=_ne(dy.prototype.request,e);return _M.extend(r,dy.prototype,e),_M.extend(r,e),r.create=function(i){return SM(Sne(t,i))},r}var qn=SM(Tne);qn.Axios=dy;qn.Cancel=Ql();qn.CancelToken=EM();qn.isCancel=h_();qn.VERSION=y_().version;qn.all=function(e){return Promise.all(e)};qn.spread=AM();qn.isAxiosError=IM();w_.exports=qn;w_.exports.default=qn});var xM=E((Swe,CM)=>{l();CM.exports=TM()});var NM=E(py=>{"use strict";l();Object.defineProperty(py,"__esModule",{value:!0});py.NativeAuthClientConfig=void 0;var E_=class{constructor(){this.origin=typeof window<"u"&&typeof window.location<"u"?window.location.hostname:"",this.apiUrl="https://api.multiversx.com",this.expirySeconds=60*60*24}};py.NativeAuthClientConfig=E_});var A_=E(mu=>{"use strict";l();var mo=mu&&mu.__awaiter||function(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(f){try{c(n.next(f))}catch(h){o(h)}}function u(f){try{c(n.throw(f))}catch(h){o(h)}}function c(f){f.done?s(f.value):i(f.value).then(a,u)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(mu,"__esModule",{value:!0});mu.NativeAuthClient=void 0;var Cne=xM(),xne=NM(),v_=class{constructor(e){this.config=Object.assign(new xne.NativeAuthClientConfig,e)}getToken(e,r,n){let i=this.encodeValue(e),s=this.encodeValue(r);return`${i}.${s}.${n}`}initialize(e={}){return mo(this,void 0,void 0,function*(){let r=yield this.getCurrentBlockHash(),n=this.encodeValue(JSON.stringify(e));return`${this.encodeValue(this.config.origin)}.${r}.${this.config.expirySeconds}.${n}`})}getCurrentBlockHash(){return mo(this,void 0,void 0,function*(){return this.config.gatewayUrl?yield this.getCurrentBlockHashWithGateway():yield this.getCurrentBlockHashWithApi()})}getCurrentBlockHashWithGateway(){return mo(this,void 0,void 0,function*(){let e=yield this.getCurrentRound(),r=`${this.config.gatewayUrl}/blocks/by-round/${e}`;return(yield this.get(r)).data.data.blocks.filter(o=>o.shard===this.config.blockHashShard)[0].hash})}getCurrentRound(){return mo(this,void 0,void 0,function*(){if(!this.config.gatewayUrl)throw new Error("Gateway URL not set");if(!this.config.blockHashShard)throw new Error("Blockhash shard not set");let e=`${this.config.gatewayUrl}/network/status/${this.config.blockHashShard}`;return(yield this.get(e)).data.data.status.erd_current_round})}getCurrentBlockHashWithApi(){return mo(this,void 0,void 0,function*(){try{let e=`${this.config.apiUrl}/blocks/latest?ttl=${this.config.expirySeconds}&fields=hash`,r=yield this.get(e);if(r.data[0].hash!==void 0)return r.data[0].hash}catch{}return this.getCurrentBlockHashWithApiFallback()})}getCurrentBlockHashWithApiFallback(){return mo(this,void 0,void 0,function*(){let e=`${this.config.apiUrl}/blocks?size=1&fields=hash`;return this.config.blockHashShard!==void 0&&(e+=`&shard=${this.config.blockHashShard}`),(yield this.get(e)).data[0].hash})}encodeValue(e){return this.escape(d.Buffer.from(e,"utf8").toString("base64"))}escape(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}get(e){return mo(this,void 0,void 0,function*(){return yield Cne.default.get(e,{headers:this.config.extraRequestHeaders})})}};mu.NativeAuthClient=v_});var BM=E(wy=>{"use strict";l();Object.defineProperty(wy,"__esModule",{value:!0});wy.TransactionStatus=void 0;var b_=class t{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new t("unknown")}isPending(){return this.status=="received"||this.status=="pending"}isExecuted(){return this.isSuccessful()||this.isFailed()||this.isInvalid()}isSuccessful(){return this.status=="executed"||this.status=="success"||this.status=="successful"}isFailed(){return this.status=="fail"||this.status=="failed"||this.status=="unsuccessful"||this.isInvalid()}isInvalid(){return this.status=="invalid"}toString(){return this.status}valueOf(){return this.status}equals(e){return e?this.status==e.status:!1}};wy.TransactionStatus=b_});var vu=E(Ht=>{"use strict";l();var Nne=Ht&&Ht.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),One=Ht&&Ht.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Dne=Ht&&Ht.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Nne(e,t,r);return One(e,t),e};Object.defineProperty(Ht,"__esModule",{value:!0});Ht.zeroPadStringIfOddLength=Ht.isPaddedHex=Ht.numberToPaddedHex=Ht.Nonce=Ht.Address=void 0;var LM=Dne(qm()),Pne="erd",I_=class t{constructor(e){this.value=e}static fromPubkey(e){let r=LM.toWords(e),n=LM.encode(Pne,r);return new t(n)}bech32(){return this.value}toString(){return this.bech32()}};Ht.Address=I_;var __=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return FM(this.value)}};Ht.Nonce=__;function FM(t){let e=t.toString(16);return MM(e)}Ht.numberToPaddedHex=FM;function Rne(t){t=t||"";let e=d.Buffer.from(t,"hex").toString("hex");return t.toUpperCase()==e.toUpperCase()}Ht.isPaddedHex=Rne;function MM(t){return t=t||"",t.length%2==1?"0"+t:t}Ht.zeroPadStringIfOddLength=MM});var qM=E(Ey=>{"use strict";l();Object.defineProperty(Ey,"__esModule",{value:!0});Ey.TransactionReceipt=void 0;var UM=vu(),S_=class t{constructor(){this.value="",this.sender=new UM.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let r=new t;return r.value=(e.value||0).toString(),r.sender=new UM.Address(e.sender),r.data=e.data,r.hash=e.txHash,r}};Ey.TransactionReceipt=S_});var VM=E(Vn=>{"use strict";l();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.ErrContractQuery=Vn.ErrNetworkProvider=Vn.ErrUnexpectedCondition=Vn.Err=void 0;var Au=class extends Error{constructor(e,r){super(e),this.inner=void 0,this.inner=r}};Vn.Err=Au;var T_=class extends Au{constructor(e){super(`Unexpected condition: [${e}]`)}};Vn.ErrUnexpectedCondition=T_;var C_=class extends Au{constructor(e,r,n){let i=`Request error on url [${e}]: [${r}]`;super(i,n)}};Vn.ErrNetworkProvider=C_;var x_=class extends Au{constructor(e){super(e.message.replace("executeQuery:",""))}};Vn.ErrContractQuery=x_});var GM=E(ds=>{"use strict";l();Object.defineProperty(ds,"__esModule",{value:!0});ds.TransactionEventTopic=ds.TransactionEventData=ds.TransactionEvent=void 0;var HM=vu(),N_=class t{constructor(e){this.address=new HM.Address(""),this.identifier="",this.topics=[],this.data="",this.dataPayload=new bu(d.Buffer.from("","utf8")),this.additionalData=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new HM.Address(e.address),r.identifier=e.identifier||"",r.topics=(e.topics||[]).map(n=>new vy(n)),r.dataPayload=bu.fromBase64(e.data),r.additionalData=(e.additionalData||[]).map(bu.fromBase64),r.data=r.dataPayload.toString(),r}findFirstOrNoneTopic(e){return this.topics.filter(r=>e(r))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};ds.TransactionEvent=N_;var bu=class t{constructor(e){this.raw=e}static fromBase64(e){return new t(d.Buffer.from(e||"","base64"))}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ds.TransactionEventData=bu;var vy=class{constructor(e){this.raw=d.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};ds.TransactionEventTopic=vy});var D_=E(Ay=>{"use strict";l();Object.defineProperty(Ay,"__esModule",{value:!0});Ay.TransactionLogs=void 0;var Bne=VM(),kM=vu(),Lne=GM(),O_=class t{constructor(e){this.address=new kM.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let r=new t;return r.address=new kM.Address(e.address),r.events=(e.events||[]).map(n=>Lne.TransactionEvent.fromHttpResponse(n)),r}findSingleOrNoneEvent(e,r){let n=this.findEvents(e,r);if(n.length>1)throw new Bne.ErrUnexpectedCondition(`more than one event of type ${e}`);return n[0]}findFirstOrNoneEvent(e,r){return this.findEvents(e,r)[0]}findEvents(e,r){let n=this.events.filter(i=>i.identifier==e);return r&&(n=n.filter(i=>r(i))),n}};Ay.TransactionLogs=O_});var QM=E(Iu=>{"use strict";l();Object.defineProperty(Iu,"__esModule",{value:!0});Iu.ContractResultItem=Iu.ContractResults=void 0;var jM=D_(),by=vu(),P_=class t{constructor(e){this.items=e,this.items.sort(function(r,n){return r.nonce.valueOf()-n.nonce.valueOf()})}static fromProxyHttpResponse(e){let r=e.map(n=>$l.fromProxyHttpResponse(n));return new t(r)}static fromApiHttpResponse(e){let r=e.map(n=>$l.fromApiHttpResponse(n));return new t(r)}};Iu.ContractResults=P_;var $l=class t{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new by.Address(""),this.sender=new by.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new jM.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return t.fromHttpResponse(e)}static fromApiHttpResponse(e){let r=t.fromHttpResponse(e);return r.data=d.Buffer.from(r.data,"base64").toString(),r.callType=Number(r.callType),r}static fromHttpResponse(e){let r=new t;return r.hash=e.hash,r.nonce=Number(e.nonce||0),r.value=(e.value||0).toString(),r.receiver=new by.Address(e.receiver),r.sender=new by.Address(e.sender),r.previousHash=e.prevTxHash,r.originalHash=e.originalTxHash,r.gasLimit=Number(e.gasLimit||0),r.gasPrice=Number(e.gasPrice||0),r.data=e.data||"",r.callType=e.callType,r.returnMessage=e.returnMessage,r.logs=jM.TransactionLogs.fromHttpResponse(e.logs||{}),r}};Iu.ContractResultItem=$l});var WM=E(ps=>{"use strict";l();var Fne=ps&&ps.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ps,"__esModule",{value:!0});ps.EsdtContractAddress=ps.MaxUint64AsBigNumber=void 0;var Mne=Fne(kt()),Une=vu();ps.MaxUint64AsBigNumber=new Mne.default("18446744073709551615");ps.EsdtContractAddress=new Une.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var zM=E(_u=>{"use strict";l();var qne=_u&&_u.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_u,"__esModule",{value:!0});_u.ContractQueryResponse=void 0;var Vne=qne(kt()),Hne=WM(),R_=class t{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let r=e.returnData||e.ReturnData,n=e.returnCode||e.ReturnCode,i=e.returnMessage||e.ReturnMessage,s=new Vne.default(e.gasRemaining||e.GasRemaining||0),o=Hne.MaxUint64AsBigNumber.minus(s).toNumber();return new t({returnData:r,returnCode:n,returnMessage:i,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>d.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};_u.ContractQueryResponse=R_});var $M=E(Iy=>{"use strict";l();Object.defineProperty(Iy,"__esModule",{value:!0});Iy.ContractQueryRequest=void 0;var B_=class{constructor(e){this.query=e}toHttpRequest(){var e;let r={},n=this.query;return r.scAddress=n.address.bech32(),r.caller=!((e=n.caller)===null||e===void 0)&&e.bech32()?n.caller.bech32():void 0,r.funcName=n.func.toString(),r.value=n.value?n.value.toString():void 0,r.args=n.getEncodedArguments(),r}};Iy.ContractQueryRequest=B_});var sU=E((LEe,iU)=>{l();iU.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var gs=E(wo=>{l();var L_,Gne=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];wo.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};wo.getSymbolTotalCodewords=function(e){return Gne[e]};wo.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};wo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');L_=e};wo.isKanjiModeEnabled=function(){return typeof L_<"u"};wo.toSJIS=function(e){return L_(e)}});var Ty=E(Qr=>{l();Qr.L={bit:1};Qr.M={bit:0};Qr.Q={bit:3};Qr.H={bit:2};function kne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return Qr.L;case"m":case"medium":return Qr.M;case"q":case"quartile":return Qr.Q;case"h":case"high":return Qr.H;default:throw new Error("Unknown EC Level: "+t)}}Qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Qr.from=function(e,r){if(Qr.isValid(e))return e;try{return kne(e)}catch{return r}}});var uU=E((HEe,aU)=>{l();function oU(){this.buffer=[],this.length=0}oU.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let r=0;r>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};aU.exports=oU});var lU=E((kEe,cU)=>{l();function Kl(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}Kl.prototype.set=function(t,e,r,n){let i=t*this.size+e;this.data[i]=r,n&&(this.reservedBit[i]=!0)};Kl.prototype.get=function(t,e){return this.data[t*this.size+e]};Kl.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Kl.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};cU.exports=Kl});var fU=E(Cy=>{l();var jne=gs().getSymbolSize;Cy.getRowColCoords=function(e){if(e===1)return[];let r=Math.floor(e/7)+2,n=jne(e),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,s=[n-7];for(let o=1;o{l();var Qne=gs().getSymbolSize,hU=7;dU.getPositions=function(e){let r=Qne(e);return[[0,0],[r-hU,0],[0,r-hU]]}});var gU=E(et=>{l();et.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Eo={N1:3,N2:3,N3:40,N4:10};et.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};et.from=function(e){return et.isValid(e)?parseInt(e,10):void 0};et.getPenaltyN1=function(e){let r=e.size,n=0,i=0,s=0,o=null,a=null;for(let u=0;u=5&&(n+=Eo.N1+(i-5)),o=f,i=1),f=e.get(c,u),f===a?s++:(s>=5&&(n+=Eo.N1+(s-5)),a=f,s=1)}i>=5&&(n+=Eo.N1+(i-5)),s>=5&&(n+=Eo.N1+(s-5))}return n};et.getPenaltyN2=function(e){let r=e.size,n=0;for(let i=0;i=10&&(i===1488||i===93)&&n++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&n++}return n*Eo.N3};et.getPenaltyN4=function(e){let r=0,n=e.data.length;for(let s=0;s{l();var ys=Ty(),xy=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Ny=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];F_.getBlocksCount=function(e,r){switch(r){case ys.L:return xy[(e-1)*4+0];case ys.M:return xy[(e-1)*4+1];case ys.Q:return xy[(e-1)*4+2];case ys.H:return xy[(e-1)*4+3];default:return}};F_.getTotalCodewordsCount=function(e,r){switch(r){case ys.L:return Ny[(e-1)*4+0];case ys.M:return Ny[(e-1)*4+1];case ys.Q:return Ny[(e-1)*4+2];case ys.H:return Ny[(e-1)*4+3];default:return}}});var yU=E(Dy=>{l();var Yl=new Uint8Array(512),Oy=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)Yl[r]=e,Oy[e]=r,e<<=1,e&256&&(e^=285);for(let r=255;r<512;r++)Yl[r]=Yl[r-255]})();Dy.log=function(e){if(e<1)throw new Error("log("+e+")");return Oy[e]};Dy.exp=function(e){return Yl[e]};Dy.mul=function(e,r){return e===0||r===0?0:Yl[Oy[e]+Oy[r]]}});var mU=E(Jl=>{l();var U_=yU();Jl.mul=function(e,r){let n=new Uint8Array(e.length+r.length-1);for(let i=0;i=0;){let i=n[0];for(let o=0;o{l();var wU=mU();function q_(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}q_.prototype.initialize=function(e){this.degree=e,this.genPoly=wU.generateECPolynomial(this.degree)};q_.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(e.length+this.degree);r.set(e);let n=wU.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let s=new Uint8Array(this.degree);return s.set(n,i),s}return n};EU.exports=q_});var V_=E(AU=>{l();AU.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var H_=E(pi=>{l();var bU="[0-9]+",zne="[A-Z $%*+\\-./:]+",Xl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Xl=Xl.replace(/u/g,"\\u");var $ne="(?:(?![A-Z0-9 $%*+\\-./:]|"+Xl+`)(?:.|[\r +]))+`;pi.KANJI=new RegExp(Xl,"g");pi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");pi.BYTE=new RegExp($ne,"g");pi.NUMERIC=new RegExp(bU,"g");pi.ALPHANUMERIC=new RegExp(zne,"g");var Kne=new RegExp("^"+Xl+"$"),Yne=new RegExp("^"+bU+"$"),Jne=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");pi.testKanji=function(e){return Kne.test(e)};pi.testNumeric=function(e){return Yne.test(e)};pi.testAlphanumeric=function(e){return Jne.test(e)}});var ms=E(Nt=>{l();var Xne=V_(),G_=H_();Nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};Nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};Nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};Nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};Nt.MIXED={bit:-1};Nt.getCharCountIndicator=function(e,r){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Xne.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?e.ccBits[0]:r<27?e.ccBits[1]:e.ccBits[2]};Nt.getBestModeForData=function(e){return G_.testNumeric(e)?Nt.NUMERIC:G_.testAlphanumeric(e)?Nt.ALPHANUMERIC:G_.testKanji(e)?Nt.KANJI:Nt.BYTE};Nt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};Nt.isValid=function(e){return e&&e.bit&&e.ccBits};function Zne(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return Nt.NUMERIC;case"alphanumeric":return Nt.ALPHANUMERIC;case"kanji":return Nt.KANJI;case"byte":return Nt.BYTE;default:throw new Error("Unknown mode: "+t)}}Nt.from=function(e,r){if(Nt.isValid(e))return e;try{return Zne(e)}catch{return r}}});var CU=E(vo=>{l();var Py=gs(),eie=M_(),IU=Ty(),ws=ms(),k_=V_(),SU=7973,_U=Py.getBCHDigit(SU);function tie(t,e,r){for(let n=1;n<=40;n++)if(e<=vo.getCapacity(n,r,t))return n}function TU(t,e){return ws.getCharCountIndicator(t,e)+4}function rie(t,e){let r=0;return t.forEach(function(n){let i=TU(n.mode,e);r+=i+n.getBitsLength()}),r}function nie(t,e){for(let r=1;r<=40;r++)if(rie(t,r)<=vo.getCapacity(r,e,ws.MIXED))return r}vo.from=function(e,r){return k_.isValid(e)?parseInt(e,10):r};vo.getCapacity=function(e,r,n){if(!k_.isValid(e))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=ws.BYTE);let i=Py.getSymbolTotalCodewords(e),s=eie.getTotalCodewordsCount(e,r),o=(i-s)*8;if(n===ws.MIXED)return o;let a=o-TU(n,e);switch(n){case ws.NUMERIC:return Math.floor(a/10*3);case ws.ALPHANUMERIC:return Math.floor(a/11*2);case ws.KANJI:return Math.floor(a/13);case ws.BYTE:default:return Math.floor(a/8)}};vo.getBestVersionForData=function(e,r){let n,i=IU.from(r,IU.M);if(Array.isArray(e)){if(e.length>1)return nie(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return tie(n.mode,n.getLength(),i)};vo.getEncodedBits=function(e){if(!k_.isValid(e)||e<7)throw new Error("Invalid QR Code version");let r=e<<12;for(;Py.getBCHDigit(r)-_U>=0;)r^=SU<{l();var j_=gs(),NU=1335,iie=21522,xU=j_.getBCHDigit(NU);OU.getEncodedBits=function(e,r){let n=e.bit<<3|r,i=n<<10;for(;j_.getBCHDigit(i)-xU>=0;)i^=NU<{l();var sie=ms();function Su(t){this.mode=sie.NUMERIC,this.data=t.toString()}Su.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Su.prototype.getLength=function(){return this.data.length};Su.prototype.getBitsLength=function(){return Su.getBitsLength(this.data.length)};Su.prototype.write=function(e){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),e.put(i,10);let s=this.data.length-r;s>0&&(n=this.data.substr(r),i=parseInt(n,10),e.put(i,s*3+1))};PU.exports=Su});var LU=E((mve,BU)=>{l();var oie=ms(),Q_=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Tu(t){this.mode=oie.ALPHANUMERIC,this.data=t}Tu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Tu.prototype.getLength=function(){return this.data.length};Tu.prototype.getBitsLength=function(){return Tu.getBitsLength(this.data.length)};Tu.prototype.write=function(e){let r;for(r=0;r+2<=this.data.length;r+=2){let n=Q_.indexOf(this.data[r])*45;n+=Q_.indexOf(this.data[r+1]),e.put(n,11)}this.data.length%2&&e.put(Q_.indexOf(this.data[r]),6)};BU.exports=Tu});var MU=E((Eve,FU)=>{"use strict";l();FU.exports=function(e){for(var r=[],n=e.length,i=0;i=55296&&s<=56319&&n>i+1){var o=e.charCodeAt(i+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,i+=1)}if(s<128){r.push(s);continue}if(s<2048){r.push(s>>6|192),r.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);continue}if(s>=65536&&s<=1114111){r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer}});var qU=E((Ave,UU)=>{l();var aie=MU(),uie=ms();function Cu(t){this.mode=uie.BYTE,typeof t=="string"&&(t=aie(t)),this.data=new Uint8Array(t)}Cu.getBitsLength=function(e){return e*8};Cu.prototype.getLength=function(){return this.data.length};Cu.prototype.getBitsLength=function(){return Cu.getBitsLength(this.data.length)};Cu.prototype.write=function(t){for(let e=0,r=this.data.length;e{l();var cie=ms(),lie=gs();function xu(t){this.mode=cie.KANJI,this.data=t}xu.getBitsLength=function(e){return e*13};xu.prototype.getLength=function(){return this.data.length};xu.prototype.getBitsLength=function(){return xu.getBitsLength(this.data.length)};xu.prototype.write=function(t){let e;for(e=0;e=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};VU.exports=xu});var GU=E((Sve,W_)=>{"use strict";l();var Zl={single_source_shortest_paths:function(t,e,r){var n={},i={};i[e]=0;var s=Zl.PriorityQueue.make();s.push(e,0);for(var o,a,u,c,f,h,g,y,m;!s.empty();){o=s.pop(),a=o.value,c=o.cost,f=t[a]||{};for(u in f)f.hasOwnProperty(u)&&(h=f[u],g=c+h,y=i[u],m=typeof i[u]>"u",(m||y>g)&&(i[u]=g,s.push(u,g),n[u]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var T=["Could not find a path from ",e," to ",r,"."].join("");throw new Error(T)}return n},extract_shortest_path_from_predecessor_list:function(t,e){for(var r=[],n=e,i;n;)r.push(n),i=t[n],n=t[n];return r.reverse(),r},find_path:function(t,e,r){var n=Zl.single_source_shortest_paths(t,e,r);return Zl.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var e=Zl.PriorityQueue,r={},n;t=t||{};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);return r.queue=[],r.sorter=t.sorter||e.default_sorter,r},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof W_<"u"&&(W_.exports=Zl)});var YU=E(Nu=>{l();var He=ms(),QU=RU(),WU=LU(),zU=qU(),$U=HU(),ef=H_(),Ry=gs(),fie=GU();function kU(t){return unescape(encodeURIComponent(t)).length}function tf(t,e,r){let n=[],i;for(;(i=t.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:e,length:i[0].length});return n}function KU(t){let e=tf(ef.NUMERIC,He.NUMERIC,t),r=tf(ef.ALPHANUMERIC,He.ALPHANUMERIC,t),n,i;return Ry.isKanjiModeEnabled()?(n=tf(ef.BYTE,He.BYTE,t),i=tf(ef.KANJI,He.KANJI,t)):(n=tf(ef.BYTE_KANJI,He.BYTE,t),i=[]),e.concat(r,n,i).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function z_(t,e){switch(e){case He.NUMERIC:return QU.getBitsLength(t);case He.ALPHANUMERIC:return WU.getBitsLength(t);case He.KANJI:return $U.getBitsLength(t);case He.BYTE:return zU.getBitsLength(t)}}function hie(t){return t.reduce(function(e,r){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===r.mode?(e[e.length-1].data+=r.data,e):(e.push(r),e)},[])}function die(t){let e=[];for(let r=0;r{l();var Ly=gs(),$_=Ty(),gie=uU(),yie=lU(),mie=fU(),wie=pU(),J_=gU(),X_=M_(),Eie=vU(),By=CU(),vie=DU(),Aie=ms(),K_=YU();function bie(t,e){let r=t.size,n=wie.getPositions(e);for(let i=0;i=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?t.set(s+a,o+u,!0,!0):t.set(s+a,o+u,!1,!0))}}function Iie(t){let e=t.size;for(let r=8;r>a&1)===1,t.set(i,s,o,!0),t.set(s,i,o,!0)}function Y_(t,e,r){let n=t.size,i=vie.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(i>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(n-15+s,8,o,!0),s<8?t.set(8,n-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(n-8,8,1,!0)}function Tie(t,e){let r=t.size,n=-1,i=r-1,s=7,o=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!t.isReserved(i,a-u)){let c=!1;o>>s&1)===1),t.set(i,a-u,c),s--,s===-1&&(o++,s=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function Cie(t,e,r){let n=new gie;r.forEach(function(u){n.put(u.mode.bit,4),n.put(u.getLength(),Aie.getCharCountIndicator(u.mode,t)),u.write(n)});let i=Ly.getSymbolTotalCodewords(t),s=X_.getTotalCodewordsCount(t,e),o=(i-s)*8;for(n.getLengthInBits()+4<=o&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(o-n.getLengthInBits())/8;for(let u=0;u=7&&Une(u,e),qne(u,o),isNaN(n)&&(n=qI.getBestMask(u,UI.bind(null,u,r))),qI.applyMask(n,u),UI(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}SU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=FI.M,i,s;return typeof r<"u"&&(n=FI.from(r.errorCorrectionLevel,FI.M),i=Oy.from(r.version),s=qI.from(r.maskPattern),r.toSJISFunc&&Dy.setToSJISFunction(r.toSJISFunc)),Gne(e,i,n,s)}});var HI=m(wo=>{c();function CU(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}wo.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:CU(e.color.dark||"#000000ff"),light:CU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};wo.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};wo.getImageWidth=function(e,r){let n=wo.getScale(e,r);return Math.floor((e+r.margin*2)*n)};wo.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=wo.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,l=[n.color.light,n.color.dark];for(let f=0;f=u&&d>=u&&f{c();var GI=HI();function kne(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function jne(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Py.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=jne()),i=GI.getOptions(i);let o=GI.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return GI.qrToImageData(u.data,e,i),kne(a,s,o),a.putImageData(u,0,0),s};Py.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Py.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var DU=m(OU=>{c();var Qne=HI();function NU(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function kI(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Wne(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?kI("M",u+r,.5+l+r):kI("m",i,0),i=0,s=!1),u+1':"",l="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+l+` -`;return typeof n=="function"&&n(null,g),g}});var RU=m(zl=>{c();var $ne=RM(),jI=TU(),PU=xU(),zne=DU();function QI(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!$ne())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,l){try{let f=jI.create(r,n);u(t(f,e,n))}catch(f){l(f)}})}try{let u=jI.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}zl.create=jI.create;zl.toCanvas=QI.bind(null,PU.render);zl.toDataURL=QI.bind(null,PU.renderToDataURL);zl.toString=QI.bind(null,function(t,e,r){return zne.render(t,r)})});var KI=m(ys=>{"use strict";c();var oie=ys&&ys.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),kU=ys&&ys.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oie(e,t,r)};Object.defineProperty(ys,"__esModule",{value:!0});kU(Ll(),ys);kU(L_(),ys)});c();var uie=_e(Em(),1),cie=_e(Zw(),1),lie=_e(tE(),1),fie=_e(ht(),1),hie=_e(ra(),1),die=_e(wn(),1),pie=_e(jn(),1),gie=_e(ed(),1),yie=_e(fv(),1),mie=_e(wc(),1),r5=_e(mi(),1),Mn=_e(tc(),1),n5=_e(Mu(),1),i5=_e(Do(),1);c();c();var HO=_e(pv(),1);c();c();var Td="elvenjs_state",UO="https://devnet-api.multiversx.com";var Fi="/dapp/init",Cd="devnet",qO="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",VO=["wss://relay.walletconnect.com"],Yt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(Td);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(Td,JSON.stringify(r))},clear(){localStorage.removeItem(Td)}};var xd=async()=>{let t=HO.ExtensionProvider.getInstance();try{let e=await t.init(),r=Se.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var XU=_e(pv(),1),ZU=_e(Cl(),1),e5=_e(Ll(),1),t5=_e(cI(),1);c();var oM=_e(Cl(),1);c();c();var Te=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};c();var as=(s=>(s.ledger="ledger",s.mobile="mobile",s.webWallet="web-wallet",s.browserExtension="browser-extension",s.xAlias="x-alias",s))(as||{});var gu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};c();var iM=_e(ht(),1),sM=_e(ra(),1);c();var qt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;c();var yu=()=>new Date().setHours(new Date().getHours()+24),hy=t=>Date.now()>t;var us=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&hy(r))&&e&&t.networkProvider){let i=new iM.Address(e),s=new sM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),Se.set("nonce",o.nonce.valueOf()),Se.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=qt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};c();function dy(t){return t[Math.floor(Math.random()*t.length)]}var aM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{us(t),Te.run("onLoggedIn")},onClientLogout:()=>gu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=dy(t.initOptions.walletConnectV2RelayAddresses),n=new oM.WalletConnectV2Provider(e,Yt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};c();var _M=_e(Gt(),1),vy=_e(ht(),1),IM=_e(uM(),1),SM=_e(dM(),1),TM=_e(EI(),1),CM=_e(EM(),1),xM=_e(AM(),1),NM=_e(bM(),1),OM=_e(Ec(),1);var Ay=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Cd,this.apiUrl=e||Yt[this.chainType]?.apiAddress,this.apiTimeout=n||Yt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let l=u?.error||a.status;return clearTimeout(s),Promise.reject(l)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new vy.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new _M.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new IM.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new vy.Address(r.sender),receiver:new vy.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:h.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:SM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:TM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:CM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new OM.Query({address:e,func:r,args:n,value:i,caller:s}),a=new NM.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return xM.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};c();var DM=async(t,e,r,n="/")=>{let i=await xd(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.run("onLogout"))}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Se.set("loginToken",e),a&&Se.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");Se.set("address",u),Se.set("loginMethod","browser-extension"),Se.set("expires",yu()),await us(t),Te.run("onLoggedIn");let l=r.getToken(u,e,a);return Se.set("accessToken",l),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u?.message}`),Te.run("onLogout")}};c();c();var BU=_e(RU(),1),LU=_e(Cl(),1);var Yne=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Jne=t=>{let e=`${qO}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},Xne=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},Zne=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},WI={},eie=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",WI[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:WI[t.topic].signal}),r},Ry={},tie=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=eie(t,e);return n.appendChild(s),Ry[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:Ry[t.topic].signal}),n},rie=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},nie=t=>{if(!t)return;document.getElementById(t)?.remove()},iie=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),sie=async t=>t?await BU.default.toString(t,{type:"svg"}):void 0,FU=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await sie(e),o;if(s&&(o=Yne(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),iie()&&i.appendChild(Jne(e))),i&&r instanceof LU.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),nie(f))}catch(d){let g=qt(d);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{Ry[f].abort()}},l=async f=>{try{let{approval:d}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(rie()),await r.login({approval:d,token:n})}catch(d){let g=qt(d);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let d of Object.values(Ry))d?.abort();for(let d of Object.values(WI))d?.abort()}};if(a&&a.length>0){let f=Xne();i.appendChild(f);let d=Zne();f.appendChild(d);for(let g of a){let w=tie(g,u,l);f.appendChild(w)}}}return i};var By=_e(Cl(),1);var MU=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=dy(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof By.WalletConnectV2Provider){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),l=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",yu()),await us(t),l&&Se.set("signature",l),Se.set("loginToken",e);let f=r.getToken(u,e,l);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof By.WalletConnectV2Provider&&(await gu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new By.WalletConnectV2Provider(o,Yt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.run("onQrPending"),await a.init();let{uri:u,approval:l}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await FU(n,f,a,e),Te.run("onQrLoaded")),await a.login({approval:l,token:e}),a}}catch(u){let l=qt(u);console.warn(`Something went wrong trying to login the user: ${l}`),Te.run("onLogout")}};c();var UU=_e(Ll(),1);var $I=async(t,e,r,n)=>{let i=new UU.WalletProvider(`${t}${Fi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod",Yt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),Se.set("expires",yu()),Se.set("loginToken",e),i}catch(a){let u=qt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.set("loginMethod",""),Te.run("onLogout")}};c();var gs=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};c();var qU=_e(Ll(),1);var VU=_e(cI(),1),zI=async(t,e)=>{let r=gs("signature"),n=gs("address"),i=Se.get("address"),s=Se.get("loginToken");if(r&&Se.set("signature",r),n||i){n&&(Se.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new qU.WalletProvider(`${t}${Fi}`);if(r&&e&&n){let u=new VU.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};c();var HU=_e(ra(),1),GU=_e(ed(),1);var Ly=async(t,e)=>{Te.run("onTxSent",t),await new GU.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new HU.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};c();var Tu=_e(KI(),1),QU=_e(wn(),1);c();var jU=_e(ra(),1);var Fy=t=>{let e=t.getSender(),r=new jU.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var WU=async(t,e,r,n)=>{if(gs(Tu.WALLET_PROVIDER_CALLBACK_PARAM)===Tu.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=gs("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=h.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new Tu.WalletProvider(`${r}${Fi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let l=QU.Transaction.fromPlainObject(u);l.setNonce(n),Fy(l);try{Te.run("onTxStarted",l),await e.sendTransaction(l),await Ly(l,e)}catch(f){let d=qt(f);throw Te.run("onTxError",l,d),new Error(`Error: Transaction signing failed! ${d}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};c();var My=_e(cc(),1),$U=_e(ht(),1),zU=_e(KI(),1);var KU=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(My.TransactionVersion.withTxOptions()),t.setOptions(My.TransactionOptions.withOptions(r)),t.setGuardian($U.Address.fromBech32(e))}return t},YU=async(t,e)=>{let r=new zU.WalletProvider(`${e}${Fi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},JU=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};var YI=class{static async init(e){let r=Se.get();if(r.expires&&hy(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Cd,apiUrl:UO,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:VO,...e},this.networkProvider=new Ay(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&gs("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await xd()),r.loginMethod==="mobile"&&(this.dappProvider=await aM(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions.chainType&&(this.dappProvider=await zI(Yt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await us(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&await WU(this.dappProvider,this.networkProvider,Yt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce))}static async login(e,r){if(!Object.values(as).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new t5.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await DM(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await MU(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await $I(Yt[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=qt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await gu(this);return this.dappProvider=void 0,e}catch(e){let r=qt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");let r=KU(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof XU.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof ZU.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof e5.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=JU(r);if(i||Fy(r),i&&this.initOptions?.chainType){await YU(r,Yt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await Ly(r,this.networkProvider)}}catch(n){let i=qt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return await this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(o){let a=qt(o);throw new Error(`Error: Smart contract query failed! ${a}`)}}static{this.storage=Se}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,Te.clear()}}};var export_Account=hie.Account;var export_Address=fie.Address;var export_AddressType=i5.AddressType;var export_AddressValue=i5.AddressValue;var export_BigUIntType=Mn.BigUIntType;var export_BigUIntValue=Mn.BigUIntValue;var export_BooleanType=n5.BooleanType;var export_BooleanValue=n5.BooleanValue;var export_BytesType=r5.BytesType;var export_BytesValue=r5.BytesValue;var export_ContractFunction=mie.ContractFunction;var export_GasEstimator=lie.GasEstimator;var export_SmartContract=yie.SmartContract;var export_TokenTransfer=uie.TokenTransfer;var export_Transaction=die.Transaction;var export_TransactionPayload=pie.TransactionPayload;var export_TransactionWatcher=gie.TransactionWatcher;var export_TransferTransactionsFactory=cie.TransferTransactionsFactory;var export_U16Type=Mn.U16Type;var export_U16Value=Mn.U16Value;var export_U32Type=Mn.U32Type;var export_U32Value=Mn.U32Value;var export_U64Type=Mn.U64Type;var export_U64Value=Mn.U64Value;var export_U8Type=Mn.U8Type;var export_U8Value=Mn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,YI as ElvenJS,export_GasEstimator as GasEstimator,as as LoginMethodsEnum,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; +`);let o=Cie(e,r,i),a=Ly.getSymbolSize(e),u=new yie(a);return bie(u,e),Iie(u),_ie(u,e),Y_(u,r,0),e>=7&&Sie(u,e),Tie(u,o),isNaN(n)&&(n=J_.getBestMask(u,Y_.bind(null,u,r))),J_.applyMask(n,u),Y_(u,r,n),{modules:u,version:e,errorCorrectionLevel:r,maskPattern:n,segments:i}}JU.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");let n=$_.M,i,s;return typeof r<"u"&&(n=$_.from(r.errorCorrectionLevel,$_.M),i=By.from(r.version),s=J_.from(r.maskPattern),r.toSJISFunc&&Ly.setToSJISFunction(r.toSJISFunc)),Nie(e,i,n,s)}});var Z_=E(Ao=>{l();function ZU(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(n){return[n,n]}))),e.length===6&&e.push("F","F");let r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+e.slice(0,6).join("")}}Ao.getOptions=function(e){e||(e={}),e.color||(e.color={});let r=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:ZU(e.color.dark||"#000000ff"),light:ZU(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ao.getScale=function(e,r){return r.width&&r.width>=e+r.margin*2?r.width/(e+r.margin*2):r.scale};Ao.getImageWidth=function(e,r){let n=Ao.getScale(e,r);return Math.floor((e+r.margin*2)*n)};Ao.qrToImageData=function(e,r,n){let i=r.modules.size,s=r.modules.data,o=Ao.getScale(i,n),a=Math.floor((i+n.margin*2)*o),u=n.margin*o,c=[n.color.light,n.color.dark];for(let f=0;f=u&&h>=u&&f{l();var eS=Z_();function Oie(t,e,r){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=r,e.width=r,e.style.height=r+"px",e.style.width=r+"px"}function Die(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Fy.render=function(e,r,n){let i=n,s=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(s=Die()),i=eS.getOptions(i);let o=eS.getImageWidth(e.modules.size,i),a=s.getContext("2d"),u=a.createImageData(o,o);return eS.qrToImageData(u.data,e,i),Oie(a,s,o),a.putImageData(u,0,0),s};Fy.renderToDataURL=function(e,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let s=Fy.render(e,r,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}});var n5=E(r5=>{l();var Pie=Z_();function t5(t,e){let r=t.a/255,n=e+'="'+t.hex+'"';return r<1?n+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function tS(t,e,r){let n=t+e;return typeof r<"u"&&(n+=" "+r),n}function Rie(t,e,r){let n="",i=0,s=!1,o=0;for(let a=0;a0&&u>0&&t[a-1]||(n+=s?tS("M",u+r,.5+c+r):tS("m",i,0),i=0,s=!1),u+1':"",c="',f='viewBox="0 0 '+a+" "+a+'"',g=''+u+c+` +`;return typeof n=="function"&&n(null,g),g}});var s5=E(rf=>{l();var Bie=sU(),rS=XU(),i5=e5(),Lie=n5();function nS(t,e,r,n,i){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!Bie())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(i=r,r=e,e=n=void 0):o===3&&(e.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=n=void 0):o===2&&!e.getContext&&(n=r,r=e,e=void 0),new Promise(function(u,c){try{let f=rS.create(r,n);u(t(f,e,n))}catch(f){c(f)}})}try{let u=rS.create(r,n);i(null,t(u,e,n))}catch(u){i(u)}}rf.create=rS.create;rf.toCanvas=nS.bind(null,i5.render);rf.toDataURL=nS.bind(null,i5.renderToDataURL);rf.toString=nS.bind(null,function(t,e,r){return Lie.render(t,r)})});var aS=E(Es=>{"use strict";l();var Wie=Es&&Es.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),g5=Es&&Es.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Wie(e,t,r)};Object.defineProperty(Es,"__esModule",{value:!0});g5(jl(),Es);g5(zI(),Es)});l();var zie=be(_m(),1),$ie=be(sE(),1),Kie=be(aE(),1),Yie=be(ht(),1),Jie=be(oa(),1),Xie=be(bn(),1),Zie=be(zn(),1),ese=be(ud(),1),tse=be(mv(),1),rse=be(Sc(),1),nse=be(Bd(),1),T5=be(vi(),1),Hn=be(oc(),1),C5=be(Gu(),1),x5=be(Lo(),1);l();l();var n2=be(Av(),1);l();l();var Ld="elvenjs_state",e2="https://devnet-api.multiversx.com";var qi="/dapp/init",Fd="devnet",t2="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",r2=["wss://relay.walletconnect.com"],Jt={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.com",xAliasAddress:"https://devnet.xalias.com",apiAddress:"https://devnet-api.multiversx.com",explorerAddress:"https://devnet-explorer.multiversx.com",apiTimeout:1e4},testnet:{id:"testnet",shortId:"T",name:"Testnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://testnet-wallet.multiversx.com",xAliasAddress:"https://testnet.xalias.com",apiAddress:"https://testnet-api.multiversx.com",explorerAddress:"https://testnet-explorer.multiversx.com",apiTimeout:1e4},mainnet:{id:"mainnet",shortId:"1",name:"Mainnet",egldLabel:"EGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://wallet.multiversx.com",xAliasAddress:"https://xalias.com",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Se={get(t){let e=localStorage.getItem(Ld);if(!e)return{};let r=JSON.parse(e);return t?r[t]:r},set(t,e){let r=this.get();r[t]=e,localStorage.setItem(Ld,JSON.stringify(r))},clear(){localStorage.removeItem(Ld)}};var Md=async()=>{let t=n2.ExtensionProvider.getInstance();try{let e=await t.init(),r=Se.get();if(r?.address&&t.setAddress(r.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return t}catch{console.warn("Can't initialize the Dapp Provider!")}};var uS=be(Av(),1),cS=be(Fl(),1),lS=be(jl(),1),S5=be(A_(),1),Gy=be(Bd(),1);l();var PM=be(Fl(),1);l();l();var Te=class{static set(e,r){if(!e)return;let n={...this.events,[e]:r};this.events=n}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...r){!e||!this.events||this.events[e]?.(...r)}static clear(){this.events=void 0}};l();var gy=(s=>(s.ledger="ledger",s.mobile="mobile",s.webWallet="web-wallet",s.browserExtension="browser-extension",s.xAlias="x-alias",s))(gy||{});var wu=async t=>{if(!t.dappProvider)throw new Error("Error: Logout failed: There is no active session!");Te.run("onLoginPending");let e=await t.dappProvider.logout();return e&&(Se.clear(),Te.run("onLogout")),e};l();var OM=be(ht(),1),DM=be(oa(),1);l();var Bt=t=>typeof t=="string"?t.toUpperCase():t instanceof Error?t.message:`Error: ${JSON.stringify(t)}`;l();var Eu=()=>new Date().setHours(new Date().getHours()+24),yy=t=>Date.now()>t;var hs=async t=>{let e=Se.get("address"),r=Se.get("expires");if(!(r&&yy(r))&&e&&t.networkProvider){let i=new OM.Address(e),s=new DM.Account(i);try{let o=await t.networkProvider.getAccount(i),a=await t.networkProvider.getGuardianData(i);Se.set("address",e),Se.set("activeGuardian",a.guarded&&a.activeGuardian?.address?a.activeGuardian.address:""),Se.set("nonce",o.nonce.valueOf()),Se.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Bt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}};l();function my(t){return t[Math.floor(Math.random()*t.length)]}var RM=async t=>{if(!t.initOptions.walletConnectV2ProjectId||!t.initOptions.chainType)return;let e={onClientLogin:()=>{hs(t),Te.run("onLoggedIn")},onClientLogout:()=>wu(t),onClientEvent:i=>{console.log("wc2 session event: ",i)}},r=my(t.initOptions.walletConnectV2RelayAddresses),n=new PM.WalletConnectV2Provider(e,Jt[t.initOptions.chainType].shortId,r,t.initOptions.walletConnectV2ProjectId);try{return await n.init(),n}catch{console.warn("Can't initialize the Dapp Provider!")}};l();var KM=be(kt(),1),_y=be(ht(),1),YM=be(BM(),1),JM=be(qM(),1),XM=be(D_(),1),ZM=be(QM(),1),eU=be(zM(),1),tU=be($M(),1),rU=be(Tc(),1);var Sy=class{constructor({apiUrl:e,chainType:r,apiTimeout:n}){this.chainType=r||Fd,this.apiUrl=e||Jt[this.chainType]?.apiAddress,this.apiTimeout=n||Jt[this.chainType]?.apiTimeout}async apiGet(e,r){if(typeof fetch<"u"){let n=new AbortController,i=setTimeout(()=>n.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:n.signal};try{let o=await fetch(this.apiUrl+"/"+e,Object.assign(s,r||{})),a=await o.json();if(!o.ok){let u=a?.error||o.status;return clearTimeout(i),Promise.reject(u)}return clearTimeout(i),a}catch(o){this.handleApiError(o,e)}}}async apiPost(e,r,n){if(typeof fetch<"u"){let i=new AbortController,s=setTimeout(()=>i.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r||{}),signal:i.signal};try{let a=await fetch(this.apiUrl+"/"+e,Object.assign(o,n||{})),u=await a.json();if(!a.ok){let c=u?.error||a.status;return clearTimeout(s),Promise.reject(c)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}}handleApiError(e,r){if(!e.response)throw new Error(`Request error on url [${r}]: [${e.toString()}]`);let n=e.response.data,i=n.error||n.message||JSON.stringify(n);throw new Error(i)}async sendTransaction(e){return(await this.apiPost("transactions",e.toSendable())).txHash}async getAccount(e){let r=await this.apiGet(`accounts/${e.bech32()}`);return{address:new _y.Address(r?.address||""),nonce:Number(r?.nonce||0),balance:new KM.default(r?.balance||0),code:r?.code||"",userName:r?.username||""}}async getGuardianData(e){let r=await this.apiGet(`address/${e.bech32()}/guardian-data`);return{guarded:r?.data?.guardianData?.guarded||!1,activeGuardian:r?.data?.guardianData?.activeGuardian,pendingGuardian:r?.data?.guardianData?.pendingGuardian}}async getTransaction(e){let r=await this.apiGet(`transactions/${e}`),n=new YM.TransactionStatus(r.status);return{hash:e,type:r.type||"",nonce:r.nonce||0,round:r.round,epoch:r.epoch||0,value:(r.value||0).toString(),sender:new _y.Address(r.sender),receiver:new _y.Address(r.receiver),gasPrice:r.gasPrice||0,gasLimit:r.gasLimit||0,data:d.Buffer.from(r.data||"","base64"),status:n,timestamp:r.timestamp||0,blockNonce:r.blockNonce||0,hyperblockNonce:r.hyperblockNonce||0,hyperblockHash:r.hyperblockHash||"",receipt:JM.TransactionReceipt.fromHttpResponse(r.receipt||{}),logs:XM.TransactionLogs.fromHttpResponse(r.logs||{}),contractResults:ZM.ContractResults.fromApiHttpResponse(r.results||[]),isCompleted:!n.isPending()}}async queryContract({address:e,func:r,args:n,value:i,caller:s}){try{let o=new rU.Query({address:e,func:r,args:n,value:i,caller:s}),a=new tU.ContractQueryRequest(o).toHttpRequest(),u=await this.apiPost("query",a);return eU.ContractQueryResponse.fromHttpResponse(u)}catch(o){this.handleApiError(o,"query")}}};l();var nU=async(t,e,r,n="/")=>{let i=await Md(),o={callbackUrl:encodeURIComponent(`${window.location.origin}${n}`),token:e};try{i&&(await i.login(o)?Te.run("onLoginPending"):Te.run("onLogout"))}catch(u){let c=Bt(u);console.warn(`Something went wrong trying to login the user: ${c}`)}if(!i)throw new Error("Error: There were problems with auth provider initialization!");let{signature:a}=i.account;if(Se.set("loginToken",e),a&&Se.set("signature",a),t.networkProvider&&a)try{let u=await i.getAddress();if(!u)throw new Error("Canceled!");Se.set("address",u),Se.set("loginMethod","browser-extension"),Se.set("expires",Eu()),await hs(t),Te.run("onLoggedIn");let c=r.getToken(u,e,a);return Se.set("accessToken",c),i}catch(u){console.warn(`Something went wrong trying to synchronize the user account: ${u?.message}`),Te.run("onLogout")}};l();l();var o5=be(s5(),1),a5=be(Fl(),1);var Fie=t=>{let e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild?.cloneNode(!0)},Mie=t=>{let e=`${t2}?wallet-connect=${encodeURIComponent(t)}`,r=document.createElement("a");return r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer nofollow"),r.setAttribute("target","_blank"),r.textContent="xPortal login",r.classList.add("elven-qr-code-deep-link"),r},Uie=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairings"),t},qie=()=>{let t=document.createElement("div");return t.textContent="Existing WalletConnect pairings:",t.classList.add("elven-wc-pairings-header"),t},iS={},Vie=(t,e)=>{let r=document.createElement("button");return r.classList.add("elven-wc-pairings-remove-btn"),r.textContent="\u2716",iS[t.topic]=new AbortController,r.addEventListener("click",n=>{n.stopImmediatePropagation(),e(t.topic)},{signal:iS[t.topic].signal}),r},My={},Hie=(t,e,r)=>{let n=document.createElement("div"),i=document.createElement("div");n.classList.add("elven-wc-pairing-item"),n.setAttribute("id",t.topic),i.classList.add("elven-wc-pairing-item-description"),i.textContent=`${t.peerMetadata?.description} (${t.peerMetadata?.url})`,n.appendChild(i);let s=Vie(t,e);return n.appendChild(s),My[t.topic]=new AbortController,n.addEventListener("click",()=>r(t.topic),{signal:My[t.topic].signal}),n},Gie=()=>{let t=document.createElement("div");return t.classList.add("elven-wc-pairing-item-confirm-msessage"),t.setAttribute("id","elven-wc-pairing-item-confirm-msessage"),t.innerText="Confirm on xPortal app!",t},kie=t=>{if(!t)return;document.getElementById(t)?.remove()},jie=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),Qie=async t=>t?await o5.default.toString(t,{type:"svg"}):void 0,u5=async(t,e,r,n)=>{if(!t)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let i=null;typeof t=="string"?i=document.getElementById(t):t instanceof HTMLElement&&(i=t);let s=await Qie(e),o;if(s&&(o=Fie(s)),i&&o&&(i.replaceChildren(),i.appendChild(o),jie()&&i.appendChild(Mie(e))),i&&r instanceof a5.WalletConnectV2Provider){let a=r.pairings,u=async f=>{try{f&&(await r.logout({topic:f}),kie(f))}catch(h){let g=Bt(h);console.warn(`Something went wrong trying to remove the existing pairing: ${g}`)}finally{My[f].abort()}},c=async f=>{try{let{approval:h}=await r.connect({topic:f,methods:["mvx_cancelAction","mvx_signNativeAuthToken"]});document.getElementById("elven-wc-pairing-item-confirm-msessage")||document.getElementById(f)?.after(Gie()),await r.login({approval:h,token:n})}catch(h){let g=Bt(h);console.warn(`Something went wrong trying to login the user: ${g}`)}finally{for(let h of Object.values(My))h?.abort();for(let h of Object.values(iS))h?.abort()}};if(a&&a.length>0){let f=Uie();i.appendChild(f);let h=qie();f.appendChild(h);for(let g of a){let y=Hie(g,u,c);f.appendChild(y)}}}return i};var Uy=be(Fl(),1);var c5=async(t,e,r,n)=>{if(!n)throw new Error("You haven't provided the QR code container DOM element id");let i=my(t.initOptions.walletConnectV2RelayAddresses);if(!i||!t.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!t.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!t.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let s,o={onClientLogin:async()=>{if(t.dappProvider instanceof Uy.WalletConnectV2Provider){Te.run("onLoginPending");let u=await t.dappProvider.getAddress(),c=await t.dappProvider.getSignature();Se.set("address",u),Se.set("loginMethod","mobile"),Se.set("expires",Eu()),await hs(t),c&&Se.set("signature",c),Se.set("loginToken",e);let f=r.getToken(u,e,c);Se.set("accessToken",f),Te.run("onLoggedIn"),s?.replaceChildren()}},onClientLogout:async()=>{t.dappProvider instanceof Uy.WalletConnectV2Provider&&(await wu(t),Te.run("onLogout"))},onClientEvent:u=>{console.log("wc2 session event: ",u)}},a=new Uy.WalletConnectV2Provider(o,Jt[t.initOptions.chainType].shortId,i,t.initOptions.walletConnectV2ProjectId);try{if(a){t.dappProvider=a,Te.run("onQrPending"),await a.init();let{uri:u,approval:c}=await a.connect({methods:["mvx_cancelAction","mvx_signNativeAuthToken"]}),f=e?`${u}&token=${e}`:u;return n&&f&&(s=await u5(n,f,a,e),Te.run("onQrLoaded")),await a.login({approval:c,token:e}),a}}catch(u){let c=Bt(u);console.warn(`Something went wrong trying to login the user: ${c}`),Te.run("onLogout")}};l();var l5=be(jl(),1);var sS=async(t,e,r,n)=>{let i=new l5.WalletProvider(`${t}${qi}`),o={callbackUrl:typeof window<"u"?encodeURIComponent(`${window.location.origin}${n||"/"}`):"/",token:e};try{return Te.run("onLoginPending"),Se.set("loginMethod",Jt[r].xAliasAddress===t?"x-alias":"web-wallet"),await i.login(o),Se.set("expires",Eu()),Se.set("loginToken",e),i}catch(a){let u=Bt(a);console.warn(`Something went wrong trying to login the user: ${u}`),Se.set("loginMethod",""),Te.run("onLogout")}};l();var Sr=t=>{if(typeof window<"u"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(t)}};l();var f5=be(jl(),1);var h5=be(A_(),1),oS=async(t,e)=>{let r=Sr("signature"),n=Sr("address"),i=Se.get("address"),s=Se.get("loginToken");if(r&&Se.set("signature",r),n||i){n&&(Se.set("address",n),window.history.replaceState(null,"",window.location.pathname));let o=new f5.WalletProvider(`${t}${qi}`);if(r&&e&&n){let u=new h5.NativeAuthClient({apiUrl:e,origin:window.location.origin}).getToken(n,s,r);Se.set("accessToken",u)}return o}};l();var d5=be(oa(),1),p5=be(ud(),1);var qy=async(t,e)=>{Te.run("onTxSent",t),await new p5.TransactionWatcher(e).awaitCompleted(t);let n=t.getSender(),i=new d5.Account(n),s=await e.getAccount(n);i.update(s),Se.set("address",i.address.bech32()),Se.set("balance",i.balance.toString()),Te.run("onTxFinalized",t)};l();var Ou=be(aS(),1),m5=be(bn(),1);l();var y5=be(oa(),1);var Vy=t=>{let e=t.getSender(),r=new y5.Account(e),n=t.getNonce().valueOf();r.incrementNonce(),Se.set("nonce",n+1)};var w5=async(t,e,r,n)=>{if(Sr(Ou.WALLET_PROVIDER_CALLBACK_PARAM)===Ou.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&t&&e){let s=Se.get("activeGuardian"),o=Se.get("loginMethod"),a=Sr("hasWebWalletGuardianSign"),u;if("getTransactionsFromWalletUrl"in t){if(u=t.getTransactionsFromWalletUrl()?.[0],!u)return;o==="web-wallet"&&(u.data=d.Buffer.from(u.data).toString("base64"))}else s&&o!=="web-wallet"&&o!=="x-alias"&&a&&(u=new Ou.WalletProvider(`${r}${qi}`).getTransactionsFromWalletUrl()?.[0]);if(u){let c=m5.Transaction.fromPlainObject(u);c.setNonce(n),Vy(c);try{Te.run("onTxStarted",c),await e.sendTransaction(c),await qy(c,e)}catch(f){let h=Bt(f);throw Te.run("onTxError",c,h),new Error(`Error: Transaction signing failed! ${h}`)}finally{window.history.replaceState(null,"",window.location.pathname)}}window.history.replaceState(null,"",window.location.pathname)}};l();var Hy=be(gc(),1),E5=be(ht(),1),v5=be(aS(),1);var A5=t=>{let e=Se.get("activeGuardian");if(e){let r={guarded:!0};t.setVersion(Hy.TransactionVersion.withTxOptions()),t.setOptions(Hy.TransactionOptions.withOptions(r)),t.setGuardian(E5.Address.fromBech32(e))}return t},b5=async(t,e)=>{let r=new v5.WalletProvider(`${e}${qi}`),n=window?.location.href,i=new URL(n);i.searchParams.set("hasWebWalletGuardianSign","true"),await r.guardTransactions([t],{callbackUrl:encodeURIComponent(i.toString())})},I5=t=>{let e=Se.get("activeGuardian");return!(!Se.get("address")||!e||t.isGuardedTransaction())};l();var _5=()=>{let t=!Sr("walletProviderStatus"),e=Sr("status")==="signed",r=Sr("message"),n=Sr("signature");t&&e&&r&&n&&(Te.run("onSignMsgFinalized",r,n),window.history.replaceState(null,"",window.location.pathname))};var fS=class{static async init(e){let r=Se.get();if(r.expires&&yy(r.expires)){Se.clear(),this.dappProvider=void 0;return}this.initOptions={chainType:Fd,apiUrl:e2,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:r2,...e},this.networkProvider=new Sy(this.initOptions),this.initOptions.onLoginPending&&Te.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&Te.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&Te.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&Te.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&Te.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&Te.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&Te.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&Te.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&Te.set("onTxError",this.initOptions.onTxError),this.initOptions.onSignMsgStarted&&Te.set("onSignMsgStarted",this.initOptions.onSignMsgStarted),this.initOptions.onSignMsgFinalized&&Te.set("onSignMsgFinalized",this.initOptions.onSignMsgFinalized),this.initOptions.onSignMsgError&&Te.set("onSignMsgError",this.initOptions.onSignMsgError),(r?.address||(r.loginMethod==="web-wallet"||r.loginMethod==="x-alias")&&Sr("address"))&&r?.loginMethod&&(Te.run("onLoginPending"),r.loginMethod==="browser-extension"&&(this.dappProvider=await Md()),r.loginMethod==="mobile"&&(this.dappProvider=await RM(this)),r.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=await oS(Jt[this.initOptions.chainType].walletAddress,this.initOptions.apiUrl)),r.loginMethod==="x-alias"&&this.initOptions.chainType&&(this.dappProvider=await oS(Jt[this.initOptions.chainType].xAliasAddress,this.initOptions.apiUrl)),await hs(this),Te.run("onLoggedIn"),this.initOptions?.chainType&&(await w5(this.dappProvider,this.networkProvider,Jt[this.initOptions.chainType][r.loginMethod==="x-alias"?"xAliasAddress":"walletAddress"],r.nonce),_5()))}static async login(e,r){if(!Object.values(gy).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{Te.run("onLoginPending");let i=new S5.NativeAuthClient({apiUrl:this.initOptions?.apiUrl,origin:window.location.origin}),s=await i.initialize();if(e==="browser-extension"){let o=await nU(this,s,i,r?.callbackRoute);this.dappProvider=o}if(e==="mobile"){let o=await c5(this,s,i,r?.qrCodeContainer);this.dappProvider=o}if(e==="web-wallet"&&this.initOptions?.chainType){let o=await sS(Jt[this.initOptions.chainType].walletAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}if(e==="x-alias"&&this.initOptions?.chainType){let o=await sS(Jt[this.initOptions.chainType].xAliasAddress,s,this.initOptions?.chainType,r?.callbackRoute);this.dappProvider=o}}catch(i){let s=Bt(i);throw new Error(`Error: ${s}`)}}static async logout(){try{let e=await wu(this);return this.dappProvider=void 0,e}catch(e){let r=Bt(e);console.warn("Something went wrong when logging out: ",r)}}static async signAndSendTransaction(e){if(!this.dappProvider)throw new Error("Error: Transaction signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Transaction signing failed: There is no active network provider!");let r=A5(e);try{Te.run("onTxStarted",e);let n=Se.get();if(e.setNonce(n.nonce),this.dappProvider instanceof uS.ExtensionProvider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof cS.WalletConnectV2Provider&&(r=await this.dappProvider.signTransaction(e)),this.dappProvider instanceof lS.WalletProvider&&await this.dappProvider.signTransaction(e),n.loginMethod!=="web-wallet"&&n.loginMethod!=="x-alias"){let i=I5(r);if(i||Vy(r),i&&this.initOptions?.chainType){await b5(r,Jt[this.initOptions.chainType].walletAddress);return}await this.networkProvider.sendTransaction(r),await qy(r,this.networkProvider)}}catch(n){let i=Bt(n);throw Te.run("onTxError",r,i),new Error(`Error: Transaction signing failed! ${i}`)}return r}static async signMessage(e,r){if(!this.dappProvider)throw new Error("Error: Message signing failed: There is no active session!");if(!this.networkProvider)throw new Error("Error: Message signing failed: There is no active network provider!");let n="";try{if(Te.run("onSignMsgStarted",e),this.dappProvider instanceof uS.ExtensionProvider&&(n=(await this.dappProvider.signMessage(new Gy.SignableMessage({message:d.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof cS.WalletConnectV2Provider&&(n=(await this.dappProvider.signMessage(new Gy.SignableMessage({message:d.Buffer.from(e)}))).getSignature().toString("hex")),this.dappProvider instanceof lS.WalletProvider){let i=o=>encodeURIComponent(o).replace(/[!'()*]/g,a=>`%${a.charCodeAt(0).toString(16).toUpperCase()}`),s=r?.callbackUrl||window.location.origin;await this.dappProvider.signMessage(new Gy.SignableMessage({message:d.Buffer.from(e)}),{callbackUrl:encodeURIComponent(`${s}${s.includes("?")?"&":"?"}message=${i(e)}`)})}return Te.run("onSignMsgFinalized",e,n),{message:e,messageSignature:n}}catch(i){let s=Bt(i);throw Te.run("onSignMsgError",e,s),new Error(`Error: Message signing failed! ${s}`)}}static async queryContract({address:e,func:r,args:n=[],value:i=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!r)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return await this.networkProvider.queryContract({address:e,func:r,args:n,value:i,caller:s})}catch(o){let a=Bt(o);throw new Error(`Error: Smart contract query failed! ${a}`)}}static{this.storage=Se}static{this.destroy=()=>{this.networkProvider=void 0,this.dappProvider=void 0,this.initOptions=void 0,Te.clear()}}};var export_Account=Jie.Account;var export_Address=Yie.Address;var export_AddressType=x5.AddressType;var export_AddressValue=x5.AddressValue;var export_BigUIntType=Hn.BigUIntType;var export_BigUIntValue=Hn.BigUIntValue;var export_BooleanType=C5.BooleanType;var export_BooleanValue=C5.BooleanValue;var export_BytesType=T5.BytesType;var export_BytesValue=T5.BytesValue;var export_ContractFunction=rse.ContractFunction;var export_GasEstimator=Kie.GasEstimator;var export_SignableMessage=nse.SignableMessage;var export_SmartContract=tse.SmartContract;var export_TokenTransfer=zie.TokenTransfer;var export_Transaction=Xie.Transaction;var export_TransactionPayload=Zie.TransactionPayload;var export_TransactionWatcher=ese.TransactionWatcher;var export_TransferTransactionsFactory=$ie.TransferTransactionsFactory;var export_U16Type=Hn.U16Type;var export_U16Value=Hn.U16Value;var export_U32Type=Hn.U32Type;var export_U32Value=Hn.U32Value;var export_U64Type=Hn.U64Type;var export_U64Value=Hn.U64Value;var export_U8Type=Hn.U8Type;var export_U8Value=Hn.U8Value;export{export_Account as Account,export_Address as Address,export_AddressType as AddressType,export_AddressValue as AddressValue,export_BigUIntType as BigUIntType,export_BigUIntValue as BigUIntValue,export_BooleanType as BooleanType,export_BooleanValue as BooleanValue,export_BytesType as BytesType,export_BytesValue as BytesValue,export_ContractFunction as ContractFunction,fS as ElvenJS,export_GasEstimator as GasEstimator,gy as LoginMethodsEnum,export_SignableMessage as SignableMessage,export_SmartContract as SmartContract,export_TokenTransfer as TokenTransfer,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_TransferTransactionsFactory as TransferTransactionsFactory,export_U16Type as U16Type,export_U16Value as U16Value,export_U32Type as U32Type,export_U32Value as U32Value,export_U64Type as U64Type,export_U64Value as U64Value,export_U8Type as U8Type,export_U8Value as U8Value}; /*! Bundled license information: ieee754/index.js: diff --git a/example/index.html b/example/index.html index 7f046e7..a20ed33 100644 --- a/example/index.html +++ b/example/index.html @@ -32,6 +32,7 @@ + @@ -39,26 +40,31 @@ with Web Wallet - - GitHub + GitHub
Loading...
-
* For the ESDT transfer you will need to get the
+ +
* For the ESDT transfer you will need to get the BUILDO-22c0a5 token from the faucet: https://devnet-multiversx-esdt-faucet.netlify.app (you can also modify the hardcoded token and test it with yours locally, check the sourcecode of this website for more info).
-
** The query will trigger a 'getMintedPerAddressTotal' with currently logged in user's +
** The query will trigger a 'getMintedPerAddressTotal' with currently logged in user's address using the Elven Tools Smart Contract.
-
+
*** The signing message example will sign the: 'Elven Family is awesome!' message. + You can + check the source code of this page and how to use it.
+

ElvenJS (demo)

@@ -116,6 +122,12 @@

Demo transactions/queries description (devnet):

  • after the transaction is finished below, you will find the transaction hash
  • +
    Sign a message
    +
      +
    • Signing a hardcoded message
    • +
    • After signing you will see the message onece again and signature for it
    • +
    +
    Query the smart contract:
    • Smart Contract query. The Elven Tools smart contract has the 'getMintedPerAddressTotal' function
    • @@ -144,7 +156,7 @@

      Other demos:

      uiPending, updateTxHashContainer, base64ToDecimalHex, - updateQueryResultContainer, + updateOperationResultContainer, clearQrCodeContainer } from './demo-ui-tools.js' @@ -184,6 +196,9 @@

      Other demos:

      onTxError: (tx, error) => { console.log('Tx error: ', error); uiPending(false); }, onQrPending: () => { uiPending(true); }, onQrLoaded: () => { uiPending(false); }, + onSignMsgStarted: () => { uiPending(true); }, + onSignMsgFinalized: (message, messageSignature) => { messageSignature && updateOperationResultContainer(`➡️ The signature for "${message}" message:\n${messageSignature}`); uiPending(false); }, + onSignMsgError: (message, error) => { console.log('Signing message error: ', error); uiPending(false); }, } ); } @@ -253,7 +268,7 @@

      Other demos:

      const isXalias = ElvenJS.storage.get('loginMethod') === 'x-alias'; // Additional 50000 when there is an active guardian // See more about gas limit calculation here: https://docs.multiversx.com/developers/gas-and-fees/overview/ - const gasLimit = ((isGuardian || isXalias) ? 100000 : 50000) + 1500 * demoMessage.length; + const gasLimit = ((isGuardian || isXalias) ? 100000 : 50000) + 1500 * demoMessage.length; const tx = new Transaction({ nonce: ElvenJS.storage.get('nonce'), @@ -317,7 +332,7 @@

      Other demos:

      const isGuardian = ElvenJS.storage.get('activeGuardian'); // Additional 50000 when there is an active guardian // See more about gas limit calculation here: https://docs.multiversx.com/developers/gas-and-fees/overview/ - const gasLimit = isGuardian ? 14050000 : 14000000; + const gasLimit = isGuardian ? 14050000 : 14000000; const tx = contract.call({ caller: new Address(ElvenJS.storage.get('address')), @@ -342,7 +357,7 @@

      Other demos:

      // Read more about the Elven Tools Smart Contract here: https://www.elven.tools/docs/sc-endpoints.html document.getElementById('button-query').addEventListener('click', async () => { try { - updateQueryResultContainer(); + updateOperationResultContainer(); uiPending(true); const results = await ElvenJS.queryContract({ @@ -353,15 +368,27 @@

      Other demos:

      uiPending(false); - // Manual decoding of a simple type (number here), there will be additional tools for that - // For more possibilities, for now please check data converter in Buildo.dev: + // Manual decoding of a simple type (number here), there will be additional tools for that using ABI + // For now please check data converter in Buildo.dev: // https://github.com/xdevguild/buildo.dev/blob/main/components/operations/utils-operations/data-converters.tsx#L103 const hexVal = base64ToDecimalHex(results?.returnData?.[0]); let intVal = 0; if (hexVal) { intVal = parseInt(hexVal, 16); } - updateQueryResultContainer(`➡️ The result of the query is: ${intVal}`); + updateOperationResultContainer(`➡️ The result of the query is: ${intVal}`); + } catch (e) { + uiPending(false); + throw new Error(e?.message); + } + }); + + // You can sign a single message, use + // You will get a message and signature back in the ElvenJS callback function 'onSignMsgFinalized' + // In case of browser extension provider and xPortal you can also get it from ElvenJS.signMessage return + document.getElementById('button-sign-message').addEventListener('click', async () => { + try { + await ElvenJS.signMessage('Elven Family is awesome!'); } catch (e) { uiPending(false); throw new Error(e?.message); diff --git a/package-lock.json b/package-lock.json index b36e678..257beda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,34 +1,34 @@ { "name": "elven.js", - "version": "0.12.0", - "lockfileVersion": 2, + "version": "0.14.0", + "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "elven.js", - "version": "0.12.0", + "version": "0.14.0", "license": "MIT", "devDependencies": { - "@multiversx/sdk-core": "12.11.0", + "@multiversx/sdk-core": "12.14.0", "@multiversx/sdk-extension-provider": "3.0.0", "@multiversx/sdk-native-auth-client": "1.0.5", - "@multiversx/sdk-network-providers": "2.0.0", + "@multiversx/sdk-network-providers": "2.2.0", "@multiversx/sdk-wallet-connect-provider": "4.0.4", "@multiversx/sdk-web-wallet-provider": "3.1.0", - "@types/qrcode": "1.5.4", - "@types/serve-handler": "6.1.3", - "@typescript-eslint/eslint-plugin": "6.9.0", - "@typescript-eslint/parser": "6.9.0", - "esbuild": "0.19.5", - "eslint": "8.52.0", + "@types/qrcode": "1.5.5", + "@types/serve-handler": "6.1.4", + "@typescript-eslint/eslint-plugin": "6.12.0", + "@typescript-eslint/parser": "6.12.0", + "esbuild": "0.19.7", + "eslint": "8.54.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-prettier": "5.0.1", "node-stdlib-browser": "1.2.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "qrcode": "1.5.3", "rimraf": "5.0.5", "serve-handler": "6.1.5", - "typescript": "5.2.2" + "typescript": "5.3.2" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -41,9 +41,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", - "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.7.tgz", + "integrity": "sha512-YGSPnndkcLo4PmVl2tKatEn+0mlVMr3yEpOOT0BeMria87PhvoJb5dg5f5Ft9fbCVgtAz4pWMzZVgSEGpDAlww==", "cpu": [ "arm" ], @@ -57,9 +57,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", - "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.7.tgz", + "integrity": "sha512-YEDcw5IT7hW3sFKZBkCAQaOCJQLONVcD4bOyTXMZz5fr66pTHnAet46XAtbXAkJRfIn2YVhdC6R9g4xa27jQ1w==", "cpu": [ "arm64" ], @@ -73,9 +73,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", - "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.7.tgz", + "integrity": "sha512-jhINx8DEjz68cChFvM72YzrqfwJuFbfvSxZAk4bebpngGfNNRm+zRl4rtT9oAX6N9b6gBcFaJHFew5Blf6CvUw==", "cpu": [ "x64" ], @@ -89,9 +89,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", - "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.7.tgz", + "integrity": "sha512-dr81gbmWN//3ZnBIm6YNCl4p3pjnabg1/ZVOgz2fJoUO1a3mq9WQ/1iuEluMs7mCL+Zwv7AY5e3g1hjXqQZ9Iw==", "cpu": [ "arm64" ], @@ -105,9 +105,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", - "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.7.tgz", + "integrity": "sha512-Lc0q5HouGlzQEwLkgEKnWcSazqr9l9OdV2HhVasWJzLKeOt0PLhHaUHuzb8s/UIya38DJDoUm74GToZ6Wc7NGQ==", "cpu": [ "x64" ], @@ -121,9 +121,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", - "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.7.tgz", + "integrity": "sha512-+y2YsUr0CxDFF7GWiegWjGtTUF6gac2zFasfFkRJPkMAuMy9O7+2EH550VlqVdpEEchWMynkdhC9ZjtnMiHImQ==", "cpu": [ "arm64" ], @@ -137,9 +137,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", - "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.7.tgz", + "integrity": "sha512-CdXOxIbIzPJmJhrpmJTLx+o35NoiKBIgOvmvT+jeSadYiWJn0vFKsl+0bSG/5lwjNHoIDEyMYc/GAPR9jxusTA==", "cpu": [ "x64" ], @@ -153,9 +153,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", - "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.7.tgz", + "integrity": "sha512-Y+SCmWxsJOdQtjcBxoacn/pGW9HDZpwsoof0ttL+2vGcHokFlfqV666JpfLCSP2xLxFpF1lj7T3Ox3sr95YXww==", "cpu": [ "arm" ], @@ -169,9 +169,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", - "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.7.tgz", + "integrity": "sha512-inHqdOVCkUhHNvuQPT1oCB7cWz9qQ/Cz46xmVe0b7UXcuIJU3166aqSunsqkgSGMtUCWOZw3+KMwI6otINuC9g==", "cpu": [ "arm64" ], @@ -185,9 +185,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", - "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.7.tgz", + "integrity": "sha512-2BbiL7nLS5ZO96bxTQkdO0euGZIUQEUXMTrqLxKUmk/Y5pmrWU84f+CMJpM8+EHaBPfFSPnomEaQiG/+Gmh61g==", "cpu": [ "ia32" ], @@ -201,9 +201,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", - "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.7.tgz", + "integrity": "sha512-BVFQla72KXv3yyTFCQXF7MORvpTo4uTA8FVFgmwVrqbB/4DsBFWilUm1i2Oq6zN36DOZKSVUTb16jbjedhfSHw==", "cpu": [ "loong64" ], @@ -217,9 +217,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", - "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.7.tgz", + "integrity": "sha512-DzAYckIaK+pS31Q/rGpvUKu7M+5/t+jI+cdleDgUwbU7KdG2eC3SUbZHlo6Q4P1CfVKZ1lUERRFP8+q0ob9i2w==", "cpu": [ "mips64el" ], @@ -233,9 +233,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", - "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.7.tgz", + "integrity": "sha512-JQ1p0SmUteNdUaaiRtyS59GkkfTW0Edo+e0O2sihnY4FoZLz5glpWUQEKMSzMhA430ctkylkS7+vn8ziuhUugQ==", "cpu": [ "ppc64" ], @@ -249,9 +249,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", - "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.7.tgz", + "integrity": "sha512-xGwVJ7eGhkprY/nB7L7MXysHduqjpzUl40+XoYDGC4UPLbnG+gsyS1wQPJ9lFPcxYAaDXbdRXd1ACs9AE9lxuw==", "cpu": [ "riscv64" ], @@ -265,9 +265,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", - "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.7.tgz", + "integrity": "sha512-U8Rhki5PVU0L0nvk+E8FjkV8r4Lh4hVEb9duR6Zl21eIEYEwXz8RScj4LZWA2i3V70V4UHVgiqMpszXvG0Yqhg==", "cpu": [ "s390x" ], @@ -281,9 +281,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", - "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.7.tgz", + "integrity": "sha512-ZYZopyLhm4mcoZXjFt25itRlocKlcazDVkB4AhioiL9hOWhDldU9n38g62fhOI4Pth6vp+Mrd5rFKxD0/S+7aQ==", "cpu": [ "x64" ], @@ -297,9 +297,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", - "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.7.tgz", + "integrity": "sha512-/yfjlsYmT1O3cum3J6cmGG16Fd5tqKMcg5D+sBYLaOQExheAJhqr8xOAEIuLo8JYkevmjM5zFD9rVs3VBcsjtQ==", "cpu": [ "x64" ], @@ -313,9 +313,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", - "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.7.tgz", + "integrity": "sha512-MYDFyV0EW1cTP46IgUJ38OnEY5TaXxjoDmwiTXPjezahQgZd+j3T55Ht8/Q9YXBM0+T9HJygrSRGV5QNF/YVDQ==", "cpu": [ "x64" ], @@ -329,9 +329,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", - "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.7.tgz", + "integrity": "sha512-JcPvgzf2NN/y6X3UUSqP6jSS06V0DZAV/8q0PjsZyGSXsIGcG110XsdmuWiHM+pno7/mJF6fjH5/vhUz/vA9fw==", "cpu": [ "x64" ], @@ -345,9 +345,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", - "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.7.tgz", + "integrity": "sha512-ZA0KSYti5w5toax5FpmfcAgu3ZNJxYSRm0AW/Dao5up0YV1hDVof1NvwLomjEN+3/GMtaWDI+CIyJOMTRSTdMw==", "cpu": [ "arm64" ], @@ -361,9 +361,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", - "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.7.tgz", + "integrity": "sha512-CTOnijBKc5Jpk6/W9hQMMvJnsSYRYgveN6O75DTACCY18RA2nqka8dTZR+x/JqXCRiKk84+5+bRKXUSbbwsS0A==", "cpu": [ "ia32" ], @@ -377,9 +377,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", - "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.7.tgz", + "integrity": "sha512-gRaP2sk6hc98N734luX4VpF318l3w+ofrtTu9j5L8EQXF+FzQKV6alCOHMVoJJHvVK/mGbwBXfOL1HETQu9IGQ==", "cpu": [ "x64" ], @@ -417,9 +417,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -440,9 +440,9 @@ } }, "node_modules/@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -481,6 +481,12 @@ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, + "node_modules/@ioredis/commands": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz", + "integrity": "sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==", + "dev": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -526,9 +532,9 @@ } }, "node_modules/@multiversx/sdk-core": { - "version": "12.11.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.11.0.tgz", - "integrity": "sha512-rQRvjx6f1AE8TK5LObxthP7hCUCf6bc9QBAmiOJJ1Na5VS1iPhm5jDqnlCa7oieMb1HYdHQAEkoWNSsPKe/8vA==", + "version": "12.14.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.14.0.tgz", + "integrity": "sha512-Y5cSD+o//Ngj0VYgQraPWbpRFgD0W3+IeVLGGsPP2PCoojA40m4sjgDMZkNIxuvWuy5BUQyx/pGFASPFLpvpJw==", "dev": true, "dependencies": { "@multiversx/sdk-transaction-decoder": "1.0.2", @@ -560,18 +566,29 @@ } }, "node_modules/@multiversx/sdk-network-providers": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.0.0.tgz", - "integrity": "sha512-87QlwC2kaNtywDv2IVX/cavRfR4D5N7XgqOvsZTyMXRVbfWOUlDocrRr5BdvmC1gDdSOQH++nFEDHiMfnKmRng==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.2.0.tgz", + "integrity": "sha512-2n/+7Ap6S9rJGTiX38GCZ2TmY9zQ1U7o1DwnWpHNRJRxArSN/xzLrbcSKy8InMyc+4A+VHf5pV0Pk8NdPV6++w==", "dev": true, "dependencies": { - "axios": "0.24.0", + "axios": "1.6.1", "bech32": "1.1.4", "bignumber.js": "9.0.1", "buffer": "6.0.3", "json-bigint": "1.0.0" } }, + "node_modules/@multiversx/sdk-network-providers/node_modules/axios": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz", + "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==", + "dev": true, + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/@multiversx/sdk-transaction-decoder": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@multiversx/sdk-transaction-decoder/-/sdk-transaction-decoder-1.0.2.tgz", @@ -648,6 +665,313 @@ "node": ">= 8" } }, + "node_modules/@parcel/watcher": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.3.0.tgz", + "integrity": "sha512-pW7QaFiL11O0BphO+bq3MgqeX/INAk9jgBldVDYjlQPO4VddoZnF22TcF9onMhnLVHuNqBJeRf+Fj7eezi/+rQ==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "detect-libc": "^1.0.3", + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "node-addon-api": "^7.0.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "@parcel/watcher-android-arm64": "2.3.0", + "@parcel/watcher-darwin-arm64": "2.3.0", + "@parcel/watcher-darwin-x64": "2.3.0", + "@parcel/watcher-freebsd-x64": "2.3.0", + "@parcel/watcher-linux-arm-glibc": "2.3.0", + "@parcel/watcher-linux-arm64-glibc": "2.3.0", + "@parcel/watcher-linux-arm64-musl": "2.3.0", + "@parcel/watcher-linux-x64-glibc": "2.3.0", + "@parcel/watcher-linux-x64-musl": "2.3.0", + "@parcel/watcher-win32-arm64": "2.3.0", + "@parcel/watcher-win32-ia32": "2.3.0", + "@parcel/watcher-win32-x64": "2.3.0" + } + }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.3.0.tgz", + "integrity": "sha512-f4o9eA3dgk0XRT3XhB0UWpWpLnKgrh1IwNJKJ7UJek7eTYccQ8LR7XUWFKqw6aEq5KUNlCcGvSzKqSX/vtWVVA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.3.0.tgz", + "integrity": "sha512-mKY+oijI4ahBMc/GygVGvEdOq0L4DxhYgwQqYAz/7yPzuGi79oXrZG52WdpGA1wLBPrYb0T8uBaGFo7I6rvSKw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.3.0.tgz", + "integrity": "sha512-20oBj8LcEOnLE3mgpy6zuOq8AplPu9NcSSSfyVKgfOhNAc4eF4ob3ldj0xWjGGbOF7Dcy1Tvm6ytvgdjlfUeow==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.3.0.tgz", + "integrity": "sha512-7LftKlaHunueAEiojhCn+Ef2CTXWsLgTl4hq0pkhkTBFI3ssj2bJXmH2L67mKpiAD5dz66JYk4zS66qzdnIOgw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.3.0.tgz", + "integrity": "sha512-1apPw5cD2xBv1XIHPUlq0cO6iAaEUQ3BcY0ysSyD9Kuyw4MoWm1DV+W9mneWI+1g6OeP6dhikiFE6BlU+AToTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.3.0.tgz", + "integrity": "sha512-mQ0gBSQEiq1k/MMkgcSB0Ic47UORZBmWoAWlMrTW6nbAGoLZP+h7AtUM7H3oDu34TBFFvjy4JCGP43JlylkTQA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.3.0.tgz", + "integrity": "sha512-LXZAExpepJew0Gp8ZkJ+xDZaTQjLHv48h0p0Vw2VMFQ8A+RKrAvpFuPVCVwKJCr5SE+zvaG+Etg56qXvTDIedw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.3.0.tgz", + "integrity": "sha512-P7Wo91lKSeSgMTtG7CnBS6WrA5otr1K7shhSjKHNePVmfBHDoAOHYRXgUmhiNfbcGk0uMCHVcdbfxtuiZCHVow==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.3.0.tgz", + "integrity": "sha512-+kiRE1JIq8QdxzwoYY+wzBs9YbJ34guBweTK8nlzLKimn5EQ2b2FSC+tAOpq302BuIMjyuUGvBiUhEcLIGMQ5g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-wasm": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-wasm/-/watcher-wasm-2.3.0.tgz", + "integrity": "sha512-ejBAX8H0ZGsD8lSICDNyMbSEtPMWgDL0WFCt/0z7hyf5v8Imz4rAM8xY379mBsECkq/Wdqa5WEDLqtjZ+6NxfA==", + "bundleDependencies": [ + "napi-wasm" + ], + "dev": true, + "dependencies": { + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "napi-wasm": "^1.1.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.3.0.tgz", + "integrity": "sha512-35gXCnaz1AqIXpG42evcoP2+sNL62gZTMZne3IackM+6QlfMcJLy3DrjuL6Iks7Czpd3j4xRBzez3ADCj1l7Aw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.3.0.tgz", + "integrity": "sha512-FJS/IBQHhRpZ6PiCjFt1UAcPr0YmCLHRbTc00IBTrelEjlmmgIVLeOx4MSXzx2HFEy5Jo5YdhGpxCuqCyDJ5ow==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.3.0.tgz", + "integrity": "sha512-dLx+0XRdMnVI62kU3wbXvbIRhLck4aE28bIGKbRGS7BJNt54IIj9+c/Dkqb+7DJEbHUZAX1bwaoM8PqVlHJmCA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher/node_modules/node-addon-api": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.0.0.tgz", + "integrity": "sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==", + "dev": true + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -913,55 +1237,55 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.14", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, "node_modules/@types/node": { - "version": "20.8.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", - "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", + "version": "20.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.0.tgz", + "integrity": "sha512-D0WfRmU9TQ8I9PFx9Yc+EBHw+vSpIub4IDvQivcp26PtPrdMGAq5SDcpXEo/epqa/DXotVpekHiLNTg3iaKXBQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@types/qrcode": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.4.tgz", - "integrity": "sha512-ufYqUO7wUBq49hugJry+oIYKscvxIQerJSmXeny215aJKfrepN04DDZP8FCgxvV82kOqKPULCE4PIW3qUmZrRA==", + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.5.tgz", + "integrity": "sha512-CdfBi/e3Qk+3Z/fXYShipBT13OJ2fDO2Q2w5CIP5anLTLIndQG9z6P1cnm+8zCWSpm5dnxMFd/uREtb0EXuQzg==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, "node_modules/@types/serve-handler": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.3.tgz", - "integrity": "sha512-mvboyl5x5LsPPsjntm/BK/EZZqbOCITqNjOVOkl/bbB97yVmIUIyOP7+OjNj/9Iuh6hCH6RYuugPuO4avlPWcg==", + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.4.tgz", + "integrity": "sha512-aXy58tNie0NkuSCY291xUxl0X+kGYy986l4kqW6Gi4kEXgr6Tx0fpSH7YwUSa5usPpG3s9DBeIR6hHcDtL2IvQ==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", - "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz", + "integrity": "sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/type-utils": "6.9.0", - "@typescript-eslint/utils": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/type-utils": "6.12.0", + "@typescript-eslint/utils": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -987,15 +1311,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", - "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.12.0.tgz", + "integrity": "sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", "debug": "^4.3.4" }, "engines": { @@ -1015,13 +1339,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", - "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz", + "integrity": "sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0" + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1032,13 +1356,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", - "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz", + "integrity": "sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/typescript-estree": "6.12.0", + "@typescript-eslint/utils": "6.12.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -1059,9 +1383,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", - "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.12.0.tgz", + "integrity": "sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -1072,13 +1396,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", - "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz", + "integrity": "sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/visitor-keys": "6.12.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1099,17 +1423,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", - "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.12.0.tgz", + "integrity": "sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/scope-manager": "6.12.0", + "@typescript-eslint/types": "6.12.0", + "@typescript-eslint/typescript-estree": "6.12.0", "semver": "^7.5.4" }, "engines": { @@ -1124,12 +1448,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", - "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz", + "integrity": "sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/types": "6.12.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -1246,24 +1570,21 @@ } }, "node_modules/@walletconnect/keyvaluestorage": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.0.2.tgz", - "integrity": "sha512-U/nNG+VLWoPFdwwKx0oliT4ziKQCEoQ27L5Hhw8YOFGA2Po9A9pULUYNWhDgHkrb0gYDNt//X7wABcEWWBd3FQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.1.1.tgz", + "integrity": "sha512-V7ZQq2+mSxAq7MrRqDxanTzu2RcElfK1PfNYiaVnJgJ7Q7G7hTVwF8voIBx92qsRyGHZihrwNPHuZd1aKkd0rA==", "dev": true, "dependencies": { - "safe-json-utils": "^1.1.1", - "tslib": "1.14.1" + "@walletconnect/safe-json": "^1.0.1", + "idb-keyval": "^6.2.1", + "unstorage": "^1.9.0" }, "peerDependencies": { - "@react-native-async-storage/async-storage": "1.x", - "lokijs": "1.x" + "@react-native-async-storage/async-storage": "1.x" }, "peerDependenciesMeta": { "@react-native-async-storage/async-storage": { "optional": true - }, - "lokijs": { - "optional": true } } }, @@ -1452,6 +1773,39 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arch": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", + "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -1498,8 +1852,14 @@ "util": "^0.12.5" } }, - "node_modules/atomic-sleep": { - "version": "1.0.0", + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "node_modules/atomic-sleep": { + "version": "1.0.0", "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", "dev": true, @@ -1567,9 +1927,9 @@ "dev": true }, "node_modules/big-integer": { - "version": "1.6.51", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", + "version": "1.6.52", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", + "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", "dev": true, "engines": { "node": ">=0.6" @@ -1584,6 +1944,15 @@ "node": "*" } }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/blake2b": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.3.tgz", @@ -1842,6 +2211,45 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -1852,6 +2260,127 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/citty": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/citty/-/citty-0.1.5.tgz", + "integrity": "sha512-AS7n5NSc0OQVMV9v6wt3ByujNIrne0/cTjiC2MYqhvao57VNfiuVksTSr2p17nVOhEr2KtqiAkGwHcgMC/qUuQ==", + "dev": true, + "dependencies": { + "consola": "^3.2.3" + } + }, + "node_modules/clipboardy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-3.0.0.tgz", + "integrity": "sha512-Su+uU5sr1jkUy1sGRpLKjKrvEOVXgSgiSInwa/qeID6aJ07yh+5NWc3h2QfjHjBnfX4LhtFcuAWKUsJ3r+fjbg==", + "dev": true, + "dependencies": { + "arch": "^2.2.0", + "execa": "^5.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/clipboardy/node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/clipboardy/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/clipboardy/node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clipboardy/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/clipboardy/node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", @@ -1897,6 +2426,15 @@ "node": ">=8" } }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1915,12 +2453,33 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/consola": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", + "integrity": "sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==", + "dev": true, + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, "node_modules/console-browserify": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", @@ -1942,6 +2501,12 @@ "node": ">= 0.6" } }, + "node_modules/cookie-es": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.0.0.tgz", + "integrity": "sha512-mWYvfOLrfEc996hlKcdABeIiPHUPC6DM2QYZdGGOvhOTbA3tjm2eBwqlJpoFdjC89NI4Qt6h0Pu06Mp+1Pj5OQ==", + "dev": true + }, "node_modules/create-ecdh": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", @@ -2145,6 +2710,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/defu": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.3.tgz", + "integrity": "sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==", + "dev": true + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, "node_modules/des.js": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", @@ -2155,12 +2744,30 @@ "minimalistic-assert": "^1.0.0" } }, + "node_modules/destr": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.2.tgz", + "integrity": "sha512-65AlobnZMiCET00KaFFjUefxDX0khFA/E4myqZ7a6Sq1yZtR8+FVIvilVX66vF2uobSumxooYZChiRPCKNqhmg==", + "dev": true + }, "node_modules/detect-browser": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.3.0.tgz", "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==", "dev": true }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -2209,9 +2816,9 @@ } }, "node_modules/domain-browser": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.22.0.tgz", - "integrity": "sha512-IGBwjF7tNk3cwypFNH/7bfzBcgSCbaMOD3GsaY1AU/JRrnHnYgEM0+9kQt52iZxjNsjBtJYtao146V+f8jFZNw==", + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.23.0.tgz", + "integrity": "sha512-ArzcM/II1wCCujdCNyQjXrAFwS4mrLh4C7DZWlaI8mdh7h3BfKdNd3bKXITfl2PT9FtfQqaGvhi1vPRQPimjGA==", "dev": true, "engines": { "node": ">=10" @@ -2281,9 +2888,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", - "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.7.tgz", + "integrity": "sha512-6brbTZVqxhqgbpqBR5MzErImcpA0SQdoKOkcWK/U30HtQxnokIpG3TX2r0IJqbFUzqLjhU/zC1S5ndgakObVCQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -2293,28 +2900,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.5", - "@esbuild/android-arm64": "0.19.5", - "@esbuild/android-x64": "0.19.5", - "@esbuild/darwin-arm64": "0.19.5", - "@esbuild/darwin-x64": "0.19.5", - "@esbuild/freebsd-arm64": "0.19.5", - "@esbuild/freebsd-x64": "0.19.5", - "@esbuild/linux-arm": "0.19.5", - "@esbuild/linux-arm64": "0.19.5", - "@esbuild/linux-ia32": "0.19.5", - "@esbuild/linux-loong64": "0.19.5", - "@esbuild/linux-mips64el": "0.19.5", - "@esbuild/linux-ppc64": "0.19.5", - "@esbuild/linux-riscv64": "0.19.5", - "@esbuild/linux-s390x": "0.19.5", - "@esbuild/linux-x64": "0.19.5", - "@esbuild/netbsd-x64": "0.19.5", - "@esbuild/openbsd-x64": "0.19.5", - "@esbuild/sunos-x64": "0.19.5", - "@esbuild/win32-arm64": "0.19.5", - "@esbuild/win32-ia32": "0.19.5", - "@esbuild/win32-x64": "0.19.5" + "@esbuild/android-arm": "0.19.7", + "@esbuild/android-arm64": "0.19.7", + "@esbuild/android-x64": "0.19.7", + "@esbuild/darwin-arm64": "0.19.7", + "@esbuild/darwin-x64": "0.19.7", + "@esbuild/freebsd-arm64": "0.19.7", + "@esbuild/freebsd-x64": "0.19.7", + "@esbuild/linux-arm": "0.19.7", + "@esbuild/linux-arm64": "0.19.7", + "@esbuild/linux-ia32": "0.19.7", + "@esbuild/linux-loong64": "0.19.7", + "@esbuild/linux-mips64el": "0.19.7", + "@esbuild/linux-ppc64": "0.19.7", + "@esbuild/linux-riscv64": "0.19.7", + "@esbuild/linux-s390x": "0.19.7", + "@esbuild/linux-x64": "0.19.7", + "@esbuild/netbsd-x64": "0.19.7", + "@esbuild/openbsd-x64": "0.19.7", + "@esbuild/sunos-x64": "0.19.7", + "@esbuild/win32-arm64": "0.19.7", + "@esbuild/win32-ia32": "0.19.7", + "@esbuild/win32-x64": "0.19.7" } }, "node_modules/escape-string-regexp": { @@ -2330,15 +2937,15 @@ } }, "node_modules/eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.54.0", "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", @@ -2573,9 +3180,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -2689,9 +3296,9 @@ } }, "node_modules/flat-cache": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", - "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, "dependencies": { "flatted": "^3.2.9", @@ -2699,7 +3306,7 @@ "rimraf": "^3.0.2" }, "engines": { - "node": ">=12.0.0" + "node": "^10.12.0 || >=12.0.0" } }, "node_modules/flat-cache/node_modules/glob": { @@ -2788,12 +3395,40 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -2827,6 +3462,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-port-please": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.1.1.tgz", + "integrity": "sha512-3UBAyM3u4ZBVYDsxOQfJDxEa6XTbpBDrOjp4mf7ExFRt5BKs/QywQQiJsh2B+hxcZLSapWqCRvElUe8DnKcFHA==", + "dev": true + }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -2950,6 +3591,22 @@ "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true }, + "node_modules/h3": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.9.0.tgz", + "integrity": "sha512-+F3ZqrNV/CFXXfZ2lXBINHi+rM4Xw3CDC5z2CDK3NMPocjonKipGLLDSkrqY9DOrioZNPTIdDMWfQKm//3X2DA==", + "dev": true, + "dependencies": { + "cookie-es": "^1.0.0", + "defu": "^6.1.3", + "destr": "^2.0.2", + "iron-webcrypto": "^1.0.0", + "radix3": "^1.1.0", + "ufo": "^1.3.2", + "uncrypto": "^0.1.3", + "unenv": "^1.7.4" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3057,6 +3714,16 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "node_modules/http-shutdown": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/http-shutdown/-/http-shutdown-1.2.2.tgz", + "integrity": "sha512-S9wWkJ/VSY9/k4qcjG318bqJNruzE4HySUhFYknwmu6LBP97KLLfwNf+n4V1BHurvFNkSKLFnK/RsuUnRTf9Vw==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, "node_modules/https-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", @@ -3072,6 +3739,12 @@ "node": ">=14.18.0" } }, + "node_modules/idb-keyval": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.1.tgz", + "integrity": "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==", + "dev": true + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -3093,9 +3766,9 @@ ] }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true, "engines": { "node": ">= 4" @@ -3142,6 +3815,39 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/ioredis": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.2.tgz", + "integrity": "sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==", + "dev": true, + "dependencies": { + "@ioredis/commands": "^1.1.1", + "cluster-key-slot": "^1.1.0", + "debug": "^4.3.4", + "denque": "^2.1.0", + "lodash.defaults": "^4.2.0", + "lodash.isarguments": "^3.1.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0", + "standard-as-callback": "^2.1.0" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ioredis" + } + }, + "node_modules/iron-webcrypto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/iron-webcrypto/-/iron-webcrypto-1.0.0.tgz", + "integrity": "sha512-anOK1Mktt8U1Xi7fCM3RELTuYbnFikQY5VtrDj7kPgpejV7d43tWKhzgioO0zpkazLEL/j/iayRqnJhrGfqUsg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/brc-dd" + } + }, "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -3158,6 +3864,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -3381,6 +4099,15 @@ "@pkgjs/parseargs": "^0.11.0" } }, + "node_modules/jiti": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", + "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", + "dev": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -3429,6 +4156,12 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, + "node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "dev": true + }, "node_modules/keccak": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", @@ -3472,9 +4205,38 @@ "node": ">= 0.8.0" } }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "node_modules/listhen": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/listhen/-/listhen-1.5.5.tgz", + "integrity": "sha512-LXe8Xlyh3gnxdv4tSjTjscD1vpr/2PRpzq8YIaMJgyKzRG8wdISlWVWnGThJfHnlJ6hmLt2wq1yeeix0TEbuoA==", + "dev": true, + "dependencies": { + "@parcel/watcher": "^2.3.0", + "@parcel/watcher-wasm": "2.3.0", + "citty": "^0.1.4", + "clipboardy": "^3.0.0", + "consola": "^3.2.3", + "defu": "^6.1.2", + "get-port-please": "^3.1.1", + "h3": "^1.8.1", + "http-shutdown": "^1.2.2", + "jiti": "^1.20.0", + "mlly": "^1.4.2", + "node-forge": "^1.3.1", + "pathe": "^1.1.1", + "std-env": "^3.4.3", + "ufo": "^1.3.0", + "untun": "^0.1.2", + "uqr": "^0.1.2" + }, + "bin": { + "listen": "bin/listhen.mjs", + "listhen": "bin/listhen.mjs" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "dependencies": { @@ -3487,6 +4249,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", + "dev": true + }, + "node_modules/lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==", + "dev": true + }, "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", @@ -3506,9 +4280,9 @@ "dev": true }, "node_modules/lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", "dev": true, "engines": { "node": "14 || >=16.14" @@ -3572,6 +4346,18 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/mime-db": { "version": "1.33.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", @@ -3638,6 +4424,27 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mlly": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.4.2.tgz", + "integrity": "sha512-i/Ykufi2t1EZ6NaPLdfnZk2AX8cs0d+mTzVKuPfqPKPatxLApaBoxJQ9x1/uckXtrS/U5oisPMDkNs0yQTaBRg==", + "dev": true, + "dependencies": { + "acorn": "^8.10.0", + "pathe": "^1.1.1", + "pkg-types": "^1.0.3", + "ufo": "^1.3.0" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3668,10 +4475,25 @@ "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", "dev": true }, + "node_modules/node-fetch-native": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.4.1.tgz", + "integrity": "sha512-NsXBU0UgBxo2rQLOeWNZqS3fvflWePMECr8CoSWoSTqCqGbVVsvl9vZu1HfQicYN0g5piV9Gh8RTEvo/uP752w==", + "dev": true + }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dev": true, + "engines": { + "node": ">= 6.13.0" + } + }, "node_modules/node-gyp-build": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", - "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.7.1.tgz", + "integrity": "sha512-wTSrZ+8lsRRa3I3H8Xr65dLWSgCvY2l4AOnaeKdPA9TB/WYMPaTcrzf3rXvFoVvjKNVnu0CcWSx54qq9GKRUYg==", "dev": true, "bin": { "node-gyp-build": "bin.js", @@ -3741,6 +4563,15 @@ "ieee754": "^1.1.13" } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/npm-run-path": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", @@ -3820,6 +4651,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ofetch": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.3.3.tgz", + "integrity": "sha512-s1ZCMmQWXy4b5K/TW9i/DtiN8Ku+xCiHcjQ6/J/nDdssirrQNOoB165Zu8EqLMA2lln1JUth9a0aW9Ap2ctrUg==", + "dev": true, + "dependencies": { + "destr": "^2.0.1", + "node-fetch-native": "^1.4.0", + "ufo": "^1.3.0" + } + }, "node_modules/on-exit-leak-free": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz", @@ -4037,6 +4879,12 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.1.tgz", + "integrity": "sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==", + "dev": true + }, "node_modules/pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -4121,6 +4969,17 @@ "node": ">=10" } }, + "node_modules/pkg-types": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.0.3.tgz", + "integrity": "sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==", + "dev": true, + "dependencies": { + "jsonc-parser": "^3.2.0", + "mlly": "^1.2.0", + "pathe": "^1.1.0" + } + }, "node_modules/pngjs": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", @@ -4140,9 +4999,9 @@ } }, "node_modules/prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -4205,6 +5064,12 @@ "node": ">=12.0.0" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -4317,6 +5182,12 @@ "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", "dev": true }, + "node_modules/radix3": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/radix3/-/radix3-1.1.0.tgz", + "integrity": "sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==", + "dev": true + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -4359,6 +5230,18 @@ "node": ">= 6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/real-require": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz", @@ -4368,6 +5251,27 @@ "node": ">= 12.13.0" } }, + "node_modules/redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==", + "dev": true, + "dependencies": { + "redis-errors": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4600,12 +5504,6 @@ } ] }, - "node_modules/safe-json-utils": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/safe-json-utils/-/safe-json-utils-1.1.1.tgz", - "integrity": "sha512-SAJWGKDs50tAbiDXLf89PDwt9XYkWyANFWVzn4dTXl5QyI8t2o/bW5/OJl3lvc2WVU4MEpTo9Yz5NVFNsp+OJQ==", - "dev": true - }, "node_modules/safe-stable-stringify": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", @@ -4787,6 +5685,18 @@ "node": ">= 10.x" } }, + "node_modules/standard-as-callback": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz", + "integrity": "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==", + "dev": true + }, + "node_modules/std-env": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.5.0.tgz", + "integrity": "sha512-JGUEaALvL0Mf6JCfYnJOTcobY+Nc7sG/TemDRBqCA0wEr4DER7zDchaaixTlmOxAjG1uRJmX82EQcxwTQTkqVA==", + "dev": true + }, "node_modules/stream-browserify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", @@ -5093,9 +6003,9 @@ } }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", + "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5105,6 +6015,12 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", + "integrity": "sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==", + "dev": true + }, "node_modules/uint8arrays": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", @@ -5114,12 +6030,102 @@ "multiformats": "^9.4.2" } }, + "node_modules/uncrypto": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/uncrypto/-/uncrypto-0.1.3.tgz", + "integrity": "sha512-Ql87qFHB3s/De2ClA9e0gsnS6zXG27SkTiSJwjCc9MebbfapQfuPzumMIUMi38ezPZVNFcHI9sUIepeQfw8J8Q==", + "dev": true + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, + "node_modules/unenv": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-1.8.0.tgz", + "integrity": "sha512-uIGbdCWZfhRRmyKj1UioCepQ0jpq638j/Cf0xFTn4zD1nGJ2lSdzYHLzfdXN791oo/0juUiSWW1fBklXMTsuqg==", + "dev": true, + "dependencies": { + "consola": "^3.2.3", + "defu": "^6.1.3", + "mime": "^3.0.0", + "node-fetch-native": "^1.4.1", + "pathe": "^1.1.1" + } + }, + "node_modules/unstorage": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/unstorage/-/unstorage-1.10.1.tgz", + "integrity": "sha512-rWQvLRfZNBpF+x8D3/gda5nUCQL2PgXy2jNG4U7/Rc9BGEv9+CAJd0YyGCROUBKs9v49Hg8huw3aih5Bf5TAVw==", + "dev": true, + "dependencies": { + "anymatch": "^3.1.3", + "chokidar": "^3.5.3", + "destr": "^2.0.2", + "h3": "^1.8.2", + "ioredis": "^5.3.2", + "listhen": "^1.5.5", + "lru-cache": "^10.0.2", + "mri": "^1.2.0", + "node-fetch-native": "^1.4.1", + "ofetch": "^1.3.3", + "ufo": "^1.3.1" + }, + "peerDependencies": { + "@azure/app-configuration": "^1.4.1", + "@azure/cosmos": "^4.0.0", + "@azure/data-tables": "^13.2.2", + "@azure/identity": "^3.3.2", + "@azure/keyvault-secrets": "^4.7.0", + "@azure/storage-blob": "^12.16.0", + "@capacitor/preferences": "^5.0.6", + "@netlify/blobs": "^6.2.0", + "@planetscale/database": "^1.11.0", + "@upstash/redis": "^1.23.4", + "@vercel/kv": "^0.2.3", + "idb-keyval": "^6.2.1" + }, + "peerDependenciesMeta": { + "@azure/app-configuration": { + "optional": true + }, + "@azure/cosmos": { + "optional": true + }, + "@azure/data-tables": { + "optional": true + }, + "@azure/identity": { + "optional": true + }, + "@azure/keyvault-secrets": { + "optional": true + }, + "@azure/storage-blob": { + "optional": true + }, + "@capacitor/preferences": { + "optional": true + }, + "@netlify/blobs": { + "optional": true + }, + "@planetscale/database": { + "optional": true + }, + "@upstash/redis": { + "optional": true + }, + "@vercel/kv": { + "optional": true + }, + "idb-keyval": { + "optional": true + } + } + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -5129,6 +6135,26 @@ "node": ">=8" } }, + "node_modules/untun": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/untun/-/untun-0.1.2.tgz", + "integrity": "sha512-wLAMWvxfqyTiBODA1lg3IXHQtjggYLeTK7RnSfqtOXixWJ3bAa2kK/HHmOOg19upteqO3muLvN6O/icbyQY33Q==", + "dev": true, + "dependencies": { + "citty": "^0.1.3", + "consola": "^3.2.3", + "pathe": "^1.1.1" + }, + "bin": { + "untun": "bin/untun.mjs" + } + }, + "node_modules/uqr": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/uqr/-/uqr-0.1.2.tgz", + "integrity": "sha512-MJu7ypHq6QasgF5YRTjqscSzQp/W11zoUk6kvmlH+fmWEs63Y0Eib13hYFwAzagRJcVY8WVnlV+eBDUGMJ5IbA==", + "dev": true + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -5139,9 +6165,9 @@ } }, "node_modules/uri-js/node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "engines": { "node": ">=6" @@ -5498,4079 +6524,5 @@ "url": "https://github.com/sponsors/sindresorhus" } } - }, - "dependencies": { - "@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true - }, - "@esbuild/android-arm": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", - "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", - "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", - "dev": true, - "optional": true - }, - "@esbuild/android-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", - "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", - "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", - "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", - "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", - "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", - "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", - "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", - "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", - "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", - "dev": true, - "optional": true - }, - "@esbuild/linux-mips64el": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", - "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ppc64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", - "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", - "dev": true, - "optional": true - }, - "@esbuild/linux-riscv64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", - "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", - "dev": true, - "optional": true - }, - "@esbuild/linux-s390x": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", - "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", - "dev": true, - "optional": true - }, - "@esbuild/linux-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", - "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", - "dev": true, - "optional": true - }, - "@esbuild/netbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", - "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", - "dev": true, - "optional": true - }, - "@esbuild/openbsd-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", - "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", - "dev": true, - "optional": true - }, - "@esbuild/sunos-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", - "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-arm64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", - "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-ia32": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", - "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", - "dev": true, - "optional": true - }, - "@esbuild/win32-x64": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", - "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", - "dev": true, - "optional": true - }, - "@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^3.3.0" - } - }, - "@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", - "dev": true - }, - "@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - } - }, - "@eslint/js": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", - "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", - "dev": true - }, - "@humanwhocodes/config-array": { - "version": "0.11.13", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", - "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^2.0.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - } - }, - "@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true - }, - "@humanwhocodes/object-schema": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", - "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", - "dev": true - }, - "@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "requires": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true - }, - "strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "requires": { - "ansi-regex": "^6.0.1" - } - } - } - }, - "@multiversx/sdk-core": { - "version": "12.11.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-core/-/sdk-core-12.11.0.tgz", - "integrity": "sha512-rQRvjx6f1AE8TK5LObxthP7hCUCf6bc9QBAmiOJJ1Na5VS1iPhm5jDqnlCa7oieMb1HYdHQAEkoWNSsPKe/8vA==", - "dev": true, - "requires": { - "@multiversx/sdk-transaction-decoder": "1.0.2", - "bech32": "1.1.4", - "bignumber.js": "9.0.1", - "blake2b": "2.1.3", - "buffer": "6.0.3", - "json-duplicate-key-handle": "1.0.0", - "keccak": "3.0.2", - "protobufjs": "7.2.4" - } - }, - "@multiversx/sdk-extension-provider": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-extension-provider/-/sdk-extension-provider-3.0.0.tgz", - "integrity": "sha512-xNHLShzimYbMXqEJoiNyB4fNOXQUwSJCzt9FiOA4GdxucJnCgIM25mXtSj2I93cz+KD39QgRjEYep+li/lykOw==", - "dev": true, - "requires": {} - }, - "@multiversx/sdk-native-auth-client": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-native-auth-client/-/sdk-native-auth-client-1.0.5.tgz", - "integrity": "sha512-MA9KCNy2K0Irw+RMn01mxXB3Z+EcpMuUFBqr6ZhVQyxmXjujK+CHvlXH5TSADIm5Yw2SfGjFGdiqRu64lNVvuA==", - "dev": true, - "requires": { - "axios": "0.24.0" - } - }, - "@multiversx/sdk-network-providers": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-network-providers/-/sdk-network-providers-2.0.0.tgz", - "integrity": "sha512-87QlwC2kaNtywDv2IVX/cavRfR4D5N7XgqOvsZTyMXRVbfWOUlDocrRr5BdvmC1gDdSOQH++nFEDHiMfnKmRng==", - "dev": true, - "requires": { - "axios": "0.24.0", - "bech32": "1.1.4", - "bignumber.js": "9.0.1", - "buffer": "6.0.3", - "json-bigint": "1.0.0" - } - }, - "@multiversx/sdk-transaction-decoder": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-transaction-decoder/-/sdk-transaction-decoder-1.0.2.tgz", - "integrity": "sha512-j43QsKquu8N51WLmVlJ7dV2P3A1448R7/ktvl8r3i6wRMpfdtzDPNofTdHmMRT7DdQdvs4+RNgz8hVKL11Etsw==", - "dev": true, - "requires": { - "bech32": "^2.0.0" - }, - "dependencies": { - "bech32": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", - "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==", - "dev": true - } - } - }, - "@multiversx/sdk-wallet-connect-provider": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-wallet-connect-provider/-/sdk-wallet-connect-provider-4.0.4.tgz", - "integrity": "sha512-k+t/M0U1SnHsdLmcbXkoYgA5+R3KJA+h8N4uC026l1fRz8Vo7g3joQoqLi5qSanuc0S+uiInpDyIoq0fbFLUjA==", - "dev": true, - "requires": { - "@walletconnect/sign-client": "2.10.2", - "@walletconnect/utils": "2.10.2", - "bech32": "1.1.4" - } - }, - "@multiversx/sdk-web-wallet-provider": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@multiversx/sdk-web-wallet-provider/-/sdk-web-wallet-provider-3.1.0.tgz", - "integrity": "sha512-gIE7AudJl5Ax64AMAD0o6m0cVi+dI5LW2TSM5M9K7zKMWWCflhv27a2A61JkCIQ6CK5OTIkMXaFb61OzUqhplQ==", - "dev": true, - "requires": { - "qs": "6.10.3" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true - }, - "@pkgr/utils": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", - "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "fast-glob": "^3.3.0", - "is-glob": "^4.0.3", - "open": "^9.1.0", - "picocolors": "^1.0.0", - "tslib": "^2.6.0" - }, - "dependencies": { - "tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true - } - } - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", - "dev": true - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", - "dev": true - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", - "dev": true - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", - "dev": true - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "dev": true, - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", - "dev": true - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", - "dev": true - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", - "dev": true - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", - "dev": true - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", - "dev": true - }, - "@stablelib/aead": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/aead/-/aead-1.0.1.tgz", - "integrity": "sha512-q39ik6sxGHewqtO0nP4BuSe3db5G1fEJE8ukvngS2gLkBXyy6E7pLubhbYgnkDFv6V8cWaxcE4Xn0t6LWcJkyg==", - "dev": true - }, - "@stablelib/binary": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/binary/-/binary-1.0.1.tgz", - "integrity": "sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q==", - "dev": true, - "requires": { - "@stablelib/int": "^1.0.1" - } - }, - "@stablelib/bytes": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/bytes/-/bytes-1.0.1.tgz", - "integrity": "sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ==", - "dev": true - }, - "@stablelib/chacha": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/chacha/-/chacha-1.0.1.tgz", - "integrity": "sha512-Pmlrswzr0pBzDofdFuVe1q7KdsHKhhU24e8gkEwnTGOmlC7PADzLVxGdn2PoNVBBabdg0l/IfLKg6sHAbTQugg==", - "dev": true, - "requires": { - "@stablelib/binary": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/chacha20poly1305": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/chacha20poly1305/-/chacha20poly1305-1.0.1.tgz", - "integrity": "sha512-MmViqnqHd1ymwjOQfghRKw2R/jMIGT3wySN7cthjXCBdO+qErNPUBnRzqNpnvIwg7JBCg3LdeCZZO4de/yEhVA==", - "dev": true, - "requires": { - "@stablelib/aead": "^1.0.1", - "@stablelib/binary": "^1.0.1", - "@stablelib/chacha": "^1.0.1", - "@stablelib/constant-time": "^1.0.1", - "@stablelib/poly1305": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/constant-time/-/constant-time-1.0.1.tgz", - "integrity": "sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==", - "dev": true - }, - "@stablelib/ed25519": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@stablelib/ed25519/-/ed25519-1.0.3.tgz", - "integrity": "sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg==", - "dev": true, - "requires": { - "@stablelib/random": "^1.0.2", - "@stablelib/sha512": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/hash": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/hash/-/hash-1.0.1.tgz", - "integrity": "sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg==", - "dev": true - }, - "@stablelib/hkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/hkdf/-/hkdf-1.0.1.tgz", - "integrity": "sha512-SBEHYE16ZXlHuaW5RcGk533YlBj4grMeg5TooN80W3NpcHRtLZLLXvKyX0qcRFxf+BGDobJLnwkvgEwHIDBR6g==", - "dev": true, - "requires": { - "@stablelib/hash": "^1.0.1", - "@stablelib/hmac": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/hmac": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/hmac/-/hmac-1.0.1.tgz", - "integrity": "sha512-V2APD9NSnhVpV/QMYgCVMIYKiYG6LSqw1S65wxVoirhU/51ACio6D4yDVSwMzuTJXWZoVHbDdINioBwKy5kVmA==", - "dev": true, - "requires": { - "@stablelib/constant-time": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/int": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/int/-/int-1.0.1.tgz", - "integrity": "sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w==", - "dev": true - }, - "@stablelib/keyagreement": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz", - "integrity": "sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg==", - "dev": true, - "requires": { - "@stablelib/bytes": "^1.0.1" - } - }, - "@stablelib/poly1305": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/poly1305/-/poly1305-1.0.1.tgz", - "integrity": "sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA==", - "dev": true, - "requires": { - "@stablelib/constant-time": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/random": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@stablelib/random/-/random-1.0.2.tgz", - "integrity": "sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w==", - "dev": true, - "requires": { - "@stablelib/binary": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/sha256": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/sha256/-/sha256-1.0.1.tgz", - "integrity": "sha512-GIIH3e6KH+91FqGV42Kcj71Uefd/QEe7Dy42sBTeqppXV95ggCcxLTk39bEr+lZfJmp+ghsR07J++ORkRELsBQ==", - "dev": true, - "requires": { - "@stablelib/binary": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/sha512": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/sha512/-/sha512-1.0.1.tgz", - "integrity": "sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==", - "dev": true, - "requires": { - "@stablelib/binary": "^1.0.1", - "@stablelib/hash": "^1.0.1", - "@stablelib/wipe": "^1.0.1" - } - }, - "@stablelib/wipe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@stablelib/wipe/-/wipe-1.0.1.tgz", - "integrity": "sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg==", - "dev": true - }, - "@stablelib/x25519": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@stablelib/x25519/-/x25519-1.0.3.tgz", - "integrity": "sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw==", - "dev": true, - "requires": { - "@stablelib/keyagreement": "^1.0.1", - "@stablelib/random": "^1.0.2", - "@stablelib/wipe": "^1.0.1" - } - }, - "@types/json-schema": { - "version": "7.0.14", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", - "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", - "dev": true - }, - "@types/node": { - "version": "20.8.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz", - "integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==", - "dev": true, - "requires": { - "undici-types": "~5.26.4" - } - }, - "@types/qrcode": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.4.tgz", - "integrity": "sha512-ufYqUO7wUBq49hugJry+oIYKscvxIQerJSmXeny215aJKfrepN04DDZP8FCgxvV82kOqKPULCE4PIW3qUmZrRA==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", - "dev": true - }, - "@types/serve-handler": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/@types/serve-handler/-/serve-handler-6.1.3.tgz", - "integrity": "sha512-mvboyl5x5LsPPsjntm/BK/EZZqbOCITqNjOVOkl/bbB97yVmIUIyOP7+OjNj/9Iuh6hCH6RYuugPuO4avlPWcg==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@typescript-eslint/eslint-plugin": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", - "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", - "dev": true, - "requires": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/type-utils": "6.9.0", - "@typescript-eslint/utils": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - } - }, - "@typescript-eslint/parser": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz", - "integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==", - "dev": true, - "requires": { - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", - "debug": "^4.3.4" - } - }, - "@typescript-eslint/scope-manager": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", - "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", - "dev": true, - "requires": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0" - } - }, - "@typescript-eslint/type-utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", - "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", - "dev": true, - "requires": { - "@typescript-eslint/typescript-estree": "6.9.0", - "@typescript-eslint/utils": "6.9.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" - } - }, - "@typescript-eslint/types": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", - "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", - "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", - "dev": true, - "requires": { - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/visitor-keys": "6.9.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - } - }, - "@typescript-eslint/utils": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", - "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.0", - "@typescript-eslint/types": "6.9.0", - "@typescript-eslint/typescript-estree": "6.9.0", - "semver": "^7.5.4" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", - "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", - "dev": true, - "requires": { - "@typescript-eslint/types": "6.9.0", - "eslint-visitor-keys": "^3.4.1" - } - }, - "@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true - }, - "@walletconnect/core": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.10.2.tgz", - "integrity": "sha512-JQz/xp3SLEpTeRQctdck2ugSBVEpMxoSE+lFi2voJkZop1hv6P+uqr6E4PzjFluAjeAnKlT1xvra0aFWjPWVcw==", - "dev": true, - "requires": { - "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-provider": "1.0.13", - "@walletconnect/jsonrpc-types": "1.0.3", - "@walletconnect/jsonrpc-utils": "1.0.8", - "@walletconnect/jsonrpc-ws-connection": "1.0.13", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "@walletconnect/relay-api": "^1.0.9", - "@walletconnect/relay-auth": "^1.0.4", - "@walletconnect/safe-json": "^1.0.2", - "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.10.2", - "@walletconnect/utils": "2.10.2", - "events": "^3.3.0", - "lodash.isequal": "4.5.0", - "uint8arrays": "^3.1.0" - } - }, - "@walletconnect/environment": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/environment/-/environment-1.0.1.tgz", - "integrity": "sha512-T426LLZtHj8e8rYnKfzsw1aG6+M0BT1ZxayMdv/p8yM0MU+eJDISqNY3/bccxRr4LrF9csq02Rhqt08Ibl0VRg==", - "dev": true, - "requires": { - "tslib": "1.14.1" - } - }, - "@walletconnect/events": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/events/-/events-1.0.1.tgz", - "integrity": "sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ==", - "dev": true, - "requires": { - "keyvaluestorage-interface": "^1.0.0", - "tslib": "1.14.1" - } - }, - "@walletconnect/heartbeat": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.1.tgz", - "integrity": "sha512-yVzws616xsDLJxuG/28FqtZ5rzrTA4gUjdEMTbWB5Y8V1XHRmqq4efAxCw5ie7WjbXFSUyBHaWlMR+2/CpQC5Q==", - "dev": true, - "requires": { - "@walletconnect/events": "^1.0.1", - "@walletconnect/time": "^1.0.2", - "tslib": "1.14.1" - } - }, - "@walletconnect/jsonrpc-provider": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz", - "integrity": "sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g==", - "dev": true, - "requires": { - "@walletconnect/jsonrpc-utils": "^1.0.8", - "@walletconnect/safe-json": "^1.0.2", - "tslib": "1.14.1" - } - }, - "@walletconnect/jsonrpc-types": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz", - "integrity": "sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw==", - "dev": true, - "requires": { - "keyvaluestorage-interface": "^1.0.0", - "tslib": "1.14.1" - } - }, - "@walletconnect/jsonrpc-utils": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz", - "integrity": "sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw==", - "dev": true, - "requires": { - "@walletconnect/environment": "^1.0.1", - "@walletconnect/jsonrpc-types": "^1.0.3", - "tslib": "1.14.1" - } - }, - "@walletconnect/jsonrpc-ws-connection": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.13.tgz", - "integrity": "sha512-mfOM7uFH4lGtQxG+XklYuFBj6dwVvseTt5/ahOkkmpcAEgz2umuzu7fTR+h5EmjQBdrmYyEBOWADbeaFNxdySg==", - "dev": true, - "requires": { - "@walletconnect/jsonrpc-utils": "^1.0.6", - "@walletconnect/safe-json": "^1.0.2", - "events": "^3.3.0", - "tslib": "1.14.1", - "ws": "^7.5.1" - } - }, - "@walletconnect/keyvaluestorage": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.0.2.tgz", - "integrity": "sha512-U/nNG+VLWoPFdwwKx0oliT4ziKQCEoQ27L5Hhw8YOFGA2Po9A9pULUYNWhDgHkrb0gYDNt//X7wABcEWWBd3FQ==", - "dev": true, - "requires": { - "safe-json-utils": "^1.1.1", - "tslib": "1.14.1" - } - }, - "@walletconnect/logger": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/logger/-/logger-2.0.1.tgz", - "integrity": "sha512-SsTKdsgWm+oDTBeNE/zHxxr5eJfZmE9/5yp/Ku+zJtcTAjELb3DXueWkDXmE9h8uHIbJzIb5wj5lPdzyrjT6hQ==", - "dev": true, - "requires": { - "pino": "7.11.0", - "tslib": "1.14.1" - } - }, - "@walletconnect/relay-api": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", - "integrity": "sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg==", - "dev": true, - "requires": { - "@walletconnect/jsonrpc-types": "^1.0.2", - "tslib": "1.14.1" - } - }, - "@walletconnect/relay-auth": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz", - "integrity": "sha512-kKJcS6+WxYq5kshpPaxGHdwf5y98ZwbfuS4EE/NkQzqrDFm5Cj+dP8LofzWvjrrLkZq7Afy7WrQMXdLy8Sx7HQ==", - "dev": true, - "requires": { - "@stablelib/ed25519": "^1.0.2", - "@stablelib/random": "^1.0.1", - "@walletconnect/safe-json": "^1.0.1", - "@walletconnect/time": "^1.0.2", - "tslib": "1.14.1", - "uint8arrays": "^3.0.0" - } - }, - "@walletconnect/safe-json": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/safe-json/-/safe-json-1.0.2.tgz", - "integrity": "sha512-Ogb7I27kZ3LPC3ibn8ldyUr5544t3/STow9+lzz7Sfo808YD7SBWk7SAsdBFlYgP2zDRy2hS3sKRcuSRM0OTmA==", - "dev": true, - "requires": { - "tslib": "1.14.1" - } - }, - "@walletconnect/sign-client": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.10.2.tgz", - "integrity": "sha512-vviSLV3f92I0bReX+OLr1HmbH0uIzYEQQFd1MzIfDk9PkfFT/LLAHhUnDaIAMkIdippqDcJia+5QEtT4JihL3Q==", - "dev": true, - "requires": { - "@walletconnect/core": "2.10.2", - "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-utils": "1.0.8", - "@walletconnect/logger": "^2.0.1", - "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.10.2", - "@walletconnect/utils": "2.10.2", - "events": "^3.3.0" - } - }, - "@walletconnect/time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/time/-/time-1.0.2.tgz", - "integrity": "sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g==", - "dev": true, - "requires": { - "tslib": "1.14.1" - } - }, - "@walletconnect/types": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.10.2.tgz", - "integrity": "sha512-luNV+07Wdla4STi9AejseCQY31tzWKQ5a7C3zZZaRK/di+rFaAAb7YW04OP4klE7tw/mJRGPTlekZElmHxO8kQ==", - "dev": true, - "requires": { - "@walletconnect/events": "^1.0.1", - "@walletconnect/heartbeat": "1.2.1", - "@walletconnect/jsonrpc-types": "1.0.3", - "@walletconnect/keyvaluestorage": "^1.0.2", - "@walletconnect/logger": "^2.0.1", - "events": "^3.3.0" - } - }, - "@walletconnect/utils": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.10.2.tgz", - "integrity": "sha512-syxXRpc2yhSknMu3IfiBGobxOY7fLfLTJuw+ppKaeO6WUdZpIit3wfuGOcc0Ms3ZPFCrGfyGOoZsCvgdXtptRg==", - "dev": true, - "requires": { - "@stablelib/chacha20poly1305": "1.0.1", - "@stablelib/hkdf": "1.0.1", - "@stablelib/random": "^1.0.2", - "@stablelib/sha256": "1.0.1", - "@stablelib/x25519": "^1.0.3", - "@walletconnect/relay-api": "^1.0.9", - "@walletconnect/safe-json": "^1.0.2", - "@walletconnect/time": "^1.0.2", - "@walletconnect/types": "2.10.2", - "@walletconnect/window-getters": "^1.0.1", - "@walletconnect/window-metadata": "^1.0.1", - "detect-browser": "5.3.0", - "query-string": "7.1.3", - "uint8arrays": "^3.1.0" - } - }, - "@walletconnect/window-getters": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.1.tgz", - "integrity": "sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q==", - "dev": true, - "requires": { - "tslib": "1.14.1" - } - }, - "@walletconnect/window-metadata": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/window-metadata/-/window-metadata-1.0.1.tgz", - "integrity": "sha512-9koTqyGrM2cqFRW517BPY/iEtUDx2r1+Pwwu5m7sJ7ka79wi3EyqhqcICk/yDmv6jAS1rjKgTKXlEhanYjijcA==", - "dev": true, - "requires": { - "@walletconnect/window-getters": "^1.0.1", - "tslib": "1.14.1" - } - }, - "acorn": { - "version": "8.11.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", - "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", - "dev": true - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} - }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "assert": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", - "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "is-nan": "^1.3.2", - "object-is": "^1.1.5", - "object.assign": "^4.1.4", - "util": "^0.12.5" - } - }, - "atomic-sleep": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", - "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", - "dev": true - }, - "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true - }, - "axios": { - "version": "0.24.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", - "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", - "dev": true, - "requires": { - "follow-redirects": "^1.14.4" - } - }, - "backslash": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/backslash/-/backslash-0.2.0.tgz", - "integrity": "sha512-Avs+8FUZ1HF/VFP4YWwHQZSGzRPm37ukU1JQYQWijuHhtXdOuAzcZ8PcAzfIw898a8PyBzdn+RtnKA6MzW0X2A==", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true - }, - "bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "dev": true - }, - "big-integer": { - "version": "1.6.51", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", - "dev": true - }, - "bignumber.js": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz", - "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==", - "dev": true - }, - "blake2b": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/blake2b/-/blake2b-2.1.3.tgz", - "integrity": "sha512-pkDss4xFVbMb4270aCyGD3qLv92314Et+FsKzilCLxDz5DuZ2/1g3w4nmBbu6nKApPspnjG7JcwTjGZnduB1yg==", - "dev": true, - "requires": { - "blake2b-wasm": "^1.1.0", - "nanoassert": "^1.0.0" - } - }, - "blake2b-wasm": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/blake2b-wasm/-/blake2b-wasm-1.1.7.tgz", - "integrity": "sha512-oFIHvXhlz/DUgF0kq5B1CqxIDjIJwh9iDeUUGQUcvgiGz7Wdw03McEO7CfLBy7QKGdsydcMCgO9jFNBAFCtFcA==", - "dev": true, - "requires": { - "nanoassert": "^1.0.0" - } - }, - "bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "dev": true - }, - "bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "dev": true, - "requires": { - "big-integer": "^1.6.44" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "dev": true - }, - "browser-resolve": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", - "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", - "dev": true, - "requires": { - "resolve": "^1.17.0" - } - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", - "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", - "dev": true, - "requires": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz", - "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==", - "dev": true, - "requires": { - "bn.js": "^5.2.1", - "browserify-rsa": "^4.1.0", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.4", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.6", - "readable-stream": "^3.6.2", - "safe-buffer": "^5.2.1" - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", - "dev": true - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", - "dev": true - }, - "bundle-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", - "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", - "dev": true, - "requires": { - "run-applescript": "^5.0.0" - } - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", - "dev": true - }, - "call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", - "dev": true, - "requires": { - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - } - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", - "dev": true - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==", - "dev": true - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==", - "dev": true - }, - "create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", - "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", - "dev": true - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "default-browser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", - "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", - "dev": true, - "requires": { - "bundle-name": "^3.0.0", - "default-browser-id": "^3.0.0", - "execa": "^7.1.1", - "titleize": "^3.0.0" - } - }, - "default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "dev": true, - "requires": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - } - }, - "define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", - "dev": true, - "requires": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" - } - }, - "define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", - "dev": true - }, - "define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", - "dev": true, - "requires": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" - } - }, - "des.js": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", - "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "detect-browser": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.3.0.tgz", - "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "dijkstrajs": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz", - "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "domain-browser": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-4.22.0.tgz", - "integrity": "sha512-IGBwjF7tNk3cwypFNH/7bfzBcgSCbaMOD3GsaY1AU/JRrnHnYgEM0+9kQt52iZxjNsjBtJYtao146V+f8jFZNw==", - "dev": true - }, - "duplexify": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", - "integrity": "sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==", - "dev": true, - "requires": { - "end-of-stream": "^1.4.1", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1", - "stream-shift": "^1.0.0" - } - }, - "eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "encode-utf8": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/encode-utf8/-/encode-utf8-1.0.3.tgz", - "integrity": "sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw==", - "dev": true - }, - "end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "esbuild": { - "version": "0.19.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", - "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", - "dev": true, - "requires": { - "@esbuild/android-arm": "0.19.5", - "@esbuild/android-arm64": "0.19.5", - "@esbuild/android-x64": "0.19.5", - "@esbuild/darwin-arm64": "0.19.5", - "@esbuild/darwin-x64": "0.19.5", - "@esbuild/freebsd-arm64": "0.19.5", - "@esbuild/freebsd-x64": "0.19.5", - "@esbuild/linux-arm": "0.19.5", - "@esbuild/linux-arm64": "0.19.5", - "@esbuild/linux-ia32": "0.19.5", - "@esbuild/linux-loong64": "0.19.5", - "@esbuild/linux-mips64el": "0.19.5", - "@esbuild/linux-ppc64": "0.19.5", - "@esbuild/linux-riscv64": "0.19.5", - "@esbuild/linux-s390x": "0.19.5", - "@esbuild/linux-x64": "0.19.5", - "@esbuild/netbsd-x64": "0.19.5", - "@esbuild/openbsd-x64": "0.19.5", - "@esbuild/sunos-x64": "0.19.5", - "@esbuild/win32-arm64": "0.19.5", - "@esbuild/win32-ia32": "0.19.5", - "@esbuild/win32-x64": "0.19.5" - } - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "eslint": { - "version": "8.52.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", - "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.52.0", - "@humanwhocodes/config-array": "^0.11.13", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - } - }, - "eslint-config-prettier": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz", - "integrity": "sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==", - "dev": true, - "requires": {} - }, - "eslint-plugin-prettier": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", - "integrity": "sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.8.5" - } - }, - "eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true - }, - "espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dev": true, - "requires": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - } - }, - "esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - } - }, - "esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true - }, - "events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "execa": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", - "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "dependencies": { - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - } - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true - }, - "fast-glob": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", - "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "fast-redact": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.3.0.tgz", - "integrity": "sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ==", - "dev": true - }, - "fast-url-parser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", - "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", - "dev": true, - "requires": { - "punycode": "^1.3.2" - } - }, - "fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "filter-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", - "integrity": "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==", - "dev": true - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat-cache": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", - "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==", - "dev": true, - "requires": { - "flatted": "^3.2.9", - "keyv": "^4.5.3", - "rimraf": "^3.0.2" - }, - "dependencies": { - "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "flatted": { - "version": "3.2.9", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz", - "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==", - "dev": true - }, - "follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", - "dev": true - }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "requires": { - "is-callable": "^1.1.3" - } - }, - "foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", - "dev": true, - "requires": { - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - } - }, - "get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true - }, - "glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", - "dev": true, - "requires": { - "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, - "glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } - }, - "globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, - "gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.3" - } - }, - "graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", - "dev": true, - "requires": { - "get-intrinsic": "^1.2.2" - } - }, - "has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", - "dev": true, - "requires": { - "function-bind": "^1.1.2" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", - "dev": true - }, - "human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "dev": true - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true - }, - "ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true - }, - "is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dev": true, - "requires": { - "hasown": "^2.0.0" - } - }, - "is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", - "dev": true, - "requires": { - "is-docker": "^3.0.0" - } - }, - "is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - }, - "is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true - }, - "is-typed-array": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", - "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", - "dev": true, - "requires": { - "which-typed-array": "^1.1.11" - } - }, - "is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "requires": { - "is-docker": "^2.0.0" - }, - "dependencies": { - "is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true - } - } - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "isomorphic-timers-promises": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-timers-promises/-/isomorphic-timers-promises-1.0.1.tgz", - "integrity": "sha512-u4sej9B1LPSxTGKB/HiuzvEQnXH0ECYkSVQU39koSwmFAxhlEAFl9RdTvLv4TOTQUgBS5O3O5fwUxk6byBZ+IQ==", - "dev": true - }, - "jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", - "dev": true, - "requires": { - "@isaacs/cliui": "^8.0.2", - "@pkgjs/parseargs": "^0.11.0" - } - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "dev": true, - "requires": { - "bignumber.js": "^9.0.0" - } - }, - "json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true - }, - "json-duplicate-key-handle": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-duplicate-key-handle/-/json-duplicate-key-handle-1.0.0.tgz", - "integrity": "sha512-OLIxL+UpfwUsqcLX3i6Z51ChTou/Vje+6bSeGUSubj96dF/SfjObDprLy++ZXYH07KITuEzsXS7PX7e/BGf4jw==", - "dev": true, - "requires": { - "backslash": "^0.2.0" - } - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "keccak": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", - "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", - "dev": true, - "requires": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - } - }, - "keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dev": true, - "requires": { - "json-buffer": "3.0.1" - } - }, - "keyvaluestorage-interface": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", - "integrity": "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==", - "dev": true - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", - "dev": true - }, - "lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "dev": true - }, - "lru-cache": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", - "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", - "dev": true - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", - "dev": true - }, - "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", - "dev": true, - "requires": { - "mime-db": "~1.33.0" - } - }, - "mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "dev": true - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "dev": true - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "multiformats": { - "version": "9.9.0", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", - "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==", - "dev": true - }, - "nanoassert": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz", - "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", - "dev": true - }, - "node-gyp-build": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", - "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", - "dev": true - }, - "node-stdlib-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/node-stdlib-browser/-/node-stdlib-browser-1.2.0.tgz", - "integrity": "sha512-VSjFxUhRhkyed8AtLwSCkMrJRfQ3e2lGtG3sP6FEgaLKBBbxM/dLfjRe1+iLhjvyLFW3tBQ8+c0pcOtXGbAZJg==", - "dev": true, - "requires": { - "assert": "^2.0.0", - "browser-resolve": "^2.0.0", - "browserify-zlib": "^0.2.0", - "buffer": "^5.7.1", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "create-require": "^1.1.1", - "crypto-browserify": "^3.11.0", - "domain-browser": "^4.22.0", - "events": "^3.0.0", - "https-browserify": "^1.0.0", - "isomorphic-timers-promises": "^1.0.1", - "os-browserify": "^0.3.0", - "path-browserify": "^1.0.1", - "pkg-dir": "^5.0.0", - "process": "^0.11.10", - "punycode": "^1.4.1", - "querystring-es3": "^0.2.1", - "readable-stream": "^3.6.0", - "stream-browserify": "^3.0.0", - "stream-http": "^3.2.0", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.1", - "url": "^0.11.0", - "util": "^0.12.4", - "vm-browserify": "^1.0.1" - }, - "dependencies": { - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - } - } - }, - "npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "requires": { - "path-key": "^4.0.0" - }, - "dependencies": { - "path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true - } - } - }, - "object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", - "dev": true - }, - "object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", - "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - } - }, - "on-exit-leak-free": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz", - "integrity": "sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "requires": { - "mimic-fn": "^4.0.0" - } - }, - "open": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", - "dev": true, - "requires": { - "default-browser": "^4.0.0", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^2.2.0" - } - }, - "optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", - "dev": true, - "requires": { - "@aashutoshrathi/word-wrap": "^1.2.3", - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dev": true, - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", - "dev": true, - "requires": { - "lru-cache": "^9.1.1 || ^10.0.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - } - }, - "path-to-regexp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz", - "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==", - "dev": true - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "pino": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/pino/-/pino-7.11.0.tgz", - "integrity": "sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg==", - "dev": true, - "requires": { - "atomic-sleep": "^1.0.0", - "fast-redact": "^3.0.0", - "on-exit-leak-free": "^0.2.0", - "pino-abstract-transport": "v0.5.0", - "pino-std-serializers": "^4.0.0", - "process-warning": "^1.0.0", - "quick-format-unescaped": "^4.0.3", - "real-require": "^0.1.0", - "safe-stable-stringify": "^2.1.0", - "sonic-boom": "^2.2.1", - "thread-stream": "^0.15.1" - } - }, - "pino-abstract-transport": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz", - "integrity": "sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ==", - "dev": true, - "requires": { - "duplexify": "^4.1.2", - "split2": "^4.0.0" - } - }, - "pino-std-serializers": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz", - "integrity": "sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q==", - "dev": true - }, - "pkg-dir": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", - "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", - "dev": true, - "requires": { - "find-up": "^5.0.0" - } - }, - "pngjs": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", - "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", - "dev": true - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "prettier": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", - "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", - "dev": true - }, - "prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "dev": true - }, - "process-warning": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz", - "integrity": "sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==", - "dev": true - }, - "protobufjs": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", - "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", - "dev": true, - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - } - }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", - "dev": true - }, - "qrcode": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.3.tgz", - "integrity": "sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg==", - "dev": true, - "requires": { - "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - } - }, - "qs": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", - "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - }, - "query-string": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", - "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==", - "dev": true, - "requires": { - "decode-uri-component": "^0.2.2", - "filter-obj": "^1.1.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - } - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==", - "dev": true - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true - }, - "quick-format-unescaped": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", - "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==", - "dev": true - }, - "readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "real-require": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.1.0.tgz", - "integrity": "sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg==", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "requires": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "rimraf": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.5.tgz", - "integrity": "sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A==", - "dev": true, - "requires": { - "glob": "^10.3.7" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "run-applescript": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", - "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", - "dev": true, - "requires": { - "execa": "^5.0.0" - }, - "dependencies": { - "execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - } - }, - "human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true - }, - "is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true - }, - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true - }, - "npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "requires": { - "path-key": "^3.0.0" - } - }, - "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true - } - } - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "safe-json-utils": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/safe-json-utils/-/safe-json-utils-1.1.1.tgz", - "integrity": "sha512-SAJWGKDs50tAbiDXLf89PDwt9XYkWyANFWVzn4dTXl5QyI8t2o/bW5/OJl3lvc2WVU4MEpTo9Yz5NVFNsp+OJQ==", - "dev": true - }, - "safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", - "dev": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - } - } - }, - "serve-handler": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", - "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", - "dev": true, - "requires": { - "bytes": "3.0.0", - "content-disposition": "0.5.2", - "fast-url-parser": "1.1.3", - "mime-types": "2.1.18", - "minimatch": "3.1.2", - "path-is-inside": "1.0.2", - "path-to-regexp": "2.2.1", - "range-parser": "1.2.0" - } - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true - }, - "set-function-length": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", - "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==", - "dev": true, - "requires": { - "define-data-property": "^1.1.1", - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" - } - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "dev": true - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true - }, - "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "sonic-boom": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-2.8.0.tgz", - "integrity": "sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg==", - "dev": true, - "requires": { - "atomic-sleep": "^1.0.0" - } - }, - "split-on-first": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", - "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", - "dev": true - }, - "split2": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", - "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", - "dev": true - }, - "stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "dev": true, - "requires": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } - }, - "stream-http": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", - "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" - } - }, - "stream-shift": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", - "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", - "dev": true - }, - "strict-uri-encode": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", - "integrity": "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==", - "dev": true - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "requires": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true - }, - "strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "requires": { - "ansi-regex": "^6.0.1" - } - } - } - }, - "string-width-cjs": { - "version": "npm:string-width@4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - } - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-ansi-cjs": { - "version": "npm:strip-ansi@6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true - }, - "synckit": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz", - "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==", - "dev": true, - "requires": { - "@pkgr/utils": "^2.3.1", - "tslib": "^2.5.0" - }, - "dependencies": { - "tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true - } - } - }, - "text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "thread-stream": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-0.15.2.tgz", - "integrity": "sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA==", - "dev": true, - "requires": { - "real-require": "^0.1.0" - } - }, - "timers-browserify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", - "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", - "dev": true, - "requires": { - "setimmediate": "^1.0.4" - } - }, - "titleize": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", - "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "ts-api-utils": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", - "dev": true, - "requires": {} - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", - "dev": true - }, - "uint8arrays": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz", - "integrity": "sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==", - "dev": true, - "requires": { - "multiformats": "^9.4.2" - } - }, - "undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true - }, - "untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true - }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true - } - } - }, - "url": { - "version": "0.11.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", - "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", - "dev": true, - "requires": { - "punycode": "^1.4.1", - "qs": "^6.11.2" - }, - "dependencies": { - "qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - } - } - }, - "util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", - "dev": true - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", - "dev": true - }, - "which-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.13.tgz", - "integrity": "sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.4", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - } - }, - "wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "requires": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true - }, - "ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true - }, - "strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "requires": { - "ansi-regex": "^6.0.1" - } - } - } - }, - "wrap-ansi-cjs": { - "version": "npm:wrap-ansi@7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, - "requires": {} - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true - }, - "y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "dependencies": { - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - } - } - }, - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } } } diff --git a/package.json b/package.json index 243bbf4..843d095 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elven.js", - "version": "0.13.0", + "version": "0.14.0", "description": "Authenticate, sign and send transactions on the MultiversX blockchain in the browser.", "type": "module", "module": "build/elven.js", @@ -14,6 +14,7 @@ }, "./package.json": "./package.json" }, + "sideEffects": false, "author": "Julian Ćwirko ", "license": "MIT", "homepage": "https://www.elvenjs.com", @@ -40,25 +41,25 @@ "prepublishOnly": "npm run build" }, "devDependencies": { - "@multiversx/sdk-core": "12.11.0", + "@multiversx/sdk-core": "12.14.0", "@multiversx/sdk-extension-provider": "3.0.0", "@multiversx/sdk-native-auth-client": "1.0.5", - "@multiversx/sdk-network-providers": "2.0.0", + "@multiversx/sdk-network-providers": "2.2.0", "@multiversx/sdk-wallet-connect-provider": "4.0.4", "@multiversx/sdk-web-wallet-provider": "3.1.0", - "@types/qrcode": "1.5.4", - "@types/serve-handler": "6.1.3", - "@typescript-eslint/eslint-plugin": "6.9.0", - "@typescript-eslint/parser": "6.9.0", - "esbuild": "0.19.5", - "eslint": "8.52.0", + "@types/qrcode": "1.5.5", + "@types/serve-handler": "6.1.4", + "@typescript-eslint/eslint-plugin": "6.12.0", + "@typescript-eslint/parser": "6.12.0", + "esbuild": "0.19.7", + "eslint": "8.54.0", "eslint-config-prettier": "9.0.0", "eslint-plugin-prettier": "5.0.1", "node-stdlib-browser": "1.2.0", - "prettier": "3.0.3", + "prettier": "3.1.0", "qrcode": "1.5.3", "rimraf": "5.0.5", "serve-handler": "6.1.5", - "typescript": "5.2.2" + "typescript": "5.3.2" } } diff --git a/src/elven.ts b/src/elven.ts index b6a01e8..067c6b9 100644 --- a/src/elven.ts +++ b/src/elven.ts @@ -8,6 +8,7 @@ export { TransactionPayload } from '@multiversx/sdk-core/out/transactionPayload' export { TransactionWatcher } from '@multiversx/sdk-core/out/transactionWatcher'; export { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract'; export { ContractFunction } from '@multiversx/sdk-core/out/smartcontracts/function'; +export { SignableMessage } from '@multiversx/sdk-core/out/signableMessage'; export { BytesType, BytesValue, diff --git a/src/interaction/web-wallet-sign-message-finalize.ts b/src/interaction/web-wallet-sign-message-finalize.ts new file mode 100644 index 0000000..c08bc98 --- /dev/null +++ b/src/interaction/web-wallet-sign-message-finalize.ts @@ -0,0 +1,15 @@ +import { EventsStore } from '../events-store'; +import { EventStoreEvents } from '../types'; +import { getParamFromUrl } from '../utils/get-param-from-url'; + +export const webWalletSignMessageFinalize = () => { + const isNotTransaction = !getParamFromUrl('walletProviderStatus'); + const isSigned = getParamFromUrl('status') === 'signed'; + const message = getParamFromUrl('message'); + const signature = getParamFromUrl('signature'); + + if (isNotTransaction && isSigned && message && signature) { + EventsStore.run(EventStoreEvents.onSignMsgFinalized, message, signature); + window.history.replaceState(null, '', window.location.pathname); + } +}; diff --git a/src/main.ts b/src/main.ts index e8e17e9..300762a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import { ExtensionProvider } from '@multiversx/sdk-extension-provider/out/extens import { WalletConnectV2Provider } from '@multiversx/sdk-wallet-connect-provider/out/walletConnectV2Provider'; import { WalletProvider } from '@multiversx/sdk-web-wallet-provider/out/walletProvider'; import { NativeAuthClient } from '@multiversx/sdk-native-auth-client/lib/src/native.auth.client'; +import { SignableMessage } from '@multiversx/sdk-core/out/signableMessage'; import { initMobileProvider } from './auth/init-mobile-provider'; import { ls } from './utils/ls-helpers'; import { ApiNetworkProvider, SmartContractQueryArgs } from './network-provider'; @@ -38,6 +39,7 @@ import { sendTxToGuardian, } from './interaction/guardian-operations'; import { preSendTx } from './interaction/pre-send-tx'; +import { webWalletSignMessageFinalize } from './interaction/web-wallet-sign-message-finalize'; export class ElvenJS { private static initOptions: InitOptions | undefined; @@ -106,6 +108,24 @@ export class ElvenJS { if (this.initOptions.onTxError) { EventsStore.set(EventStoreEvents.onTxError, this.initOptions.onTxError); } + if (this.initOptions.onSignMsgStarted) { + EventsStore.set( + EventStoreEvents.onSignMsgStarted, + this.initOptions.onSignMsgStarted + ); + } + if (this.initOptions.onSignMsgFinalized) { + EventsStore.set( + EventStoreEvents.onSignMsgFinalized, + this.initOptions.onSignMsgFinalized + ); + } + if (this.initOptions.onSignMsgError) { + EventsStore.set( + EventStoreEvents.onSignMsgError, + this.initOptions.onSignMsgError + ); + } const isAddress = state?.address || @@ -146,9 +166,9 @@ export class ElvenJS { EventsStore.run(EventStoreEvents.onLoggedIn); // After successful web wallet transaction (or guarded transaction that use web wallet 2FA hook) we will land back on our website - // We need to get params from callback url and finalize the transaction - // It will only trigger when there is a WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED in url params if (this.initOptions?.chainType) { + // We need to get params from callback url and finalize the transaction + // It will only trigger when there is a WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED in url params await webWalletTxFinalize( this.dappProvider, this.networkProvider, @@ -159,6 +179,9 @@ export class ElvenJS { ], state.nonce ); + + // We need to get the signature in case of signing a message with web wallet or guardians 2FA hook + webWalletSignMessageFinalize(); } } } @@ -322,6 +345,77 @@ export class ElvenJS { return signedTx; } + /** + * Sign a single message + */ + static async signMessage( + message: string, + options?: { callbackUrl?: string } + ) { + if (!this.dappProvider) { + throw new Error( + 'Error: Message signing failed: There is no active session!' + ); + } + if (!this.networkProvider) { + throw new Error( + 'Error: Message signing failed: There is no active network provider!' + ); + } + + let messageSignature = ''; + + try { + EventsStore.run(EventStoreEvents.onSignMsgStarted, message); + + if (this.dappProvider instanceof ExtensionProvider) { + const signedMessage = await this.dappProvider.signMessage( + new SignableMessage({ message: Buffer.from(message) }) + ); + + messageSignature = signedMessage.getSignature().toString('hex'); + } + if (this.dappProvider instanceof WalletConnectV2Provider) { + const signedMessage = await this.dappProvider.signMessage( + new SignableMessage({ message: Buffer.from(message) }) + ); + + messageSignature = signedMessage.getSignature().toString('hex'); + } + if (this.dappProvider instanceof WalletProvider) { + const encodeRFC3986URIComponent = (str: string) => { + return encodeURIComponent(str).replace( + /[!'()*]/g, + (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}` + ); + }; + + const url = options?.callbackUrl || window.location.origin; + await this.dappProvider.signMessage( + new SignableMessage({ message: Buffer.from(message) }), + { + callbackUrl: encodeURIComponent( + `${url}${ + url.includes('?') ? '&' : '?' + }message=${encodeRFC3986URIComponent(message)}` + ), + } + ); + } + + EventsStore.run( + EventStoreEvents.onSignMsgFinalized, + message, + messageSignature + ); + return { message, messageSignature }; + } catch (e) { + const err = errorParse(e); + EventsStore.run(EventStoreEvents.onSignMsgError, message, err); + throw new Error(`Error: Message signing failed! ${err}`); + } + } + /** * Query Smart Contracts */ diff --git a/src/types.ts b/src/types.ts index 7225a63..e8333e3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,6 +18,9 @@ export interface InitOptions { onTxSent?: (transaction: Transaction) => void; onTxFinalized?: (transaction: Transaction) => void; onTxError?: (transaction: Transaction, error: string) => void; + onSignMsgStarted?: (message: string) => void; + onSignMsgFinalized?: (messageSignature: string) => void; + onSignMsgError?: (message: string, error: string) => void; } export enum LoginMethodsEnum { @@ -54,6 +57,9 @@ export enum EventStoreEvents { onTxSent = 'onTxSent', onTxFinalized = 'onTxFinalized', onTxError = 'onTxError', + onSignMsgStarted = 'onSignMsgStarted', + onSignMsgFinalized = 'onSignMsgFinalized', + onSignMsgError = 'onSignMsgError', } export enum WebWalletUrlParamsEnum {