From 1a23bea061c864cd26d016198440c302e33661f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20=C4=86wirko?= Date: Wed, 1 Mar 2023 23:10:49 +0100 Subject: [PATCH] update changelog and demo info --- CHANGELOG.md | 3 +- build/elven.js | 28 +- esbuild.config.cjs | 2 + example/elven.js | 28 +- example/index.html | 3 + package-lock.json | 813 +++++++++++++++++++++------------------------ 6 files changed, 412 insertions(+), 465 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9db77..c2b662d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ -### [0.8.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.8.0) (2023-03-...) +### [0.8.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.8.0) (2023-03-01) - WalletConnect 2 integration through a new version of `@elrondnetwork/erdjs-wallet-connect-provider` - lets you use 'xPortal Login'. - two new callbacks: `onQrPending` and `onQrLoaded` - usefull when waiting for the QR and WalletConnect Pairings list, but it shouldn't take much time to load +- minor improvements ### [0.7.0](https://github.com/juliancwirko/elven.js/releases/tag/v0.7.0) (2023-01-14) - rebrand to multiversx (continuation) diff --git a/build/elven.js b/build/elven.js index 70da62a..b155be7 100644 --- a/build/elven.js +++ b/build/elven.js @@ -1,12 +1,12 @@ -var E8=Object.create;var Ku=Object.defineProperty,A8=Object.defineProperties,I8=Object.getOwnPropertyDescriptor,_8=Object.getOwnPropertyDescriptors,b8=Object.getOwnPropertyNames,TE=Object.getOwnPropertySymbols,C8=Object.getPrototypeOf,DE=Object.prototype.hasOwnProperty,S8=Object.prototype.propertyIsEnumerable;var NE=(r,e,t)=>e in r?Ku(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_o=(r,e)=>{for(var t in e||={})DE.call(e,t)&&NE(r,t,e[t]);if(TE)for(var t of TE(e))S8.call(e,t)&&NE(r,t,e[t]);return r},OE=(r,e)=>A8(r,_8(e));var PE=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var me=(r,e)=>()=>(r&&(e=r(r=0)),e);var B=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ot=(r,e)=>{for(var t in e)Ku(r,t,{get:e[t],enumerable:!0})},Ll=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b8(e))!DE.call(r,n)&&n!==t&&Ku(r,n,{get:()=>e[n],enumerable:!(i=I8(e,n))||i.enumerable});return r},er=(r,e,t)=>(Ll(r,e,"default"),t&&Ll(t,e,"default")),_e=(r,e,t)=>(t=r!=null?E8(C8(r)):{},Ll(e||!r||!r.__esModule?Ku(t,"default",{value:r,enumerable:!0}):t,r)),at=r=>Ll(Ku({},"__esModule",{value:!0}),r);var Te=(r,e,t)=>new Promise((i,n)=>{var s=u=>{try{a(t.next(u))}catch(h){n(h)}},o=u=>{try{a(t.throw(u))}catch(h){n(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);a((t=t.apply(r,e)).next())});var y0=B(Fl=>{"use strict";f();Fl.byteLength=T8;Fl.toByteArray=D8;Fl.fromByteArray=B8;var ii=[],xr=[],x8=typeof Uint8Array<"u"?Uint8Array:Array,g0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(cs=0,BE=g0.length;cs0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function T8(r){var e=ME(r),t=e[0],i=e[1];return(t+i)*3/4-i}function N8(r,e,t){return(e+t)*3/4-t}function D8(r){var e,t=ME(r),i=t[0],n=t[1],s=new x8(N8(r,i,n)),o=0,a=n>0?i-4:i,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=xr[r.charCodeAt(u)]<<2|xr[r.charCodeAt(u+1)]>>4,s[o++]=e&255),n===1&&(e=xr[r.charCodeAt(u)]<<10|xr[r.charCodeAt(u+1)]<<4|xr[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function O8(r){return ii[r>>18&63]+ii[r>>12&63]+ii[r>>6&63]+ii[r&63]}function P8(r,e,t){for(var i,n=[],s=e;sa?a:o+s));return i===1?(e=r[t-1],n.push(ii[e>>2]+ii[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ii[e>>10]+ii[e>>4&63]+ii[e<<2&63]+"=")),n.join("")}});var w0=B(m0=>{f();m0.read=function(r,e,t,i,n){var s,o,a=n*8-i-1,u=(1<>1,p=-7,w=t?n-1:0,N=t?-1:1,O=r[e+w];for(w+=N,s=O&(1<<-p)-1,O>>=-p,p+=a;p>0;s=s*256+r[e+w],w+=N,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+r[e+w],w+=N,p-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(O?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-h}return(O?-1:1)*o*Math.pow(2,s-i)};m0.write=function(r,e,t,i,n,s){var o,a,u,h=s*8-n-1,p=(1<>1,N=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=i?0:s-1,T=i?1:-1,V=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+w>=1?e+=N/u:e+=N*Math.pow(2,1-w),e*u>=2&&(o++,u/=2),o+w>=p?(a=0,o=p):o+w>=1?(a=(e*u-1)*Math.pow(2,n),o=o+w):(a=e*Math.pow(2,w-1)*Math.pow(2,n),o=0));n>=8;r[t+O]=a&255,O+=T,a/=256,n-=8);for(o=o<0;r[t+O]=o&255,O+=T,o/=256,h-=8);r[t+O-T]|=V*128}});var kE=B(Co=>{"use strict";f();var v0=y0(),bo=w0(),RE=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Co.Buffer=oe;Co.SlowBuffer=q8;Co.INSPECT_MAX_BYTES=50;var Ul=2147483647;Co.kMaxLength=Ul;oe.TYPED_ARRAY_SUPPORT=M8();!oe.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 M8(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(oe.prototype,"parent",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.buffer}});Object.defineProperty(oe.prototype,"offset",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.byteOffset}});function Hi(r){if(r>Ul)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,oe.prototype),e}function oe(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _0(r)}return UE(r,e,t)}oe.poolSize=8192;function UE(r,e,t){if(typeof r=="string")return L8(r,e);if(ArrayBuffer.isView(r))return F8(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(ni(r,ArrayBuffer)||r&&ni(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ni(r,SharedArrayBuffer)||r&&ni(r.buffer,SharedArrayBuffer)))return A0(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return oe.from(i,e,t);var n=U8(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return oe.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}oe.from=function(r,e,t){return UE(r,e,t)};Object.setPrototypeOf(oe.prototype,Uint8Array.prototype);Object.setPrototypeOf(oe,Uint8Array);function qE(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function R8(r,e,t){return qE(r),r<=0?Hi(r):e!==void 0?typeof t=="string"?Hi(r).fill(e,t):Hi(r).fill(e):Hi(r)}oe.alloc=function(r,e,t){return R8(r,e,t)};function _0(r){return qE(r),Hi(r<0?0:b0(r)|0)}oe.allocUnsafe=function(r){return _0(r)};oe.allocUnsafeSlow=function(r){return _0(r)};function L8(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!oe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=VE(r,e)|0,i=Hi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function E0(r){for(var e=r.length<0?0:b0(r.length)|0,t=Hi(e),i=0;i=Ul)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ul.toString(16)+" bytes");return r|0}function q8(r){return+r!=r&&(r=0),oe.alloc(+r)}oe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==oe.prototype};oe.compare=function(e,t){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),ni(t,Uint8Array)&&(t=oe.from(t,t.offset,t.byteLength)),!oe.isBuffer(e)||!oe.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);sn.length?oe.from(o).copy(n,s):Uint8Array.prototype.set.call(n,o,s);else if(oe.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function VE(r,e){if(oe.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||ni(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return I0(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return zE(r).length;default:if(n)return i?-1:I0(r).length;e=(""+e).toLowerCase(),n=!0}}oe.byteLength=VE;function V8(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Y8(this,e,t);case"utf8":case"utf-8":return QE(this,e,t);case"ascii":return W8(this,e,t);case"latin1":case"binary":return $8(this,e,t);case"base64":return z8(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J8(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}oe.prototype._isBuffer=!0;function ls(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}oe.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 t=0;tt&&(e+=" ... "),""};RE&&(oe.prototype[RE]=oe.prototype.inspect);oe.prototype.compare=function(e,t,i,n,s){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),!oe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i),w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,C0(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=oe.from(e,i)),oe.isBuffer(e))return e.length===0?-1:LE(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):LE(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function LE(r,e,t,i,n){var s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(O,T){return s===1?O[T]:O.readUInt16BE(T*s)}var h;if(n){var p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){for(var w=!0,N=0;Nn&&(i=n)):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return H8(this,e,t,i);case"utf8":case"utf-8":return Q8(this,e,t,i);case"ascii":case"latin1":case"binary":return j8(this,e,t,i);case"base64":return G8(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K8(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};oe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function z8(r,e,t){return e===0&&t===r.length?v0.fromByteArray(r):v0.fromByteArray(r.slice(e,t))}function QE(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+a<=t){var u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return k8(i)}var FE=4096;function k8(r){var e=r.length;if(e<=FE)return String.fromCharCode.apply(String,r);for(var t="",i=0;ii)&&(t=i);for(var n="",s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}oe.prototype.readUintLE=oe.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n};oe.prototype.readUint8=oe.prototype.readUInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]};oe.prototype.readUint16LE=oe.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]|this[e+1]<<8};oe.prototype.readUint16BE=oe.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]<<8|this[e+1]};oe.prototype.readUint32LE=oe.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};oe.prototype.readUint32BE=oe.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};oe.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o=s&&(n-=Math.pow(2,8*t)),n};oe.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=t,s=1,o=this[e+--n];n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};oe.prototype.readInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};oe.prototype.readInt16LE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt16BE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};oe.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};oe.prototype.readFloatLE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),bo.read(this,e,!0,23,4)};oe.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),bo.read(this,e,!1,23,4)};oe.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),bo.read(this,e,!0,52,8)};oe.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),bo.read(this,e,!1,52,8)};function pr(r,e,t,i,n,s){if(!oe.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}oe.prototype.writeUintLE=oe.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=1,a=0;for(this[t]=e&255;++a>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};oe.prototype.writeUint8=oe.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,255,0),this[t]=e&255,t+1};oe.prototype.writeUint16LE=oe.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeUint16BE=oe.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeUint32LE=oe.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};oe.prototype.writeUint32BE=oe.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};oe.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=0,a=1,u=0;for(this[t]=e&255;++o>0)-u&255;return t+i};oe.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};oe.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};oe.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};oe.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function jE(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function GE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,4,34028234663852886e22,-34028234663852886e22),bo.write(r,e,t,i,23,4),t+4}oe.prototype.writeFloatLE=function(e,t,i){return GE(this,e,t,!0,i)};oe.prototype.writeFloatBE=function(e,t,i){return GE(this,e,t,!1,i)};function KE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,8,17976931348623157e292,-17976931348623157e292),bo.write(r,e,t,i,52,8),t+8}oe.prototype.writeDoubleLE=function(e,t,i){return KE(this,e,t,!0,i)};oe.prototype.writeDoubleBE=function(e,t,i){return KE(this,e,t,!1,i)};oe.prototype.copy=function(e,t,i,n){if(!oe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function eP(r){for(var e=[],t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function zE(r){return v0.toByteArray(Z8(r))}function ql(r,e,t,i){for(var n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ni(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function C0(r){return r!==r}var rP=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)e[i+n]=r[t]+r[n];return e}()});var XE=B((cz,JE)=>{f();var dt=JE.exports={},si,oi;function S0(){throw new Error("setTimeout has not been defined")}function x0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?si=setTimeout:si=S0}catch{si=S0}try{typeof clearTimeout=="function"?oi=clearTimeout:oi=x0}catch{oi=x0}})();function WE(r){if(si===setTimeout)return setTimeout(r,0);if((si===S0||!si)&&setTimeout)return si=setTimeout,setTimeout(r,0);try{return si(r,0)}catch{try{return si.call(null,r,0)}catch{return si.call(this,r,0)}}}function iP(r){if(oi===clearTimeout)return clearTimeout(r);if((oi===x0||!oi)&&clearTimeout)return oi=clearTimeout,clearTimeout(r);try{return oi(r)}catch{try{return oi.call(null,r)}catch{return oi.call(this,r)}}}var Qi=[],So=!1,fs,Vl=-1;function nP(){!So||!fs||(So=!1,fs.length?Qi=fs.concat(Qi):Vl=-1,Qi.length&&$E())}function $E(){if(!So){var r=WE(nP);So=!0;for(var e=Qi.length;e;){for(fs=Qi,Qi=[];++Vl1)for(var t=1;t{y=_e(kE()),_=_e(XE()),sP=function(r){function e(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object),global=sP});var jr=B((ZE,Hl)=>{f();(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],w=1e7,N=1e9;function O(W){var k,R,F,G=l.prototype={constructor:l,toString:null,valueOf:null},ce=new l(1),J=20,X=4,A=-7,c=21,d=-1e7,g=1e7,m=!1,v=1,S=0,D={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz";function l(E,b){var x,L,P,U,q,M,Q,K,H=this;if(!(H instanceof l))return new l(E,b);if(b==null){if(E&&E._isBigNumber===!0){H.s=E.s,!E.c||E.e>g?H.c=H.e=null:E.e=10;q/=10,U++);U>g?H.c=H.e=null:(H.e=U,H.c=[E]);return}K=String(E)}else{if(!t.test(K=String(E)))return F(H,K,M);H.s=K.charCodeAt(0)==45?(K=K.slice(1),-1):1}(U=K.indexOf("."))>-1&&(K=K.replace(".","")),(q=K.search(/e/i))>0?(U<0&&(U=q),U+=+K.slice(q+1),K=K.substring(0,q)):U<0&&(U=K.length)}else{if($(b,2,I.length,"Base"),b==10)return H=new l(E),ee(H,J+H.e+1,X);if(K=String(E),M=typeof E=="number"){if(E*0!=0)return F(H,K,M,b);if(H.s=1/E<0?(K=K.slice(1),-1):1,l.DEBUG&&K.replace(/^0\.0*|\./,"").length>15)throw Error(o+E)}else H.s=K.charCodeAt(0)===45?(K=K.slice(1),-1):1;for(x=I.slice(0,b),U=q=0,Q=K.length;qU){U=Q;continue}}else if(!P&&(K==K.toUpperCase()&&(K=K.toLowerCase())||K==K.toLowerCase()&&(K=K.toUpperCase()))){P=!0,q=-1,U=0;continue}return F(H,String(E),M,b)}M=!1,K=R(K,b,10,H.s),(U=K.indexOf("."))>-1?K=K.replace(".",""):U=K.length}for(q=0;K.charCodeAt(q)===48;q++);for(Q=K.length;K.charCodeAt(--Q)===48;);if(K=K.slice(q,++Q)){if(Q-=q,M&&l.DEBUG&&Q>15&&(E>h||E!==n(E)))throw Error(o+H.s*E);if((U=U-q-1)>g)H.c=H.e=null;else if(U=-N&&P<=N&&P===n(P)){if(L[0]===0){if(P===0&&L.length===1)return!0;break e}if(b=(P+1)%u,b<1&&(b+=u),String(L[0]).length==b){for(b=0;b=a||x!==n(x))break e;if(x!==0)return!0}}}else if(L===null&&P===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+E)},l.maximum=l.max=function(){return Z(arguments,G.lt)},l.minimum=l.min=function(){return Z(arguments,G.gt)},l.random=function(){var E=9007199254740992,b=Math.random()*E&2097151?function(){return n(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var L,P,U,q,M,Q=0,K=[],H=new l(ce);if(x==null?x=J:$(x,0,N),q=i(x/u),m)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(q*=2));Q>>11),M>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),L[Q]=P[0],L[Q+1]=P[1]):(K.push(M%1e14),Q+=2);Q=q/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(q*=7);Q=9e15?crypto.randomBytes(7).copy(L,Q):(K.push(M%1e14),Q+=7);Q=q/7}else throw m=!1,Error(s+"crypto unavailable");if(!m)for(;Q=10;M/=10,Q++);QP-1&&(M[q+1]==null&&(M[q+1]=0),M[q+1]+=M[q]/P|0,M[q]%=P)}return M.reverse()}return function(x,L,P,U,q){var M,Q,K,H,ue,he,de,Me,be=x.indexOf("."),xe=J,Be=X;for(be>=0&&(H=S,S=0,x=x.replace(".",""),Me=new l(L),he=Me.pow(x.length-be),S=H,Me.c=b(j(V(he.c),he.e,"0"),10,P,E),Me.e=Me.c.length),de=b(x,L,P,q?(M=I,E):(M=E,I)),K=H=de.length;de[--H]==0;de.pop());if(!de[0])return M.charAt(0);if(be<0?--K:(he.c=de,he.e=K,he.s=U,he=k(he,Me,xe,Be,P),de=he.c,ue=he.r,K=he.e),Q=K+xe+1,be=de[Q],H=P/2,ue=ue||Q<0||de[Q+1]!=null,ue=Be<4?(be!=null||ue)&&(Be==0||Be==(he.s<0?3:2)):be>H||be==H&&(Be==4||ue||Be==6&&de[Q-1]&1||Be==(he.s<0?8:7)),Q<1||!de[0])x=ue?j(M.charAt(1),-xe,M.charAt(0)):M.charAt(0);else{if(de.length=Q,ue)for(--P;++de[--Q]>P;)de[Q]=0,Q||(++K,de=[1].concat(de));for(H=de.length;!de[--H];);for(be=0,x="";be<=H;x+=M.charAt(de[be++]));x=j(x,K,M.charAt(0))}return x}}(),k=function(){function E(L,P,U){var q,M,Q,K,H=0,ue=L.length,he=P%w,de=P/w|0;for(L=L.slice();ue--;)Q=L[ue]%w,K=L[ue]/w|0,q=de*Q+K*he,M=he*Q+q%w*w+H,H=(M/U|0)+(q/w|0)+de*K,L[ue]=M%U;return H&&(L=[H].concat(L)),L}function b(L,P,U,q){var M,Q;if(U!=q)Q=U>q?1:-1;else for(M=Q=0;MP[M]?1:-1;break}return Q}function x(L,P,U,q){for(var M=0;U--;)L[U]-=M,M=L[U]1;L.splice(0,1));}return function(L,P,U,q,M){var Q,K,H,ue,he,de,Me,be,xe,Be,Ie,Pe,us,Ze,et,Ar,ze,Ue=L.s==P.s?1:-1,jt=L.c,Ce=P.c;if(!jt||!jt[0]||!Ce||!Ce[0])return new l(!L.s||!P.s||(jt?Ce&&jt[0]==Ce[0]:!Ce)?NaN:jt&&jt[0]==0||!Ce?Ue*0:Ue/0);for(be=new l(Ue),xe=be.c=[],K=L.e-P.e,Ue=U+K+1,M||(M=a,K=T(L.e/u)-T(P.e/u),Ue=Ue/u|0),H=0;Ce[H]==(jt[H]||0);H++);if(Ce[H]>(jt[H]||0)&&K--,Ue<0)xe.push(1),ue=!0;else{for(Ze=jt.length,Ar=Ce.length,H=0,Ue+=2,he=n(M/(Ce[0]+1)),he>1&&(Ce=E(Ce,he,M),jt=E(jt,he,M),Ar=Ce.length,Ze=jt.length),us=Ar,Be=jt.slice(0,Ar),Ie=Be.length;Ie=M/2&&et++;do{if(he=0,Q=b(Ce,Be,Ar,Ie),Q<0){if(Pe=Be[0],Ar!=Ie&&(Pe=Pe*M+(Be[1]||0)),he=n(Pe/et),he>1)for(he>=M&&(he=M-1),de=E(Ce,he,M),Me=de.length,Ie=Be.length;b(de,Be,Me,Ie)==1;)he--,x(de,Ar=10;Ue/=10,H++);ee(be,U+(be.e=H+K*u-1)+1,q,ue)}else be.e=K,be.r=+ue;return be}}();function C(E,b,x,L){var P,U,q,M,Q;if(x==null?x=X:$(x,0,8),!E.c)return E.toString();if(P=E.c[0],q=E.e,b==null)Q=V(E.c),Q=L==1||L==2&&(q<=A||q>=c)?Y(Q,q):j(Q,q,"0");else if(E=ee(new l(E),b,x),U=E.e,Q=V(E.c),M=Q.length,L==1||L==2&&(b<=U||U<=A)){for(;MM){if(--b>0)for(Q+=".";b--;Q+="0");}else if(b+=U-M,b>0)for(U+1==M&&(Q+=".");b--;Q+="0");return E.s<0&&P?"-"+Q:Q}function Z(E,b){for(var x,L=1,P=new l(E[0]);L=10;P/=10,L++);return(x=L+x*u-1)>g?E.c=E.e=null:x=10;M/=10,P++);if(U=b-P,U<0)U+=u,q=b,Q=ue[K=0],H=Q/he[P-q-1]%10|0;else if(K=i((U+1)/u),K>=ue.length)if(L){for(;ue.length<=K;ue.push(0));Q=H=0,P=1,U%=u,q=U-u+1}else break e;else{for(Q=M=ue[K],P=1;M>=10;M/=10,P++);U%=u,q=U-u+P,H=q<0?0:Q/he[P-q-1]%10|0}if(L=L||b<0||ue[K+1]!=null||(q<0?Q:Q%he[P-q-1]),L=x<4?(H||L)&&(x==0||x==(E.s<0?3:2)):H>5||H==5&&(x==4||L||x==6&&(U>0?q>0?Q/he[P-q]:0:ue[K-1])%10&1||x==(E.s<0?8:7)),b<1||!ue[0])return ue.length=0,L?(b-=E.e+1,ue[0]=he[(u-b%u)%u],E.e=-b||0):ue[0]=E.e=0,E;if(U==0?(ue.length=K,M=1,K--):(ue.length=K+1,M=he[u-U],ue[K]=q>0?n(Q/he[P-q]%he[q])*M:0),L)for(;;)if(K==0){for(U=1,q=ue[0];q>=10;q/=10,U++);for(q=ue[0]+=M,M=1;q>=10;q/=10,M++);U!=M&&(E.e++,ue[0]==a&&(ue[0]=1));break}else{if(ue[K]+=M,ue[K]!=a)break;ue[K--]=0,M=1}for(U=ue.length;ue[--U]===0;ue.pop());}E.e>g?E.c=E.e=null:E.e=c?Y(b,x):j(b,x,"0"),E.s<0?"-"+b:b)}return G.absoluteValue=G.abs=function(){var E=new l(this);return E.s<0&&(E.s=1),E},G.comparedTo=function(E,b){return z(this,new l(E,b))},G.decimalPlaces=G.dp=function(E,b){var x,L,P,U=this;if(E!=null)return $(E,0,N),b==null?b=X:$(b,0,8),ee(new l(U),E+U.e+1,b);if(!(x=U.c))return null;if(L=((P=x.length-1)-T(this.e/u))*u,P=x[P])for(;P%10==0;P/=10,L--);return L<0&&(L=0),L},G.dividedBy=G.div=function(E,b){return k(this,new l(E,b),J,X)},G.dividedToIntegerBy=G.idiv=function(E,b){return k(this,new l(E,b),0,1)},G.exponentiatedBy=G.pow=function(E,b){var x,L,P,U,q,M,Q,K,H,ue=this;if(E=new l(E),E.c&&!E.isInteger())throw Error(s+"Exponent not an integer: "+ae(E));if(b!=null&&(b=new l(b)),M=E.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!E.c||!E.c[0])return H=new l(Math.pow(+ae(ue),M?2-se(E):+ae(E))),b?H.mod(b):H;if(Q=E.s<0,b){if(b.c?!b.c[0]:!b.s)return new l(NaN);L=!Q&&ue.isInteger()&&b.isInteger(),L&&(ue=ue.mod(b))}else{if(E.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||M&&ue.c[1]>=24e7:ue.c[0]<8e13||M&&ue.c[0]<=9999975e7)))return U=ue.s<0&&se(E)?-0:0,ue.e>-1&&(U=1/U),new l(Q?1/U:U);S&&(U=i(S/u+2))}for(M?(x=new l(.5),Q&&(E.s=1),K=se(E)):(P=Math.abs(+ae(E)),K=P%2),H=new l(ce);;){if(K){if(H=H.times(ue),!H.c)break;U?H.c.length>U&&(H.c.length=U):L&&(H=H.mod(b))}if(P){if(P=n(P/2),P===0)break;K=P%2}else if(E=E.times(x),ee(E,E.e+1,1),E.e>14)K=se(E);else{if(P=+ae(E),P===0)break;K=P%2}ue=ue.times(ue),U?ue.c&&ue.c.length>U&&(ue.c.length=U):L&&(ue=ue.mod(b))}return L?H:(Q&&(H=ce.div(H)),b?H.mod(b):U?ee(H,S,X,q):H)},G.integerValue=function(E){var b=new l(this);return E==null?E=X:$(E,0,8),ee(b,b.e+1,E)},G.isEqualTo=G.eq=function(E,b){return z(this,new l(E,b))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(E,b){return z(this,new l(E,b))>0},G.isGreaterThanOrEqualTo=G.gte=function(E,b){return(b=z(this,new l(E,b)))===1||b===0},G.isInteger=function(){return!!this.c&&T(this.e/u)>this.c.length-2},G.isLessThan=G.lt=function(E,b){return z(this,new l(E,b))<0},G.isLessThanOrEqualTo=G.lte=function(E,b){return(b=z(this,new l(E,b)))===-1||b===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(E,b){var x,L,P,U,q=this,M=q.s;if(E=new l(E,b),b=E.s,!M||!b)return new l(NaN);if(M!=b)return E.s=-b,q.plus(E);var Q=q.e/u,K=E.e/u,H=q.c,ue=E.c;if(!Q||!K){if(!H||!ue)return H?(E.s=-b,E):new l(ue?q:NaN);if(!H[0]||!ue[0])return ue[0]?(E.s=-b,E):new l(H[0]?q:X==3?-0:0)}if(Q=T(Q),K=T(K),H=H.slice(),M=Q-K){for((U=M<0)?(M=-M,P=H):(K=Q,P=ue),P.reverse(),b=M;b--;P.push(0));P.reverse()}else for(L=(U=(M=H.length)<(b=ue.length))?M:b,M=b=0;b0)for(;b--;H[x++]=0);for(b=a-1;L>M;){if(H[--L]=0;){for(x=0,he=Pe[P]%xe,de=Pe[P]/xe|0,q=Q,U=P+q;U>P;)K=Ie[--q]%xe,H=Ie[q]/xe|0,M=de*K+H*he,K=he*K+M%xe*xe+Me[U]+x,x=(K/be|0)+(M/xe|0)+de*H,Me[U--]=K%be;Me[U]=x}return x?++L:Me.splice(0,1),ie(E,Me,L)},G.negated=function(){var E=new l(this);return E.s=-E.s||null,E},G.plus=function(E,b){var x,L=this,P=L.s;if(E=new l(E,b),b=E.s,!P||!b)return new l(NaN);if(P!=b)return E.s=-b,L.minus(E);var U=L.e/u,q=E.e/u,M=L.c,Q=E.c;if(!U||!q){if(!M||!Q)return new l(P/0);if(!M[0]||!Q[0])return Q[0]?E:new l(M[0]?L:P*0)}if(U=T(U),q=T(q),M=M.slice(),P=U-q){for(P>0?(q=U,x=Q):(P=-P,x=M),x.reverse();P--;x.push(0));x.reverse()}for(P=M.length,b=Q.length,P-b<0&&(x=Q,Q=M,M=x,b=P),P=0;b;)P=(M[--b]=M[b]+Q[b]+P)/a|0,M[b]=a===M[b]?0:M[b]%a;return P&&(M=[P].concat(M),++q),ie(E,M,q)},G.precision=G.sd=function(E,b){var x,L,P,U=this;if(E!=null&&E!==!!E)return $(E,1,N),b==null?b=X:$(b,0,8),ee(new l(U),E,b);if(!(x=U.c))return null;if(P=x.length-1,L=P*u+1,P=x[P]){for(;P%10==0;P/=10,L--);for(P=x[0];P>=10;P/=10,L++);}return E&&U.e+1>L&&(L=U.e+1),L},G.shiftedBy=function(E){return $(E,-h,h),this.times("1e"+E)},G.squareRoot=G.sqrt=function(){var E,b,x,L,P,U=this,q=U.c,M=U.s,Q=U.e,K=J+4,H=new l("0.5");if(M!==1||!q||!q[0])return new l(!M||M<0&&(!q||q[0])?NaN:q?U:1/0);if(M=Math.sqrt(+ae(U)),M==0||M==1/0?(b=V(q),(b.length+Q)%2==0&&(b+="0"),M=Math.sqrt(+b),Q=T((Q+1)/2)-(Q<0||Q%2),M==1/0?b="5e"+Q:(b=M.toExponential(),b=b.slice(0,b.indexOf("e")+1)+Q),x=new l(b)):x=new l(M+""),x.c[0]){for(Q=x.e,M=Q+K,M<3&&(M=0);;)if(P=x,x=H.times(P.plus(k(U,P,K,1))),V(P.c).slice(0,M)===(b=V(x.c)).slice(0,M))if(x.e0&&Me>0){for(U=Me%M||M,H=de.substr(0,U);U0&&(H+=K+de.slice(U)),he&&(H="-"+H)}L=ue?H+(x.decimalSeparator||"")+((Q=+x.fractionGroupSize)?ue.replace(new RegExp("\\d{"+Q+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):ue):H}return(x.prefix||"")+L+(x.suffix||"")},G.toFraction=function(E){var b,x,L,P,U,q,M,Q,K,H,ue,he,de=this,Me=de.c;if(E!=null&&(M=new l(E),!M.isInteger()&&(M.c||M.s!==1)||M.lt(ce)))throw Error(s+"Argument "+(M.isInteger()?"out of range: ":"not an integer: ")+ae(M));if(!Me)return new l(de);for(b=new l(ce),K=x=new l(ce),L=Q=new l(ce),he=V(Me),U=b.e=he.length-de.e-1,b.c[0]=p[(q=U%u)<0?u+q:q],E=!E||M.comparedTo(b)>0?U>0?b:K:M,q=g,g=1/0,M=new l(he),Q.c[0]=0;H=k(M,b,0,1),P=x.plus(H.times(L)),P.comparedTo(E)!=1;)x=L,L=P,K=Q.plus(H.times(P=K)),Q=P,b=M.minus(H.times(P=b)),M=P;return P=k(E.minus(x),L,0,1),Q=Q.plus(P.times(K)),x=x.plus(P.times(L)),Q.s=K.s=de.s,U=U*2,ue=k(K,L,U,X).minus(de).abs().comparedTo(k(Q,x,U,X).minus(de).abs())<1?[K,L]:[Q,x],g=q,ue},G.toNumber=function(){return+ae(this)},G.toPrecision=function(E,b){return E!=null&&$(E,1,N),C(this,E,b,2)},G.toString=function(E){var b,x=this,L=x.s,P=x.e;return P===null?L?(b="Infinity",L<0&&(b="-"+b)):b="NaN":(E==null?b=P<=A||P>=c?Y(V(x.c),P):j(V(x.c),P,"0"):E===10?(x=ee(new l(x),J+P+1,X),b=j(V(x.c),x.e,"0")):($(E,2,I.length,"Base"),b=R(j(V(x.c),P,"0"),10,E,L,!0)),L<0&&x.c[0]&&(b="-"+b)),b},G.valueOf=G.toJSON=function(){return ae(this)},G._isBigNumber=!0,W!=null&&l.set(W),l}function T(W){var k=W|0;return W>0||W===k?k:k-1}function V(W){for(var k,R,F=1,G=W.length,ce=W[0]+"";Fc^R?1:-1;for(X=(A=G.length)<(c=ce.length)?A:c,J=0;Jce[J]^R?1:-1;return A==c?0:A>c^R?1:-1}function $(W,k,R,F){if(WR||W!==n(W))throw Error(s+(F||"Argument")+(typeof W=="number"?WR?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function se(W){var k=W.c.length-1;return T(W.e/u)==k&&W.c[k]%2!=0}function Y(W,k){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(k<0?"e":"e+")+k}function j(W,k,R){var F,G;if(k<0){for(G=R+".";++k;G+=R);W=G+W}else if(F=W.length,++k>F){for(G=R,k-=F;--k;G+=R);W+=G}else k{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.ErrGasLimitShouldBe0ForInnerTransaction=ge.ErrInvalidRelayedV2BuilderArguments=ge.ErrInvalidRelayedV1BuilderArguments=ge.ErrNotImplemented=ge.ErrContractInteraction=ge.ErrCodec=ge.ErrCannotParseTransactionOutcome=ge.ErrCannotParseContractResults=ge.ErrMissingFieldOnEnum=ge.ErrMissingFieldOnStruct=ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ge.ErrTypingSystem=ge.ErrMock=ge.ErrContractHasNoAddress=ge.ErrContract=ge.ErrExpectedTransactionEventsNotFound=ge.ErrExpectedTransactionStatusNotReached=ge.ErrTransactionWatcherTimeout=ge.ErrAsyncTimerAborted=ge.ErrAsyncTimerAlreadyRunning=ge.ErrInvalidFunctionName=ge.ErrSignatureCannotCreate=ge.ErrTransactionOptionsInvalid=ge.ErrTransactionVersionInvalid=ge.ErrNonceInvalid=ge.ErrNotEnoughGas=ge.ErrAddressEmpty=ge.ErrAddressBadHrp=ge.ErrAddressCannotCreate=ge.ErrUnexpectedCondition=ge.ErrInvariantFailed=ge.ErrBadType=ge.ErrUnsupportedOperation=ge.ErrInvalidArgument=ge.Err=void 0;var Re=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}};ge.Err=Re;var T0=class extends Re{constructor(e,t){super(`Invalid argument: ${e}`,t)}};ge.ErrInvalidArgument=T0;var N0=class extends Re{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};ge.ErrUnsupportedOperation=N0;var D0=class extends Re{constructor(e,t,i){super(`Bad type of "${e}": ${i}. Expected type: ${t}`)}};ge.ErrBadType=D0;var O0=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};ge.ErrInvariantFailed=O0;var P0=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};ge.ErrUnexpectedCondition=P0;var B0=class extends Re{constructor(e,t){let i=`Cannot create address from: ${e}`;super(i,t)}};ge.ErrAddressCannotCreate=B0;var M0=class extends Re{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};ge.ErrAddressBadHrp=M0;var R0=class extends Re{constructor(){super("Address is empty")}};ge.ErrAddressEmpty=R0;var L0=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};ge.ErrNotEnoughGas=L0;var F0=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};ge.ErrNonceInvalid=F0;var U0=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};ge.ErrTransactionVersionInvalid=U0;var q0=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};ge.ErrTransactionOptionsInvalid=q0;var V0=class extends Re{constructor(e,t){let i=`Cannot create signature from: ${e}`;super(i,t)}};ge.ErrSignatureCannotCreate=V0;var H0=class extends Re{constructor(){super("Invalid function name")}};ge.ErrInvalidFunctionName=H0;var Q0=class extends Re{constructor(){super("Async timer already running")}};ge.ErrAsyncTimerAlreadyRunning=Q0;var j0=class extends Re{constructor(){super("Async timer aborted")}};ge.ErrAsyncTimerAborted=j0;var G0=class extends Re{constructor(){super("TransactionWatcher has timed out")}};ge.ErrTransactionWatcherTimeout=G0;var K0=class extends Re{constructor(){super("Expected transaction status not reached")}};ge.ErrExpectedTransactionStatusNotReached=K0;var z0=class extends Re{constructor(){super("Expected transaction events not found")}};ge.ErrExpectedTransactionEventsNotFound=z0;var Ql=class extends Re{constructor(e){super(e)}};ge.ErrContract=Ql;var k0=class extends Ql{constructor(){super(` +var A8=Object.create;var Ku=Object.defineProperty,I8=Object.defineProperties,_8=Object.getOwnPropertyDescriptor,b8=Object.getOwnPropertyDescriptors,C8=Object.getOwnPropertyNames,TE=Object.getOwnPropertySymbols,S8=Object.getPrototypeOf,DE=Object.prototype.hasOwnProperty,x8=Object.prototype.propertyIsEnumerable;var NE=(r,e,t)=>e in r?Ku(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bo=(r,e)=>{for(var t in e||={})DE.call(e,t)&&NE(r,t,e[t]);if(TE)for(var t of TE(e))x8.call(e,t)&&NE(r,t,e[t]);return r},OE=(r,e)=>I8(r,b8(e));var PE=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var me=(r,e)=>()=>(r&&(e=r(r=0)),e);var B=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ot=(r,e)=>{for(var t in e)Ku(r,t,{get:e[t],enumerable:!0})},Ll=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C8(e))!DE.call(r,n)&&n!==t&&Ku(r,n,{get:()=>e[n],enumerable:!(i=_8(e,n))||i.enumerable});return r},er=(r,e,t)=>(Ll(r,e,"default"),t&&Ll(t,e,"default")),_e=(r,e,t)=>(t=r!=null?A8(S8(r)):{},Ll(e||!r||!r.__esModule?Ku(t,"default",{value:r,enumerable:!0}):t,r)),at=r=>Ll(Ku({},"__esModule",{value:!0}),r);var Te=(r,e,t)=>new Promise((i,n)=>{var s=u=>{try{a(t.next(u))}catch(h){n(h)}},o=u=>{try{a(t.throw(u))}catch(h){n(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);a((t=t.apply(r,e)).next())});var y0=B(Fl=>{"use strict";f();Fl.byteLength=N8;Fl.toByteArray=O8;Fl.fromByteArray=M8;var ii=[],xr=[],T8=typeof Uint8Array<"u"?Uint8Array:Array,g0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(cs=0,BE=g0.length;cs0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function N8(r){var e=ME(r),t=e[0],i=e[1];return(t+i)*3/4-i}function D8(r,e,t){return(e+t)*3/4-t}function O8(r){var e,t=ME(r),i=t[0],n=t[1],s=new T8(D8(r,i,n)),o=0,a=n>0?i-4:i,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=xr[r.charCodeAt(u)]<<2|xr[r.charCodeAt(u+1)]>>4,s[o++]=e&255),n===1&&(e=xr[r.charCodeAt(u)]<<10|xr[r.charCodeAt(u+1)]<<4|xr[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function P8(r){return ii[r>>18&63]+ii[r>>12&63]+ii[r>>6&63]+ii[r&63]}function B8(r,e,t){for(var i,n=[],s=e;sa?a:o+s));return i===1?(e=r[t-1],n.push(ii[e>>2]+ii[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ii[e>>10]+ii[e>>4&63]+ii[e<<2&63]+"=")),n.join("")}});var w0=B(m0=>{f();m0.read=function(r,e,t,i,n){var s,o,a=n*8-i-1,u=(1<>1,p=-7,w=t?n-1:0,N=t?-1:1,O=r[e+w];for(w+=N,s=O&(1<<-p)-1,O>>=-p,p+=a;p>0;s=s*256+r[e+w],w+=N,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+r[e+w],w+=N,p-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(O?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-h}return(O?-1:1)*o*Math.pow(2,s-i)};m0.write=function(r,e,t,i,n,s){var o,a,u,h=s*8-n-1,p=(1<>1,N=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=i?0:s-1,T=i?1:-1,V=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+w>=1?e+=N/u:e+=N*Math.pow(2,1-w),e*u>=2&&(o++,u/=2),o+w>=p?(a=0,o=p):o+w>=1?(a=(e*u-1)*Math.pow(2,n),o=o+w):(a=e*Math.pow(2,w-1)*Math.pow(2,n),o=0));n>=8;r[t+O]=a&255,O+=T,a/=256,n-=8);for(o=o<0;r[t+O]=o&255,O+=T,o/=256,h-=8);r[t+O-T]|=V*128}});var kE=B(So=>{"use strict";f();var v0=y0(),Co=w0(),RE=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=oe;So.SlowBuffer=V8;So.INSPECT_MAX_BYTES=50;var Ul=2147483647;So.kMaxLength=Ul;oe.TYPED_ARRAY_SUPPORT=R8();!oe.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 R8(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(oe.prototype,"parent",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.buffer}});Object.defineProperty(oe.prototype,"offset",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.byteOffset}});function Qi(r){if(r>Ul)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,oe.prototype),e}function oe(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _0(r)}return UE(r,e,t)}oe.poolSize=8192;function UE(r,e,t){if(typeof r=="string")return F8(r,e);if(ArrayBuffer.isView(r))return U8(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(ni(r,ArrayBuffer)||r&&ni(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ni(r,SharedArrayBuffer)||r&&ni(r.buffer,SharedArrayBuffer)))return A0(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return oe.from(i,e,t);var n=q8(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return oe.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}oe.from=function(r,e,t){return UE(r,e,t)};Object.setPrototypeOf(oe.prototype,Uint8Array.prototype);Object.setPrototypeOf(oe,Uint8Array);function qE(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function L8(r,e,t){return qE(r),r<=0?Qi(r):e!==void 0?typeof t=="string"?Qi(r).fill(e,t):Qi(r).fill(e):Qi(r)}oe.alloc=function(r,e,t){return L8(r,e,t)};function _0(r){return qE(r),Qi(r<0?0:b0(r)|0)}oe.allocUnsafe=function(r){return _0(r)};oe.allocUnsafeSlow=function(r){return _0(r)};function F8(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!oe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=VE(r,e)|0,i=Qi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function E0(r){for(var e=r.length<0?0:b0(r.length)|0,t=Qi(e),i=0;i=Ul)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ul.toString(16)+" bytes");return r|0}function V8(r){return+r!=r&&(r=0),oe.alloc(+r)}oe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==oe.prototype};oe.compare=function(e,t){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),ni(t,Uint8Array)&&(t=oe.from(t,t.offset,t.byteLength)),!oe.isBuffer(e)||!oe.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);sn.length?oe.from(o).copy(n,s):Uint8Array.prototype.set.call(n,o,s);else if(oe.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function VE(r,e){if(oe.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||ni(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return I0(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return zE(r).length;default:if(n)return i?-1:I0(r).length;e=(""+e).toLowerCase(),n=!0}}oe.byteLength=VE;function H8(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return J8(this,e,t);case"utf8":case"utf-8":return QE(this,e,t);case"ascii":return $8(this,e,t);case"latin1":case"binary":return Y8(this,e,t);case"base64":return k8(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X8(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}oe.prototype._isBuffer=!0;function ls(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}oe.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 t=0;tt&&(e+=" ... "),""};RE&&(oe.prototype[RE]=oe.prototype.inspect);oe.prototype.compare=function(e,t,i,n,s){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),!oe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i),w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,C0(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=oe.from(e,i)),oe.isBuffer(e))return e.length===0?-1:LE(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):LE(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function LE(r,e,t,i,n){var s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(O,T){return s===1?O[T]:O.readUInt16BE(T*s)}var h;if(n){var p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){for(var w=!0,N=0;Nn&&(i=n)):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Q8(this,e,t,i);case"utf8":case"utf-8":return j8(this,e,t,i);case"ascii":case"latin1":case"binary":return G8(this,e,t,i);case"base64":return K8(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z8(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};oe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k8(r,e,t){return e===0&&t===r.length?v0.fromByteArray(r):v0.fromByteArray(r.slice(e,t))}function QE(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+a<=t){var u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return W8(i)}var FE=4096;function W8(r){var e=r.length;if(e<=FE)return String.fromCharCode.apply(String,r);for(var t="",i=0;ii)&&(t=i);for(var n="",s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}oe.prototype.readUintLE=oe.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n};oe.prototype.readUint8=oe.prototype.readUInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]};oe.prototype.readUint16LE=oe.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]|this[e+1]<<8};oe.prototype.readUint16BE=oe.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]<<8|this[e+1]};oe.prototype.readUint32LE=oe.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};oe.prototype.readUint32BE=oe.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};oe.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o=s&&(n-=Math.pow(2,8*t)),n};oe.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=t,s=1,o=this[e+--n];n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};oe.prototype.readInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};oe.prototype.readInt16LE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt16BE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};oe.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};oe.prototype.readFloatLE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),Co.read(this,e,!0,23,4)};oe.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),Co.read(this,e,!1,23,4)};oe.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),Co.read(this,e,!0,52,8)};oe.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),Co.read(this,e,!1,52,8)};function pr(r,e,t,i,n,s){if(!oe.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}oe.prototype.writeUintLE=oe.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=1,a=0;for(this[t]=e&255;++a>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};oe.prototype.writeUint8=oe.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,255,0),this[t]=e&255,t+1};oe.prototype.writeUint16LE=oe.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeUint16BE=oe.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeUint32LE=oe.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};oe.prototype.writeUint32BE=oe.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};oe.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=0,a=1,u=0;for(this[t]=e&255;++o>0)-u&255;return t+i};oe.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};oe.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};oe.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};oe.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function jE(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function GE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,4,34028234663852886e22,-34028234663852886e22),Co.write(r,e,t,i,23,4),t+4}oe.prototype.writeFloatLE=function(e,t,i){return GE(this,e,t,!0,i)};oe.prototype.writeFloatBE=function(e,t,i){return GE(this,e,t,!1,i)};function KE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,8,17976931348623157e292,-17976931348623157e292),Co.write(r,e,t,i,52,8),t+8}oe.prototype.writeDoubleLE=function(e,t,i){return KE(this,e,t,!0,i)};oe.prototype.writeDoubleBE=function(e,t,i){return KE(this,e,t,!1,i)};oe.prototype.copy=function(e,t,i,n){if(!oe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function tP(r){for(var e=[],t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function zE(r){return v0.toByteArray(eP(r))}function ql(r,e,t,i){for(var n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ni(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function C0(r){return r!==r}var iP=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)e[i+n]=r[t]+r[n];return e}()});var XE=B((lz,JE)=>{f();var dt=JE.exports={},si,oi;function S0(){throw new Error("setTimeout has not been defined")}function x0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?si=setTimeout:si=S0}catch{si=S0}try{typeof clearTimeout=="function"?oi=clearTimeout:oi=x0}catch{oi=x0}})();function WE(r){if(si===setTimeout)return setTimeout(r,0);if((si===S0||!si)&&setTimeout)return si=setTimeout,setTimeout(r,0);try{return si(r,0)}catch{try{return si.call(null,r,0)}catch{return si.call(this,r,0)}}}function nP(r){if(oi===clearTimeout)return clearTimeout(r);if((oi===x0||!oi)&&clearTimeout)return oi=clearTimeout,clearTimeout(r);try{return oi(r)}catch{try{return oi.call(null,r)}catch{return oi.call(this,r)}}}var ji=[],xo=!1,fs,Vl=-1;function sP(){!xo||!fs||(xo=!1,fs.length?ji=fs.concat(ji):Vl=-1,ji.length&&$E())}function $E(){if(!xo){var r=WE(sP);xo=!0;for(var e=ji.length;e;){for(fs=ji,ji=[];++Vl1)for(var t=1;t{y=_e(kE()),_=_e(XE()),oP=function(r){function e(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object),global=oP});var jr=B((ZE,Hl)=>{f();(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],w=1e7,N=1e9;function O(W){var k,R,F,G=l.prototype={constructor:l,toString:null,valueOf:null},ce=new l(1),J=20,X=4,A=-7,c=21,d=-1e7,g=1e7,m=!1,v=1,S=0,D={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz";function l(E,b){var x,L,P,U,q,M,Q,K,H=this;if(!(H instanceof l))return new l(E,b);if(b==null){if(E&&E._isBigNumber===!0){H.s=E.s,!E.c||E.e>g?H.c=H.e=null:E.e=10;q/=10,U++);U>g?H.c=H.e=null:(H.e=U,H.c=[E]);return}K=String(E)}else{if(!t.test(K=String(E)))return F(H,K,M);H.s=K.charCodeAt(0)==45?(K=K.slice(1),-1):1}(U=K.indexOf("."))>-1&&(K=K.replace(".","")),(q=K.search(/e/i))>0?(U<0&&(U=q),U+=+K.slice(q+1),K=K.substring(0,q)):U<0&&(U=K.length)}else{if($(b,2,I.length,"Base"),b==10)return H=new l(E),ee(H,J+H.e+1,X);if(K=String(E),M=typeof E=="number"){if(E*0!=0)return F(H,K,M,b);if(H.s=1/E<0?(K=K.slice(1),-1):1,l.DEBUG&&K.replace(/^0\.0*|\./,"").length>15)throw Error(o+E)}else H.s=K.charCodeAt(0)===45?(K=K.slice(1),-1):1;for(x=I.slice(0,b),U=q=0,Q=K.length;qU){U=Q;continue}}else if(!P&&(K==K.toUpperCase()&&(K=K.toLowerCase())||K==K.toLowerCase()&&(K=K.toUpperCase()))){P=!0,q=-1,U=0;continue}return F(H,String(E),M,b)}M=!1,K=R(K,b,10,H.s),(U=K.indexOf("."))>-1?K=K.replace(".",""):U=K.length}for(q=0;K.charCodeAt(q)===48;q++);for(Q=K.length;K.charCodeAt(--Q)===48;);if(K=K.slice(q,++Q)){if(Q-=q,M&&l.DEBUG&&Q>15&&(E>h||E!==n(E)))throw Error(o+H.s*E);if((U=U-q-1)>g)H.c=H.e=null;else if(U=-N&&P<=N&&P===n(P)){if(L[0]===0){if(P===0&&L.length===1)return!0;break e}if(b=(P+1)%u,b<1&&(b+=u),String(L[0]).length==b){for(b=0;b=a||x!==n(x))break e;if(x!==0)return!0}}}else if(L===null&&P===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+E)},l.maximum=l.max=function(){return Z(arguments,G.lt)},l.minimum=l.min=function(){return Z(arguments,G.gt)},l.random=function(){var E=9007199254740992,b=Math.random()*E&2097151?function(){return n(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var L,P,U,q,M,Q=0,K=[],H=new l(ce);if(x==null?x=J:$(x,0,N),q=i(x/u),m)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(q*=2));Q>>11),M>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),L[Q]=P[0],L[Q+1]=P[1]):(K.push(M%1e14),Q+=2);Q=q/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(q*=7);Q=9e15?crypto.randomBytes(7).copy(L,Q):(K.push(M%1e14),Q+=7);Q=q/7}else throw m=!1,Error(s+"crypto unavailable");if(!m)for(;Q=10;M/=10,Q++);QP-1&&(M[q+1]==null&&(M[q+1]=0),M[q+1]+=M[q]/P|0,M[q]%=P)}return M.reverse()}return function(x,L,P,U,q){var M,Q,K,H,ue,he,de,Re,be=x.indexOf("."),xe=J,Be=X;for(be>=0&&(H=S,S=0,x=x.replace(".",""),Re=new l(L),he=Re.pow(x.length-be),S=H,Re.c=b(j(V(he.c),he.e,"0"),10,P,E),Re.e=Re.c.length),de=b(x,L,P,q?(M=I,E):(M=E,I)),K=H=de.length;de[--H]==0;de.pop());if(!de[0])return M.charAt(0);if(be<0?--K:(he.c=de,he.e=K,he.s=U,he=k(he,Re,xe,Be,P),de=he.c,ue=he.r,K=he.e),Q=K+xe+1,be=de[Q],H=P/2,ue=ue||Q<0||de[Q+1]!=null,ue=Be<4?(be!=null||ue)&&(Be==0||Be==(he.s<0?3:2)):be>H||be==H&&(Be==4||ue||Be==6&&de[Q-1]&1||Be==(he.s<0?8:7)),Q<1||!de[0])x=ue?j(M.charAt(1),-xe,M.charAt(0)):M.charAt(0);else{if(de.length=Q,ue)for(--P;++de[--Q]>P;)de[Q]=0,Q||(++K,de=[1].concat(de));for(H=de.length;!de[--H];);for(be=0,x="";be<=H;x+=M.charAt(de[be++]));x=j(x,K,M.charAt(0))}return x}}(),k=function(){function E(L,P,U){var q,M,Q,K,H=0,ue=L.length,he=P%w,de=P/w|0;for(L=L.slice();ue--;)Q=L[ue]%w,K=L[ue]/w|0,q=de*Q+K*he,M=he*Q+q%w*w+H,H=(M/U|0)+(q/w|0)+de*K,L[ue]=M%U;return H&&(L=[H].concat(L)),L}function b(L,P,U,q){var M,Q;if(U!=q)Q=U>q?1:-1;else for(M=Q=0;MP[M]?1:-1;break}return Q}function x(L,P,U,q){for(var M=0;U--;)L[U]-=M,M=L[U]1;L.splice(0,1));}return function(L,P,U,q,M){var Q,K,H,ue,he,de,Re,be,xe,Be,Ie,Pe,us,Ze,et,Ar,ze,Ue=L.s==P.s?1:-1,jt=L.c,Ce=P.c;if(!jt||!jt[0]||!Ce||!Ce[0])return new l(!L.s||!P.s||(jt?Ce&&jt[0]==Ce[0]:!Ce)?NaN:jt&&jt[0]==0||!Ce?Ue*0:Ue/0);for(be=new l(Ue),xe=be.c=[],K=L.e-P.e,Ue=U+K+1,M||(M=a,K=T(L.e/u)-T(P.e/u),Ue=Ue/u|0),H=0;Ce[H]==(jt[H]||0);H++);if(Ce[H]>(jt[H]||0)&&K--,Ue<0)xe.push(1),ue=!0;else{for(Ze=jt.length,Ar=Ce.length,H=0,Ue+=2,he=n(M/(Ce[0]+1)),he>1&&(Ce=E(Ce,he,M),jt=E(jt,he,M),Ar=Ce.length,Ze=jt.length),us=Ar,Be=jt.slice(0,Ar),Ie=Be.length;Ie=M/2&&et++;do{if(he=0,Q=b(Ce,Be,Ar,Ie),Q<0){if(Pe=Be[0],Ar!=Ie&&(Pe=Pe*M+(Be[1]||0)),he=n(Pe/et),he>1)for(he>=M&&(he=M-1),de=E(Ce,he,M),Re=de.length,Ie=Be.length;b(de,Be,Re,Ie)==1;)he--,x(de,Ar=10;Ue/=10,H++);ee(be,U+(be.e=H+K*u-1)+1,q,ue)}else be.e=K,be.r=+ue;return be}}();function C(E,b,x,L){var P,U,q,M,Q;if(x==null?x=X:$(x,0,8),!E.c)return E.toString();if(P=E.c[0],q=E.e,b==null)Q=V(E.c),Q=L==1||L==2&&(q<=A||q>=c)?Y(Q,q):j(Q,q,"0");else if(E=ee(new l(E),b,x),U=E.e,Q=V(E.c),M=Q.length,L==1||L==2&&(b<=U||U<=A)){for(;MM){if(--b>0)for(Q+=".";b--;Q+="0");}else if(b+=U-M,b>0)for(U+1==M&&(Q+=".");b--;Q+="0");return E.s<0&&P?"-"+Q:Q}function Z(E,b){for(var x,L=1,P=new l(E[0]);L=10;P/=10,L++);return(x=L+x*u-1)>g?E.c=E.e=null:x=10;M/=10,P++);if(U=b-P,U<0)U+=u,q=b,Q=ue[K=0],H=Q/he[P-q-1]%10|0;else if(K=i((U+1)/u),K>=ue.length)if(L){for(;ue.length<=K;ue.push(0));Q=H=0,P=1,U%=u,q=U-u+1}else break e;else{for(Q=M=ue[K],P=1;M>=10;M/=10,P++);U%=u,q=U-u+P,H=q<0?0:Q/he[P-q-1]%10|0}if(L=L||b<0||ue[K+1]!=null||(q<0?Q:Q%he[P-q-1]),L=x<4?(H||L)&&(x==0||x==(E.s<0?3:2)):H>5||H==5&&(x==4||L||x==6&&(U>0?q>0?Q/he[P-q]:0:ue[K-1])%10&1||x==(E.s<0?8:7)),b<1||!ue[0])return ue.length=0,L?(b-=E.e+1,ue[0]=he[(u-b%u)%u],E.e=-b||0):ue[0]=E.e=0,E;if(U==0?(ue.length=K,M=1,K--):(ue.length=K+1,M=he[u-U],ue[K]=q>0?n(Q/he[P-q]%he[q])*M:0),L)for(;;)if(K==0){for(U=1,q=ue[0];q>=10;q/=10,U++);for(q=ue[0]+=M,M=1;q>=10;q/=10,M++);U!=M&&(E.e++,ue[0]==a&&(ue[0]=1));break}else{if(ue[K]+=M,ue[K]!=a)break;ue[K--]=0,M=1}for(U=ue.length;ue[--U]===0;ue.pop());}E.e>g?E.c=E.e=null:E.e=c?Y(b,x):j(b,x,"0"),E.s<0?"-"+b:b)}return G.absoluteValue=G.abs=function(){var E=new l(this);return E.s<0&&(E.s=1),E},G.comparedTo=function(E,b){return z(this,new l(E,b))},G.decimalPlaces=G.dp=function(E,b){var x,L,P,U=this;if(E!=null)return $(E,0,N),b==null?b=X:$(b,0,8),ee(new l(U),E+U.e+1,b);if(!(x=U.c))return null;if(L=((P=x.length-1)-T(this.e/u))*u,P=x[P])for(;P%10==0;P/=10,L--);return L<0&&(L=0),L},G.dividedBy=G.div=function(E,b){return k(this,new l(E,b),J,X)},G.dividedToIntegerBy=G.idiv=function(E,b){return k(this,new l(E,b),0,1)},G.exponentiatedBy=G.pow=function(E,b){var x,L,P,U,q,M,Q,K,H,ue=this;if(E=new l(E),E.c&&!E.isInteger())throw Error(s+"Exponent not an integer: "+ae(E));if(b!=null&&(b=new l(b)),M=E.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!E.c||!E.c[0])return H=new l(Math.pow(+ae(ue),M?2-se(E):+ae(E))),b?H.mod(b):H;if(Q=E.s<0,b){if(b.c?!b.c[0]:!b.s)return new l(NaN);L=!Q&&ue.isInteger()&&b.isInteger(),L&&(ue=ue.mod(b))}else{if(E.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||M&&ue.c[1]>=24e7:ue.c[0]<8e13||M&&ue.c[0]<=9999975e7)))return U=ue.s<0&&se(E)?-0:0,ue.e>-1&&(U=1/U),new l(Q?1/U:U);S&&(U=i(S/u+2))}for(M?(x=new l(.5),Q&&(E.s=1),K=se(E)):(P=Math.abs(+ae(E)),K=P%2),H=new l(ce);;){if(K){if(H=H.times(ue),!H.c)break;U?H.c.length>U&&(H.c.length=U):L&&(H=H.mod(b))}if(P){if(P=n(P/2),P===0)break;K=P%2}else if(E=E.times(x),ee(E,E.e+1,1),E.e>14)K=se(E);else{if(P=+ae(E),P===0)break;K=P%2}ue=ue.times(ue),U?ue.c&&ue.c.length>U&&(ue.c.length=U):L&&(ue=ue.mod(b))}return L?H:(Q&&(H=ce.div(H)),b?H.mod(b):U?ee(H,S,X,q):H)},G.integerValue=function(E){var b=new l(this);return E==null?E=X:$(E,0,8),ee(b,b.e+1,E)},G.isEqualTo=G.eq=function(E,b){return z(this,new l(E,b))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(E,b){return z(this,new l(E,b))>0},G.isGreaterThanOrEqualTo=G.gte=function(E,b){return(b=z(this,new l(E,b)))===1||b===0},G.isInteger=function(){return!!this.c&&T(this.e/u)>this.c.length-2},G.isLessThan=G.lt=function(E,b){return z(this,new l(E,b))<0},G.isLessThanOrEqualTo=G.lte=function(E,b){return(b=z(this,new l(E,b)))===-1||b===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(E,b){var x,L,P,U,q=this,M=q.s;if(E=new l(E,b),b=E.s,!M||!b)return new l(NaN);if(M!=b)return E.s=-b,q.plus(E);var Q=q.e/u,K=E.e/u,H=q.c,ue=E.c;if(!Q||!K){if(!H||!ue)return H?(E.s=-b,E):new l(ue?q:NaN);if(!H[0]||!ue[0])return ue[0]?(E.s=-b,E):new l(H[0]?q:X==3?-0:0)}if(Q=T(Q),K=T(K),H=H.slice(),M=Q-K){for((U=M<0)?(M=-M,P=H):(K=Q,P=ue),P.reverse(),b=M;b--;P.push(0));P.reverse()}else for(L=(U=(M=H.length)<(b=ue.length))?M:b,M=b=0;b0)for(;b--;H[x++]=0);for(b=a-1;L>M;){if(H[--L]=0;){for(x=0,he=Pe[P]%xe,de=Pe[P]/xe|0,q=Q,U=P+q;U>P;)K=Ie[--q]%xe,H=Ie[q]/xe|0,M=de*K+H*he,K=he*K+M%xe*xe+Re[U]+x,x=(K/be|0)+(M/xe|0)+de*H,Re[U--]=K%be;Re[U]=x}return x?++L:Re.splice(0,1),ie(E,Re,L)},G.negated=function(){var E=new l(this);return E.s=-E.s||null,E},G.plus=function(E,b){var x,L=this,P=L.s;if(E=new l(E,b),b=E.s,!P||!b)return new l(NaN);if(P!=b)return E.s=-b,L.minus(E);var U=L.e/u,q=E.e/u,M=L.c,Q=E.c;if(!U||!q){if(!M||!Q)return new l(P/0);if(!M[0]||!Q[0])return Q[0]?E:new l(M[0]?L:P*0)}if(U=T(U),q=T(q),M=M.slice(),P=U-q){for(P>0?(q=U,x=Q):(P=-P,x=M),x.reverse();P--;x.push(0));x.reverse()}for(P=M.length,b=Q.length,P-b<0&&(x=Q,Q=M,M=x,b=P),P=0;b;)P=(M[--b]=M[b]+Q[b]+P)/a|0,M[b]=a===M[b]?0:M[b]%a;return P&&(M=[P].concat(M),++q),ie(E,M,q)},G.precision=G.sd=function(E,b){var x,L,P,U=this;if(E!=null&&E!==!!E)return $(E,1,N),b==null?b=X:$(b,0,8),ee(new l(U),E,b);if(!(x=U.c))return null;if(P=x.length-1,L=P*u+1,P=x[P]){for(;P%10==0;P/=10,L--);for(P=x[0];P>=10;P/=10,L++);}return E&&U.e+1>L&&(L=U.e+1),L},G.shiftedBy=function(E){return $(E,-h,h),this.times("1e"+E)},G.squareRoot=G.sqrt=function(){var E,b,x,L,P,U=this,q=U.c,M=U.s,Q=U.e,K=J+4,H=new l("0.5");if(M!==1||!q||!q[0])return new l(!M||M<0&&(!q||q[0])?NaN:q?U:1/0);if(M=Math.sqrt(+ae(U)),M==0||M==1/0?(b=V(q),(b.length+Q)%2==0&&(b+="0"),M=Math.sqrt(+b),Q=T((Q+1)/2)-(Q<0||Q%2),M==1/0?b="5e"+Q:(b=M.toExponential(),b=b.slice(0,b.indexOf("e")+1)+Q),x=new l(b)):x=new l(M+""),x.c[0]){for(Q=x.e,M=Q+K,M<3&&(M=0);;)if(P=x,x=H.times(P.plus(k(U,P,K,1))),V(P.c).slice(0,M)===(b=V(x.c)).slice(0,M))if(x.e0&&Re>0){for(U=Re%M||M,H=de.substr(0,U);U0&&(H+=K+de.slice(U)),he&&(H="-"+H)}L=ue?H+(x.decimalSeparator||"")+((Q=+x.fractionGroupSize)?ue.replace(new RegExp("\\d{"+Q+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):ue):H}return(x.prefix||"")+L+(x.suffix||"")},G.toFraction=function(E){var b,x,L,P,U,q,M,Q,K,H,ue,he,de=this,Re=de.c;if(E!=null&&(M=new l(E),!M.isInteger()&&(M.c||M.s!==1)||M.lt(ce)))throw Error(s+"Argument "+(M.isInteger()?"out of range: ":"not an integer: ")+ae(M));if(!Re)return new l(de);for(b=new l(ce),K=x=new l(ce),L=Q=new l(ce),he=V(Re),U=b.e=he.length-de.e-1,b.c[0]=p[(q=U%u)<0?u+q:q],E=!E||M.comparedTo(b)>0?U>0?b:K:M,q=g,g=1/0,M=new l(he),Q.c[0]=0;H=k(M,b,0,1),P=x.plus(H.times(L)),P.comparedTo(E)!=1;)x=L,L=P,K=Q.plus(H.times(P=K)),Q=P,b=M.minus(H.times(P=b)),M=P;return P=k(E.minus(x),L,0,1),Q=Q.plus(P.times(K)),x=x.plus(P.times(L)),Q.s=K.s=de.s,U=U*2,ue=k(K,L,U,X).minus(de).abs().comparedTo(k(Q,x,U,X).minus(de).abs())<1?[K,L]:[Q,x],g=q,ue},G.toNumber=function(){return+ae(this)},G.toPrecision=function(E,b){return E!=null&&$(E,1,N),C(this,E,b,2)},G.toString=function(E){var b,x=this,L=x.s,P=x.e;return P===null?L?(b="Infinity",L<0&&(b="-"+b)):b="NaN":(E==null?b=P<=A||P>=c?Y(V(x.c),P):j(V(x.c),P,"0"):E===10?(x=ee(new l(x),J+P+1,X),b=j(V(x.c),x.e,"0")):($(E,2,I.length,"Base"),b=R(j(V(x.c),P,"0"),10,E,L,!0)),L<0&&x.c[0]&&(b="-"+b)),b},G.valueOf=G.toJSON=function(){return ae(this)},G._isBigNumber=!0,W!=null&&l.set(W),l}function T(W){var k=W|0;return W>0||W===k?k:k-1}function V(W){for(var k,R,F=1,G=W.length,ce=W[0]+"";Fc^R?1:-1;for(X=(A=G.length)<(c=ce.length)?A:c,J=0;Jce[J]^R?1:-1;return A==c?0:A>c^R?1:-1}function $(W,k,R,F){if(WR||W!==n(W))throw Error(s+(F||"Argument")+(typeof W=="number"?WR?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function se(W){var k=W.c.length-1;return T(W.e/u)==k&&W.c[k]%2!=0}function Y(W,k){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(k<0?"e":"e+")+k}function j(W,k,R){var F,G;if(k<0){for(G=R+".";++k;G+=R);W=G+W}else if(F=W.length,++k>F){for(G=R,k-=F;--k;G+=R);W+=G}else k{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.ErrGasLimitShouldBe0ForInnerTransaction=ge.ErrInvalidRelayedV2BuilderArguments=ge.ErrInvalidRelayedV1BuilderArguments=ge.ErrNotImplemented=ge.ErrContractInteraction=ge.ErrCodec=ge.ErrCannotParseTransactionOutcome=ge.ErrCannotParseContractResults=ge.ErrMissingFieldOnEnum=ge.ErrMissingFieldOnStruct=ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ge.ErrTypingSystem=ge.ErrMock=ge.ErrContractHasNoAddress=ge.ErrContract=ge.ErrExpectedTransactionEventsNotFound=ge.ErrExpectedTransactionStatusNotReached=ge.ErrTransactionWatcherTimeout=ge.ErrAsyncTimerAborted=ge.ErrAsyncTimerAlreadyRunning=ge.ErrInvalidFunctionName=ge.ErrSignatureCannotCreate=ge.ErrTransactionOptionsInvalid=ge.ErrTransactionVersionInvalid=ge.ErrNonceInvalid=ge.ErrNotEnoughGas=ge.ErrAddressEmpty=ge.ErrAddressBadHrp=ge.ErrAddressCannotCreate=ge.ErrUnexpectedCondition=ge.ErrInvariantFailed=ge.ErrBadType=ge.ErrUnsupportedOperation=ge.ErrInvalidArgument=ge.Err=void 0;var Le=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}};ge.Err=Le;var T0=class extends Le{constructor(e,t){super(`Invalid argument: ${e}`,t)}};ge.ErrInvalidArgument=T0;var N0=class extends Le{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};ge.ErrUnsupportedOperation=N0;var D0=class extends Le{constructor(e,t,i){super(`Bad type of "${e}": ${i}. Expected type: ${t}`)}};ge.ErrBadType=D0;var O0=class extends Le{constructor(e){super(`Invariant failed: [${e}]`)}};ge.ErrInvariantFailed=O0;var P0=class extends Le{constructor(e){super(`Unexpected condition: [${e}]`)}};ge.ErrUnexpectedCondition=P0;var B0=class extends Le{constructor(e,t){let i=`Cannot create address from: ${e}`;super(i,t)}};ge.ErrAddressCannotCreate=B0;var M0=class extends Le{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};ge.ErrAddressBadHrp=M0;var R0=class extends Le{constructor(){super("Address is empty")}};ge.ErrAddressEmpty=R0;var L0=class extends Le{constructor(e){super(`Not enough gas provided: ${e}`)}};ge.ErrNotEnoughGas=L0;var F0=class extends Le{constructor(e){super(`Invalid nonce: ${e}`)}};ge.ErrNonceInvalid=F0;var U0=class extends Le{constructor(e){super(`Invalid transaction version: ${e}`)}};ge.ErrTransactionVersionInvalid=U0;var q0=class extends Le{constructor(e){super(`Invalid transaction options: ${e}`)}};ge.ErrTransactionOptionsInvalid=q0;var V0=class extends Le{constructor(e,t){let i=`Cannot create signature from: ${e}`;super(i,t)}};ge.ErrSignatureCannotCreate=V0;var H0=class extends Le{constructor(){super("Invalid function name")}};ge.ErrInvalidFunctionName=H0;var Q0=class extends Le{constructor(){super("Async timer already running")}};ge.ErrAsyncTimerAlreadyRunning=Q0;var j0=class extends Le{constructor(){super("Async timer aborted")}};ge.ErrAsyncTimerAborted=j0;var G0=class extends Le{constructor(){super("TransactionWatcher has timed out")}};ge.ErrTransactionWatcherTimeout=G0;var K0=class extends Le{constructor(){super("Expected transaction status not reached")}};ge.ErrExpectedTransactionStatusNotReached=K0;var z0=class extends Le{constructor(){super("Expected transaction events not found")}};ge.ErrExpectedTransactionEventsNotFound=z0;var Ql=class extends Le{constructor(e){super(e)}};ge.ErrContract=Ql;var k0=class extends Ql{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). -`)}};ge.ErrContractHasNoAddress=k0;var W0=class extends Re{constructor(e){super(e)}};ge.ErrMock=W0;var jl=class extends Re{constructor(e){super(e)}};ge.ErrTypingSystem=jl;var $0=class extends jl{constructor(e){super(` +`)}};ge.ErrContractHasNoAddress=k0;var W0=class extends Le{constructor(e){super(e)}};ge.ErrMock=W0;var jl=class extends Le{constructor(e){super(e)}};ge.ErrTypingSystem=jl;var $0=class extends jl{constructor(e){super(` argument at position ${e} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input. This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead. Also see https://github.com/multiversx/mx-sdk-js-core/pull/187. -`)}};ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=$0;var Y0=class extends Re{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};ge.ErrMissingFieldOnStruct=Y0;var J0=class extends Re{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};ge.ErrMissingFieldOnEnum=J0;var X0=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};ge.ErrCannotParseContractResults=X0;var Z0=class extends Re{constructor(e,t){super(`cannot parse outcome of transaction ${e}: ${t}`)}};ge.ErrCannotParseTransactionOutcome=Z0;var eg=class extends Re{constructor(e){super(e)}};ge.ErrCodec=eg;var tg=class extends Re{constructor(e){super(e)}};ge.ErrContractInteraction=tg;var rg=class extends Re{constructor(){super("Method not yet implemented")}};ge.ErrNotImplemented=rg;var ig=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};ge.ErrInvalidRelayedV1BuilderArguments=ig;var ng=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};ge.ErrInvalidRelayedV2BuilderArguments=ng;var sg=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ge.ErrGasLimitShouldBe0ForInnerTransaction=sg});var og=B(xo=>{"use strict";f();var oP=xo&&xo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xo,"__esModule",{value:!0});xo.TokenPayment=void 0;var zu=oP(jr()),aP=Ye(),eA="EGLD",tA=18;zu.default.set({ROUNDING_MODE:1});var Gi=class{constructor(e,t,i,n){let s=new zu.default(i);if(!s.isInteger()||s.isNegative())throw new aP.ErrInvalidArgument(`bad amountAsBigInteger: ${i}`);this.tokenIdentifier=e,this.nonce=t,this.amountAsBigInteger=s,this.numDecimals=n}static egldFromAmount(e){let t=new zu.default(e).shiftedBy(tA).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new Gi(eA,0,e,tA)}static fungibleFromAmount(e,t,i){let n=new zu.default(t).shiftedBy(i).decimalPlaces(0);return this.fungibleFromBigInteger(e,n,i)}static fungibleFromBigInteger(e,t,i=0){return new Gi(e,0,t,i)}static nonFungible(e,t){return new Gi(e,t,1,0)}static semiFungible(e,t,i){return new Gi(e,t,i,0)}static metaEsdtFromAmount(e,t,i,n){let s=new zu.default(i).shiftedBy(n).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,n)}static metaEsdtFromBigInteger(e,t,i,n=0){return new Gi(e,t,i,n)}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toRationalNumber()} ${this.tokenIdentifier}`}toRationalNumber(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==eA}isFungible(){return this.nonce==0}};xo.TokenPayment=Gi});var kl=B((mz,nA)=>{"use strict";f();var Kl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ag={};for(ku=0;ku>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function rA(r){for(var e=1,t=0;t126)return"Invalid prefix ("+r+")";e=To(e)^i>>5}for(e=To(e),t=0;tt)throw new TypeError("Exceeds length limit");r=r.toLowerCase();var i=rA(r);if(typeof i=="string")throw new Error(i);for(var n=r+"1",s=0;s>5)throw new Error("Non 5-bit word");i=To(i)^o,n+=Kl.charAt(o)}for(s=0;s<6;++s)i=To(i);for(i^=1,s=0;s<6;++s){var a=i>>(5-s)*5&31;n+=Kl.charAt(a)}return n}function iA(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var t=r.toLowerCase(),i=r.toUpperCase();if(r!==t&&r!==i)return"Mixed-case string "+r;r=t;var n=r.lastIndexOf("1");if(n===-1)return"No separator character for "+r;if(n===0)return"Missing prefix for "+r;var s=r.slice(0,n),o=r.slice(n+1);if(o.length<6)return"Data too short";var a=rA(s);if(typeof a=="string")return a;for(var u=[],h=0;h=o.length)&&u.push(w)}return a!==1?"Invalid checksum for "+r:{prefix:s,words:u}}function cP(){var r=iA.apply(null,arguments);if(typeof r=="object")return r}function lP(r){var e=iA.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zl(r,e,t,i){for(var n=0,s=0,o=(1<=t;)s-=t,a.push(n>>s&o);if(i)s>0&&a.push(n<=e)return"Excess padding";if(n<{"use strict";f();var gP=ai&&ai.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),yP=ai&&ai.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sA=ai&&ai.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gP(e,r,t);return yP(e,r),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.Address=void 0;var Wl=sA(kl()),No=sA(Ye()),ug="erd",cg=32,mP="0".repeat(16),Kt=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof Kt)return Kt.fromAddress(e);if(e instanceof y.Buffer)return Kt.fromBuffer(e);if(typeof e=="string")return Kt.fromString(e);throw new No.ErrAddressCannotCreate(e)}}static fromAddress(e){return Kt.fromValidHex(e.valueHex)}static fromValidHex(e){let t=new Kt;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=cg)throw new No.ErrAddressCannotCreate(e);return Kt.fromValidHex(e.toString("hex"))}static fromString(e){return Kt.isValidHex(e)?Kt.fromValidHex(e):Kt.fromBech32(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==cg}static fromHex(e){if(!Kt.isValidHex(e))throw new No.ErrAddressCannotCreate(e);return Kt.fromValidHex(e)}static fromBech32(e){let t;try{t=Wl.decode(e)}catch(s){throw new No.ErrAddressCannotCreate(e,s)}let i=t.prefix;if(i!=ug)throw new No.ErrAddressBadHrp(ug,i);let n=y.Buffer.from(Wl.fromWords(t.words));if(n.length!=cg)throw new No.ErrAddressCannotCreate(e);return Kt.fromValidHex(n.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Wl.toWords(this.pubkey());return Wl.encode(ug,e)}pubkey(){return this.isEmpty()?y.Buffer.from([]):y.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 Kt("0".repeat(64))}isContractAddress(){return this.hex().startsWith(mP)}};ai.Address=Kt});var Wu=B(tt=>{"use strict";f();Object.defineProperty(tt,"__esModule",{value:!0});tt.ARGUMENTS_SEPARATOR=tt.ESDT_TRANSFER_VALUE=tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_GAS_LIMIT=tt.TRANSACTION_VERSION_TX_HASH_SIGN=tt.TRANSACTION_VERSION_DEFAULT=tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=tt.TRANSACTION_OPTIONS_DEFAULT=tt.TRANSACTION_MIN_GAS_PRICE=void 0;tt.TRANSACTION_MIN_GAS_PRICE=1e9;tt.TRANSACTION_OPTIONS_DEFAULT=0;tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;tt.TRANSACTION_VERSION_DEFAULT=1;tt.TRANSACTION_VERSION_TX_HASH_SIGN=2;tt.ESDT_TRANSFER_GAS_LIMIT=5e5;tt.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";tt.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";tt.ESDT_TRANSFER_VALUE="0";tt.ARGUMENTS_SEPARATOR="@"});var Tr=B(rt=>{"use strict";f();var wP=rt&&rt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),vP=rt&&rt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),EP=rt&&rt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wP(e,r,t);return vP(e,r),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.isEmpty=rt.guardEmpty=rt.guardNotEmpty=rt.guardLength=rt.guardSameLength=rt.guardValueIsSetWithMessage=rt.guardValueIsSet=rt.guardTrue=void 0;var Do=EP(Ye());function AP(r,e){if(!r)throw new Do.ErrInvariantFailed(`[<${e}>] isn't true`)}rt.guardTrue=AP;function IP(r,e){oA(`${r} isn't set (null or undefined)`,e)}rt.guardValueIsSet=IP;function oA(r,e){if(e==null||e===void 0)throw new Do.ErrInvariantFailed(r)}rt.guardValueIsSetWithMessage=oA;function _P(r,e){if(r=r||[],e=e||[],r.length!=e.length)throw new Do.ErrInvariantFailed("arrays do not have the same length")}rt.guardSameLength=_P;function bP(r,e){let t=r.length||0;if(t!=e)throw new Do.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${t}`)}rt.guardLength=bP;function CP(r,e){if(lg(r))throw new Do.ErrInvariantFailed(`${e} is empty`)}rt.guardNotEmpty=CP;function SP(r,e){if(!lg(r))throw new Do.ErrInvariantFailed(`${e} is not empty`)}rt.guardEmpty=SP;function lg(r){return r.isEmpty?r.isEmpty():r.length===0}rt.isEmpty=lg});var aA=B($l=>{"use strict";f();Object.defineProperty($l,"__esModule",{value:!0});$l.getJavascriptPrototypesInHierarchy=void 0;function xP(r,e){let t=[],i=Object.getPrototypeOf(r);for(;i&&e(i);)t.push(i),i=Object.getPrototypeOf(i);return t}$l.getJavascriptPrototypesInHierarchy=xP});var Ft=B(Lt=>{"use strict";f();Object.defineProperty(Lt,"__esModule",{value:!0});Lt.NullType=Lt.TypePlaceholder=Lt.isTyped=Lt.PrimitiveValue=Lt.TypedValue=Lt.CustomType=Lt.PrimitiveType=Lt.TypeCardinality=Lt.Type=void 0;var fg=aA(),uA=Tr(),Ir=class{constructor(e,t=[],i=Ki.fixed(1)){uA.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=i}getName(){return this.name}getClassName(){return Ir.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(t=>t.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 uA.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(i=>i.toString()).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return Ir.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every((i,n)=>i.equals(t[n]))}static isAssignableFromMany(e,t){return e.every((i,n)=>i.isAssignableFrom(t[n]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!Ir.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let i=this.getFullyQualifiedName();return Ir.getFullyQualifiedNamesInHierarchy(e).includes(i)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return fg.getJavascriptPrototypesInHierarchy(e,n=>n.belongsToTypesystem).map(n=>n.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Lt.Type=Ir;Ir.ClassName="Type";var Ki=class{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new Ki(e,e)}static variable(e){return new Ki(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||Ki.MaxCardinality}};Lt.TypeCardinality=Ki;Ki.MaxCardinality=4096;var Oo=class extends Ir{constructor(e){super(e)}getClassName(){return Oo.ClassName}};Lt.PrimitiveType=Oo;Oo.ClassName="PrimitiveType";var Po=class extends Ir{getClassName(){return Po.ClassName}};Lt.CustomType=Po;Po.ClassName="CustomType";var hs=class{constructor(e){this.type=e}getClassName(){return hs.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Lt.TypedValue=hs;hs.ClassName="TypedValue";var Bo=class extends hs{constructor(e){super(e)}getClassName(){return Bo.ClassName}};Lt.PrimitiveValue=Bo;Bo.ClassName="PrimitiveValue";function TP(r){return r.belongsToTypesystem!==void 0}Lt.isTyped=TP;var Mo=class extends Ir{constructor(){super("...")}getClassName(){return Mo.ClassName}};Lt.TypePlaceholder=Mo;Mo.ClassName="TypePlaceholder";var Ro=class extends Ir{constructor(){super("?")}getClassName(){return Ro.ClassName}};Lt.NullType=Ro;Ro.ClassName="NullType"});var cA=B((Lo,Fo)=>{f();(function(r){var e=typeof Lo=="object"&&Lo&&!Lo.nodeType&&Lo,t=typeof Fo=="object"&&Fo&&!Fo.nodeType&&Fo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var n,s=2147483647,o=36,a=1,u=26,h=38,p=700,w=72,N=128,O="-",T=/^xn--/,V=/[^\x20-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,$={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},se=o-a,Y=Math.floor,j=String.fromCharCode,W;function k(v){throw new RangeError($[v])}function R(v,S){for(var D=v.length,I=[];D--;)I[D]=S(v[D]);return I}function F(v,S){var D=v.split("@"),I="";D.length>1&&(I=D[0]+"@",v=D[1]),v=v.replace(z,".");var l=v.split("."),C=R(l,S).join(".");return I+C}function G(v){for(var S=[],D=0,I=v.length,l,C;D=55296&&l<=56319&&D65535&&(S-=65536,D+=j(S>>>10&1023|55296),S=56320|S&1023),D+=j(S),D}).join("")}function J(v){return v-48<10?v-22:v-65<26?v-65:v-97<26?v-97:o}function X(v,S){return v+22+75*(v<26)-((S!=0)<<5)}function A(v,S,D){var I=0;for(v=D?Y(v/p):v>>1,v+=Y(v/S);v>se*u>>1;I+=o)v=Y(v/se);return Y(I+(se+1)*v/(v+h))}function c(v){var S=[],D=v.length,I,l=0,C=N,Z=w,ie,ee,ae,E,b,x,L,P,U;for(ie=v.lastIndexOf(O),ie<0&&(ie=0),ee=0;ee=128&&k("not-basic"),S.push(v.charCodeAt(ee));for(ae=ie>0?ie+1:0;ae=D&&k("invalid-input"),L=J(v.charCodeAt(ae++)),(L>=o||L>Y((s-l)/b))&&k("overflow"),l+=L*b,P=x<=Z?a:x>=Z+u?u:x-Z,!(LY(s/U)&&k("overflow"),b*=U;I=S.length+1,Z=A(l-E,I,E==0),Y(l/I)>s-C&&k("overflow"),C+=Y(l/I),l%=I,S.splice(l++,0,C)}return ce(S)}function d(v){var S,D,I,l,C,Z,ie,ee,ae,E,b,x=[],L,P,U,q;for(v=G(v),L=v.length,S=N,D=0,C=w,Z=0;Z=S&&bY((s-D)/P)&&k("overflow"),D+=(ie-S)*P,S=ie,Z=0;Zs&&k("overflow"),b==S){for(ee=D,ae=o;E=ae<=C?a:ae>=C+u?u:ae-C,!(ee{"use strict";f();var fA=cA();function NP(r,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=r}function hg(r){return r>="0"&&r<="7"}function DP(r){return r>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F"}function lA(r){return r=parseInt(r,16),fA.ucs2.encode([r])}function hA(r,e,t){var i=!1,n=[];function s(u){var h=r[u];if(!DP(h))throw new NP(u,"Unexpected token ILLEGAL");return h}for(;e{f();var yA=dA();vA.exports={validate:OP,parse:PP};function OP(r,e){var t;if(e=e||!1,typeof r!="string")t="Input must be a string";else try{Yl(r,0,e,!1)}catch(i){t=i.message}return t}function PP(r,e){if(typeof r!="string")throw new Error("Input must be a string");e=e||!1;var t=Yl(r,0,e,!0);return t.value}function mA(r,e){for(var t=r.length,i=e,n,s=e;s-1&&r[t]==="\\";)i++,t--;return i%2===0}function LP(r,e,t,i){for(var n=e,s=",",o=[],a=e;ds(r[a]);)a++;if(r[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Yl(r,n,t,i),h=mA(r,u.end);i&&o.push(u.value),n=h.end,s=h.value}return{start:e,end:n,value:o}}function FP(r,e){return r.substr(e,4)==="true"}function UP(r,e){return r.substr(e,5)==="false"}function qP(r,e){return r.substr(e,4)==="null"}var VP=new RegExp(/^\s$/);function ds(r){return VP.test(r)}var HP=new RegExp(/^\d$/);function pA(r){return HP.test(r)}function zi(r,e,t){var i=10,n;r.length{"use strict";f();var QP=ui&&ui.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),jP=ui&&ui.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),GP=ui&&ui.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&QP(e,r,t);return jP(e,r),e};Object.defineProperty(ui,"__esModule",{value:!0});ui.TypeExpressionParser=void 0;var AA=GP(Ye()),KP=Ft(),zP=EA(),pg=class{parse(e){let t=this.doParse(e),i=Object.keys(t);if(i.length!=1)throw new AA.ErrTypingSystem(`bad type expression: ${e}`);let n=i[0];return this.nodeToType(n,t[n])}doParse(e){let t=this.getJsonedString(e);try{return zP.parse(t)}catch{throw new AA.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${t}.`)}}getJsonedString(e){let t="";for(var i=0;i"?a!=">"?t+=": {} }":t+="}":o==","?u==">"||(a==">"?t+=",":t+=": {},"):t+=o}let n=/(:|\{|\}|,|\s)/,s=t.replace(/utf\-8\sstring/ig,"utf-8-string").split(n).filter(o=>o);return t=s.map(o=>n.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${t}: {}}`:`{${t}}`}nodeToType(e,t){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let i=Object.keys(t).map(n=>this.nodeToType(n,t[n]));return new KP.Type(e,i)}};ui.TypeExpressionParser=pg});var Zl=B(hn=>{"use strict";f();Object.defineProperty(hn,"__esModule",{value:!0});hn.EndpointParameterDefinition=hn.EndpointModifiers=hn.EndpointDefinition=void 0;var kP=Jl(),IA="?",WP="N / A",$u=class{constructor(e,t,i,n){this.input=[],this.output=[],this.name=e,this.input=t||[],this.output=i||[],this.modifiers=n}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?IA:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let t=e.inputs.map(s=>ps.fromJSON(s)),i=e.outputs.map(s=>ps.fromJSON(s)),n=new Xl(e.mutability,e.payableInTokens);return new $u(e.name,t,i,n)}};hn.EndpointDefinition=$u;var Xl=class{constructor(e,t){this.mutability=e||"",this.payableInTokens=t||[]}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"}};hn.EndpointModifiers=Xl;var ps=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new kP.TypeExpressionParser().parse(e.type);return new ps(e.name||IA,e.description||WP,t)}};hn.EndpointParameterDefinition=ps});var gg=B(ef=>{"use strict";f();Object.defineProperty(ef,"__esModule",{value:!0});ef.ContractInterface=void 0;var $P=Tr(),_A=Zl(),YP="?",Yu=class{constructor(e,t,i){this.endpoints=[],this.name=e,this.constructorDefinition=t,this.endpoints=i}static fromJSON(e){e.name=e.name||YP,e.endpoints=e.endpoints||[];let t=JP(e),i=e.endpoints.map(n=>_A.EndpointDefinition.fromJSON(n));return new Yu(e.name,t,i)}getConstructorDefinition(){return this.constructorDefinition}getEndpoint(e){let t=this.endpoints.find(i=>i.name==e);return $P.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}};ef.ContractInterface=Yu;function JP(r){if(r.constructor.inputs===void 0||r.constructor.outputs===void 0)return null;let e=Object.assign({name:"constructor"},r.constructor);return _A.EndpointDefinition.fromJSON(e)}});var Uo=B(gr=>{"use strict";f();var XP=gr&&gr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),ZP=gr&&gr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),eB=gr&&gr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&XP(e,r,t);return ZP(e,r),e};Object.defineProperty(gr,"__esModule",{value:!0});gr.Fields=gr.Field=gr.FieldDefinition=void 0;var yg=eB(Ye()),tB=Jl(),Ju=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new tB.TypeExpressionParser().parse(e.type);return new Ju(e.name,e.description,t)}};gr.FieldDefinition=Ju;var mg=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){let t=this.value.getType();if(!t.equals(e.type))throw new yg.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new yg.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};gr.Field=mg;var wg=class{static checkTyping(e,t){if(e.length!=t.length)throw new yg.ErrTypingSystem("fields length vs. field definitions length");for(let i=0;i{"use strict";f();Object.defineProperty(pn,"__esModule",{value:!0});pn.EnumValue=pn.EnumVariantDefinition=pn.EnumType=void 0;var rB=Ye(),vg=Tr(),tf=Uo(),CA=Ft(),bA=256,gs=class extends CA.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return gs.ClassName}static fromJSON(e){let t=(e.variants||[]).map(i=>qo.fromJSON(i));return new gs(e.name,t)}getVariantByDiscriminant(e){let t=this.variants.find(i=>i.discriminant==e);return vg.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find(i=>i.name==e);return vg.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){let e=[];for(let t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}};pn.EnumType=gs;gs.ClassName="EnumType";var qo=class{constructor(e,t,i=[]){this.fieldsDefinitions=[],vg.guardTrue(ttf.FieldDefinition.fromJSON(i));return new qo(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return tf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};pn.EnumVariantDefinition=qo;var dn=class extends CA.TypedValue{constructor(e,t,i){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=i,this.fieldsByName=new Map(i.map(s=>[s.name,s]));let n=t.getFieldsDefinitions();tf.Fields.checkTyping(this.fields,n)}getClassName(){return dn.ClassName}static fromName(e,t){let i=e.getVariantByName(t);return new dn(e,i,[])}static fromDiscriminant(e,t){let i=e.getVariantByDiscriminant(t);return new dn(e,i,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields(),n=this.name==e.name,s=this.discriminant==e.discriminant,o=tf.Fields.equals(t,i);return n&&s&&o}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new rB.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(t=>e.fields[t.name]=t.value.valueOf()),e}};pn.EnumValue=dn;dn.ClassName="EnumValue"});var ms=B(Ho=>{"use strict";f();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.Struct=Ho.StructType=void 0;var iB=Ye(),rf=Uo(),SA=Ft(),ys=class extends SA.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return ys.ClassName}static fromJSON(e){let t=(e.fields||[]).map(i=>rf.FieldDefinition.fromJSON(i));return new ys(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return rf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ho.StructType=ys;ys.ClassName="StructType";var Vo=class extends SA.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map(i=>[i.name,i])),this.checkTyping()}getClassName(){return Vo.ClassName}checkTyping(){let t=this.getType().getFieldsDefinitions();rf.Fields.checkTyping(this.fields,t)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new iB.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields();return rf.Fields.equals(t,i)}};Ho.Struct=Vo;Vo.ClassName="Struct"});var Go=B(jo=>{"use strict";f();Object.defineProperty(jo,"__esModule",{value:!0});jo.AddressValue=jo.AddressType=void 0;var nB=Gr(),xA=Ft(),ws=class extends xA.PrimitiveType{constructor(){super("Address")}getClassName(){return ws.ClassName}};jo.AddressType=ws;ws.ClassName="AddressType";var Qo=class extends xA.PrimitiveValue{constructor(e){super(new ws),this.value=new nB.Address(e.bech32())}getClassName(){return Qo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};jo.AddressValue=Qo;Qo.ClassName="AddressValue"});var nf=B(Ko=>{"use strict";f();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.OptionalValue=Ko.OptionalType=void 0;var sB=Tr(),Zu=Ft(),gn=class extends Zu.Type{constructor(e){super("Optional",[e],Zu.TypeCardinality.variable(1))}getClassName(){return gn.ClassName}isAssignableFrom(e){if(!e.hasExactClass(gn.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(Zu.NullType.ClassName);return t||i}};Ko.OptionalType=gn;gn.ClassName="OptionalType";var vs=class extends Zu.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return vs.ClassName}static newMissing(){let e=new gn(new Zu.NullType);return new vs(e)}isSet(){return!!this.value}getTypedValue(){return sB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};Ko.OptionalValue=vs;vs.ClassName="OptionalValue"});var ec=B(ko=>{"use strict";f();Object.defineProperty(ko,"__esModule",{value:!0});ko.BooleanValue=ko.BooleanType=void 0;var TA=Ft(),Es=class extends TA.PrimitiveType{constructor(){super("bool")}getClassName(){return Es.ClassName}};ko.BooleanType=Es;Es.ClassName="BooleanType";var zo=class extends TA.PrimitiveValue{constructor(e){super(new Es),this.value=e}getClassName(){return zo.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ko.BooleanValue=zo;zo.ClassName="BooleanValue"});var mn=B(Wo=>{"use strict";f();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.BytesValue=Wo.BytesType=void 0;var NA=Ft(),As=class extends NA.PrimitiveType{constructor(){super("bytes")}getClassName(){return As.ClassName}};Wo.BytesType=As;As.ClassName="BytesType";var yn=class extends NA.PrimitiveValue{constructor(e){super(new As),this.value=e}getClassName(){return yn.ClassName}static fromUTF8(e){let t=y.Buffer.from(e,"utf-8");return new yn(t)}static fromHex(e){let t=y.Buffer.from(e,"hex");return new yn(t)}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()}};Wo.BytesValue=yn;yn.ClassName="BytesValue"});var OA=B($o=>{"use strict";f();Object.defineProperty($o,"__esModule",{value:!0});$o.CodeMetadataValue=$o.CodeMetadataType=void 0;var DA=Ft(),sf=class extends DA.PrimitiveType{constructor(){super("CodeMetadata")}};$o.CodeMetadataType=sf;var Eg=class extends DA.PrimitiveValue{constructor(e){super(new sf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};$o.CodeMetadataValue=Eg});var of=B(Yo=>{"use strict";f();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.CompositeValue=Yo.CompositeType=void 0;var oB=Tr(),Ag=Ft(),Is=class extends Ag.Type{constructor(...e){super("Composite",e,Ag.TypeCardinality.variable(e.length))}getClassName(){return Is.ClassName}};Yo.CompositeType=Is;Is.ClassName="CompositeType";var _s=class extends Ag.TypedValue{constructor(e,t){super(e),oB.guardLength(t,e.getTypeParameters().length),this.items=t}getClassName(){return _s.ClassName}static fromItems(...e){let t=e.map(n=>n.getType()),i=new Is(...t);return new _s(i,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 t=0;t{"use strict";f();Object.defineProperty(af,"__esModule",{value:!0});af.CollectionOfTypedValues=void 0;var Ig=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 t=0;t{"use strict";f();Object.defineProperty(ci,"__esModule",{value:!0});ci.List=ci.OptionValue=ci.ListType=ci.OptionType=void 0;var aB=Tr(),uB=_g(),bs=Ft(),li=class extends bs.Type{constructor(e){super("Option",[e])}getClassName(){return li.ClassName}isAssignableFrom(e){if(!e.hasExactClass(li.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(bs.NullType.ClassName);return t||i}};ci.OptionType=li;li.ClassName="OptionType";var Cs=class extends bs.Type{constructor(e){super("List",[e])}getClassName(){return Cs.ClassName}};ci.ListType=Cs;Cs.ClassName="ListType";var ki=class extends bs.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return ki.ClassName}static newMissing(){let e=new li(new bs.NullType);return new ki(e)}static newMissingTyped(e){return new ki(new li(e))}static newProvided(e){let t=new li(e.getType());return new ki(t,e)}isSet(){return!!this.value}getTypedValue(){return aB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ci.OptionValue=ki;ki.ClassName="OptionValue";var wn=class extends bs.TypedValue{constructor(e,t){super(e),this.backingCollection=new uB.CollectionOfTypedValues(t)}getClassName(){return wn.ClassName}static fromItems(e){if(e.length==0)return new wn(new bs.TypePlaceholder,[]);let t=e[0].getType(),i=new Cs(t);return new wn(i,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ci.List=wn;wn.ClassName="List"});var uf=B(Zo=>{"use strict";f();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.ArrayVec=Zo.ArrayVecType=void 0;var PA=Tr(),cB=_g(),BA=Ft(),Jo=class extends BA.Type{constructor(e,t){super("Array",[t]),PA.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return Jo.ClassName}};Zo.ArrayVecType=Jo;Jo.ClassName="ArrayVecType";var Xo=class extends BA.TypedValue{constructor(e,t){super(e),PA.guardLength(t,e.length),this.backingCollection=new cB.CollectionOfTypedValues(t)}getClassName(){return Xo.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Zo.ArrayVec=Xo;Xo.ClassName="ArrayVec"});var rc=B(ta=>{"use strict";f();Object.defineProperty(ta,"__esModule",{value:!0});ta.H256Value=ta.H256Type=void 0;var MA=Ft(),Ss=class extends MA.PrimitiveType{constructor(){super("H256")}getClassName(){return Ss.ClassName}};ta.H256Type=Ss;Ss.ClassName="H256Type";var ea=class extends MA.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ta.H256Value=ea;ea.ClassName="H256Value"});var cf=B(ia=>{"use strict";f();Object.defineProperty(ia,"__esModule",{value:!0});ia.NothingValue=ia.NothingType=void 0;var RA=Ft(),xs=class extends RA.PrimitiveType{constructor(){super("nothing")}getClassName(){return xs.ClassName}};ia.NothingType=xs;xs.ClassName="NothingType";var ra=class extends RA.PrimitiveValue{constructor(){super(new xs)}getClassName(){return ra.ClassName}equals(e){return!1}valueOf(){return{}}};ia.NothingValue=ra;ra.ClassName="NothingValue"});var ic=B(Ae=>{"use strict";f();var lB=Ae&&Ae.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),fB=Ae&&Ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),hB=Ae&&Ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&lB(e,r,t);return fB(e,r),e},dB=Ae&&Ae.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var LA=hB(Ye()),FA=Ft(),Us=dB(jr()),ir=class extends FA.PrimitiveType{constructor(e,t,i){super(e),this.sizeInBytes=t,this.withSign=i}getClassName(){return ir.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=ir;ir.ClassName="NumericalType";var Ts=class extends ir{constructor(){super("u8",1,!1)}getClassName(){return Ts.ClassName}};Ae.U8Type=Ts;Ts.ClassName="U8Type";var Ns=class extends ir{constructor(){super("i8",1,!0)}getClassName(){return Ns.ClassName}};Ae.I8Type=Ns;Ns.ClassName="I8Type";var Ds=class extends ir{constructor(){super("u16",2,!1)}getClassName(){return Ds.ClassName}};Ae.U16Type=Ds;Ds.ClassName="U16Type";var Os=class extends ir{constructor(){super("i16",2,!0)}getClassName(){return Os.ClassName}};Ae.I16Type=Os;Os.ClassName="I16Type";var Ps=class extends ir{constructor(){super("u32",4,!1)}getClassName(){return Ps.ClassName}};Ae.U32Type=Ps;Ps.ClassName="U32Type";var Bs=class extends ir{constructor(){super("i32",4,!0)}getClassName(){return Bs.ClassName}};Ae.I32Type=Bs;Bs.ClassName="I32Type";var Ms=class extends ir{constructor(){super("u64",8,!1)}getClassName(){return Ms.ClassName}};Ae.U64Type=Ms;Ms.ClassName="U64Type";var Rs=class extends ir{constructor(){super("i64",8,!0)}getClassName(){return Rs.ClassName}};Ae.I64Type=Rs;Rs.ClassName="I64Type";var Ls=class extends ir{constructor(){super("BigUint",0,!1)}getClassName(){return Ls.ClassName}};Ae.BigUIntType=Ls;Ls.ClassName="BigUIntType";var Fs=class extends ir{constructor(){super("Bigint",0,!0)}getClassName(){return Fs.ClassName}};Ae.BigIntType=Fs;Fs.ClassName="BigIntType";var nr=class extends FA.PrimitiveValue{constructor(e,t){if(super(e),this.value=new Us.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new LA.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new LA.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return nr.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=nr;nr.ClassName="NumericalValue";var na=class extends nr{constructor(e){super(new Ts,new Us.default(e))}getClassName(){return na.ClassName}};Ae.U8Value=na;na.ClassName="U8Value";var sa=class extends nr{constructor(e){super(new Ns,new Us.default(e))}getClassName(){return sa.ClassName}};Ae.I8Value=sa;sa.ClassName="I8Value";var oa=class extends nr{constructor(e){super(new Ds,new Us.default(e))}getClassName(){return oa.ClassName}};Ae.U16Value=oa;oa.ClassName="U16Value";var aa=class extends nr{constructor(e){super(new Os,new Us.default(e))}getClassName(){return aa.ClassName}};Ae.I16Value=aa;aa.ClassName="I16Value";var ua=class extends nr{constructor(e){super(new Ps,new Us.default(e))}getClassName(){return ua.ClassName}};Ae.U32Value=ua;ua.ClassName="U32Value";var ca=class extends nr{constructor(e){super(new Bs,new Us.default(e))}getClassName(){return ca.ClassName}};Ae.I32Value=ca;ca.ClassName="I32Value";var la=class extends nr{constructor(e){super(new Ms,e)}getClassName(){return la.ClassName}};Ae.U64Value=la;la.ClassName="U64Value";var fa=class extends nr{constructor(e){super(new Rs,e)}getClassName(){return fa.ClassName}};Ae.I64Value=fa;fa.ClassName="I64Value";var ha=class extends nr{constructor(e){super(new Ls,e)}getClassName(){return ha.ClassName}};Ae.BigUIntValue=ha;ha.ClassName="BigUIntValue";var da=class extends nr{constructor(e){super(new Fs,e)}getClassName(){return da.ClassName}};Ae.BigIntValue=da;da.ClassName="BigIntValue"});var lf=B(pa=>{"use strict";f();Object.defineProperty(pa,"__esModule",{value:!0});pa.StringValue=pa.StringType=void 0;var UA=Ft(),qs=class extends UA.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return qs.ClassName}};pa.StringType=qs;qs.ClassName="StringType";var vn=class extends UA.PrimitiveValue{constructor(e){super(new qs),this.value=e}getClassName(){return vn.ClassName}static fromUTF8(e){return new vn(e)}static fromHex(e){let t=y.Buffer.from(e,"hex").toString();return new vn(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};pa.StringValue=vn;vn.ClassName="StringValue"});var ya=B(ga=>{"use strict";f();Object.defineProperty(ga,"__esModule",{value:!0});ga.TokenIdentifierValue=ga.TokenIdentifierType=void 0;var qA=Ft(),pB="EGLD",Vs=class extends qA.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Vs.ClassName}};ga.TokenIdentifierType=Vs;Vs.ClassName="TokenIdentifierType";var En=class extends qA.PrimitiveValue{constructor(e){super(new Vs),this.value=e}static egld(){return new En(pB)}static esdtTokenIdentifier(e){return new En(e)}getClassName(){return En.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()}};ga.TokenIdentifierValue=En;En.ClassName="TokenIdentifierValue"});var ff=B(Nr=>{"use strict";f();var gB=Nr&&Nr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),yB=Nr&&Nr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),mB=Nr&&Nr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gB(e,r,t);return yB(e,r),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.Tuple=Nr.TupleType=void 0;var wB=mB(Ye()),vB=ms(),VA=Uo(),EB=ms(),Wi=class extends EB.StructType{constructor(...e){super(Wi.prepareName(e),Wi.prepareFieldDefinitions(e))}getClassName(){return Wi.ClassName}static prepareName(e){let t=e.map(n=>n.toString()).join(", ");return`tuple${t.length}<${t}>`}static prepareFieldDefinitions(e){return e.map((i,n)=>new VA.FieldDefinition(HA(n),"anonymous tuple field",i))}};Nr.TupleType=Wi;Wi.ClassName="TupleType";function HA(r){return`field${r}`}var Hs=class extends vB.Struct{constructor(e,t){super(e,t)}getClassName(){return Hs.ClassName}static fromItems(e){if(e.length<1)throw new wB.ErrTypingSystem("bad tuple items");let t=e.map(s=>s.getType()),i=new Wi(...t),n=e.map((s,o)=>new VA.Field(s,HA(o)));return new Hs(i,n)}};Nr.Tuple=Hs;Hs.ClassName="Tuple"});var df=B(ma=>{"use strict";f();Object.defineProperty(ma,"__esModule",{value:!0});ma.VariadicValue=ma.VariadicType=void 0;var hf=Ft(),In=class extends hf.Type{constructor(e){super("Variadic",[e],hf.TypeCardinality.variable())}getClassName(){return In.ClassName}};ma.VariadicType=In;In.ClassName="VariadicType";var An=class extends hf.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return An.ClassName}static fromItems(...e){if(e.length==0)return new An(new In(new hf.TypePlaceholder),[]);let t=e[0].getType();return new An(new In(t),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 t=0;t{"use strict";f();var AB=fi&&fi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),IB=fi&&fi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),_B=fi&&fi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&AB(e,r,t);return IB(e,r),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.TypeMapper=void 0;var QA=_B(Ye()),bB=Go(),bg=nf(),CB=ec(),SB=mn(),xB=OA(),pf=of(),Cg=Xu(),TB=Uo(),jA=tc(),gf=uf(),NB=rc(),GA=cf(),Dr=ic(),DB=lf(),KA=ms(),zA=ya(),_n=ff(),Sg=df(),xg=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...t)=>new jA.OptionType(t[0])],["List",(...t)=>new jA.ListType(t[0])],["VarArgs",(...t)=>new Sg.VariadicType(t[0])],["MultiResultVec",(...t)=>new Sg.VariadicType(t[0])],["variadic",(...t)=>new Sg.VariadicType(t[0])],["OptionalArg",(...t)=>new bg.OptionalType(t[0])],["optional",(...t)=>new bg.OptionalType(t[0])],["OptionalResult",(...t)=>new bg.OptionalType(t[0])],["multi",(...t)=>new pf.CompositeType(...t)],["MultiArg",(...t)=>new pf.CompositeType(...t)],["MultiResult",(...t)=>new pf.CompositeType(...t)],["multi",(...t)=>new pf.CompositeType(...t)],["tuple",(...t)=>new _n.TupleType(...t)],["tuple2",(...t)=>new _n.TupleType(...t)],["tuple3",(...t)=>new _n.TupleType(...t)],["tuple4",(...t)=>new _n.TupleType(...t)],["tuple5",(...t)=>new _n.TupleType(...t)],["tuple6",(...t)=>new _n.TupleType(...t)],["tuple7",(...t)=>new _n.TupleType(...t)],["tuple8",(...t)=>new _n.TupleType(...t)],["array20",(...t)=>new gf.ArrayVecType(20,t[0])],["array32",(...t)=>new gf.ArrayVecType(32,t[0])],["array46",(...t)=>new gf.ArrayVecType(46,t[0])],["array64",(...t)=>new gf.ArrayVecType(64,t[0])]]),this.closedTypesMap=new Map([["u8",new Dr.U8Type],["u16",new Dr.U16Type],["u32",new Dr.U32Type],["u64",new Dr.U64Type],["U64",new Dr.U64Type],["BigUint",new Dr.BigUIntType],["i8",new Dr.I8Type],["i16",new Dr.I16Type],["i32",new Dr.I32Type],["i64",new Dr.I64Type],["Bigint",new Dr.BigIntType],["BigInt",new Dr.BigIntType],["bool",new CB.BooleanType],["bytes",new SB.BytesType],["Address",new bB.AddressType],["H256",new NB.H256Type],["utf-8 string",new DB.StringType],["TokenIdentifier",new zA.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new zA.TokenIdentifierType],["CodeMetadata",new xB.CodeMetadataType],["nothing",new GA.NothingType],["AsyncCall",new GA.NothingType]]),this.learnedTypesMap=new Map;for(let t of e)this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapTypeRecursively(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new QA.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let t=e.isGenericType(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let n=this.closedTypesMap.get(e.getName());return n||(e.hasExactClass(Cg.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(KA.StructType.ClassName)?this.mapStructType(e):t?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new KA.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map(n=>new Cg.EnumVariantDefinition(n.name,n.discriminant,this.mappedFields(n.getFieldsDefinitions())));return new Cg.EnumType(e.getName(),t)}mappedFields(e){return e.map(t=>new TB.FieldDefinition(t.name,t.description,this.mapType(t.type)))}mapGenericType(e){let i=e.getTypeParameters().map(s=>this.mapType(s)),n=this.openTypesFactories.get(e.getName());if(!n)throw new QA.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return n(...i)}};fi.TypeMapper=xg});var XA=B(hi=>{"use strict";f();var OB=hi&&hi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),PB=hi&&hi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),BB=hi&&hi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&OB(e,r,t);return PB(e,r),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.AbiRegistry=void 0;var kA=BB(Ye()),Ng=Tr(),WA=gg(),Dg=Zl(),$A=Xu(),YA=ms(),MB=Tg(),wa=class{constructor(){this.interfaces=[],this.customTypes=[]}static create(e){return new wa().extend(e).remapToKnownTypes()}extend(e){e.types=e.types||{};let t=WA.ContractInterface.fromJSON(e);this.interfaces.push(t);for(let i in e.types){let n=e.types[i],s=n.type;n.name=i;let o=this.createCustomType(s,n);this.customTypes.push(o)}return this}createCustomType(e,t){if(e=="struct")return YA.StructType.fromJSON(t);if(e=="enum")return $A.EnumType.fromJSON(t);throw new kA.ErrTypingSystem(`Unknown type discriminant: ${e}`)}getInterface(e){let t=this.interfaces.find(i=>i.name==e);return Ng.guardValueIsSetWithMessage(`interface [${e}] not found`,t),t}getInterfaces(e){return e.map(t=>this.getInterface(t))}getStruct(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(YA.StructType.ClassName));return Ng.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map(t=>this.getStruct(t))}getEnum(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass($A.EnumType.ClassName));return Ng.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map(t=>this.getEnum(t))}remapToKnownTypes(){let e=new MB.TypeMapper([]),t=[],i=[];for(let s of this.customTypes)this.mapCustomTypeDepthFirst(s,this.customTypes,e,t);if(this.customTypes.length!=t.length)throw new kA.ErrTypingSystem("Did not re-map all custom types");for(let s of this.interfaces){let o=[];for(let u of s.endpoints)o.push(JA(u,e));let a=s.constructorDefinition?JA(s.constructorDefinition,e):null;i.push(new WA.ContractInterface(s.name,a,o))}let n=new wa;return n.customTypes.push(...t),n.interfaces.push(...i),n}mapCustomTypeDepthFirst(e,t,i,n){if(n.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=t.find(h=>h.getName()==a);u&&this.mapCustomTypeDepthFirst(u,t,i,n)}let o=i.mapType(e);n.push(o)}};hi.AbiRegistry=wa;function JA(r,e){let t=r.input.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type))),i=r.output.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type)));return new Dg.EndpointDefinition(r.name,t,i,r.modifiers)}});var eI=B(va=>{"use strict";f();Object.defineProperty(va,"__esModule",{value:!0});va.createListOfTokenIdentifiers=va.createListOfAddresses=void 0;var RB=Go(),ZA=tc(),LB=ya();function FB(r){let e=r.map(i=>new RB.AddressValue(i));return ZA.List.fromItems(e)}va.createListOfAddresses=FB;function UB(r){let e=r.map(i=>new LB.TokenIdentifierValue(i));return ZA.List.fromItems(e)}va.createListOfTokenIdentifiers=UB});var pI=B(sr=>{"use strict";f();var qB=sr&&sr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),VB=sr&&sr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),HB=sr&&sr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&qB(e,r,t);return VB(e,r),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.onPrimitiveTypeSelect=sr.onPrimitiveValueSelect=sr.onTypedValueSelect=sr.onTypeSelect=void 0;var mf=HB(Ye()),tI=Go(),rI=ec(),iI=mn(),nI=Xu(),yf=tc(),sI=rc(),oI=ic(),aI=cf(),uI=ms(),cI=ya(),lI=ff(),fI=Ft(),hI=uf(),dI=lf();function QB(r,e){if(r.hasExactClass(yf.OptionType.ClassName))return e.onOption();if(r.hasExactClass(yf.ListType.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVecType.ClassName))return e.onArray();if(r.hasClassOrSuperclass(fI.PrimitiveType.ClassName))return e.onPrimitive();if(r.hasExactClass(uI.StructType.ClassName))return e.onStruct();if(r.hasExactClass(lI.TupleType.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't known: ${r}`)}sr.onTypeSelect=QB;function jB(r,e){if(r.hasClassOrSuperclass(fI.PrimitiveValue.ClassName))return e.onPrimitive();if(r.hasExactClass(yf.OptionValue.ClassName))return e.onOption();if(r.hasExactClass(yf.List.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVec.ClassName))return e.onArray();if(r.hasExactClass(uI.Struct.ClassName))return e.onStruct();if(r.hasExactClass(lI.Tuple.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't typed: ${r}`)}sr.onTypedValueSelect=jB;function GB(r,e){if(r.hasExactClass(rI.BooleanValue.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalValue.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressValue.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesValue.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringValue.ClassName))return e.onString();if(r.hasExactClass(sI.H256Value.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(r.hasExactClass(aI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't a primitive: ${r.getType()}`)}sr.onPrimitiveValueSelect=GB;function KB(r,e){if(r.hasExactClass(rI.BooleanType.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalType.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressType.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesType.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringType.ClassName))return e.onString();if(r.hasExactClass(sI.H256Type.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(r.hasExactClass(aI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't a known primitive: ${r}`)}sr.onPrimitiveTypeSelect=KB});var or=B(Ve=>{"use strict";f();var zB=Ve&&Ve.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),Je=Ve&&Ve.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&zB(e,r,t)};Object.defineProperty(Ve,"__esModule",{value:!0});Je(XA(),Ve);Je(Go(),Ve);Je(nf(),Ve);Je(ec(),Ve);Je(mn(),Ve);Je(of(),Ve);Je(gg(),Ve);Je(Zl(),Ve);Je(Xu(),Ve);Je(eI(),Ve);Je(Uo(),Ve);Je(tc(),Ve);Je(uf(),Ve);Je(rc(),Ve);Je(pI(),Ve);Je(cf(),Ve);Je(ic(),Ve);Je(lf(),Ve);Je(ms(),Ve);Je(ff(),Ve);Je(ya(),Ve);Je(Jl(),Ve);Je(Tg(),Ve);Je(Ft(),Ve);Je(df(),Ve)});var yI=B(di=>{"use strict";f();var kB=di&&di.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),WB=di&&di.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),$B=di&&di.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&kB(e,r,t);return WB(e,r),e};Object.defineProperty(di,"__esModule",{value:!0});di.OptionValueBinaryCodec=void 0;var gI=$B(Ye()),wf=or(),Og=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(e[0]==0)return[wf.OptionValue.newMissingTyped(t),1];if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return[wf.OptionValue.newProvided(i),n+1]}decodeTopLevel(e,t){if(e.length==0)return new wf.OptionValue(t);if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return new wf.OptionValue(t,i)}encodeNested(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([])}};di.OptionValueBinaryCodec=Og});var mI=B(vf=>{"use strict";f();Object.defineProperty(vf,"__esModule",{value:!0});vf.AddressBinaryCodec=void 0;var YB=Gr(),JB=or(),Pg=class{decodeNested(e){let t=e.slice(0,32),i=new YB.Address(t);return[new JB.AddressValue(i),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};vf.AddressBinaryCodec=Pg});var vI=B(pi=>{"use strict";f();var XB=pi&&pi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),ZB=pi&&pi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),eM=pi&&pi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&XB(e,r,t);return ZB(e,r),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.BooleanBinaryCodec=void 0;var tM=eM(Ye()),wI=or(),Kr=class{decodeNested(e){let t=e.readUInt8(0);return[new wI.BooleanValue(t==Kr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new tM.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new wI.BooleanValue(t==Kr.TRUE)}encodeNested(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([Kr.FALSE])}encodeTopLevel(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([])}};pi.BooleanBinaryCodec=Kr;Kr.TRUE=1;Kr.FALSE=0});var Af=B(Ef=>{"use strict";f();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.SizeOfU32=void 0;Ef.SizeOfU32=4});var AI=B(gi=>{"use strict";f();var rM=gi&&gi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(gi,"__esModule",{value:!0});gi.zeroPadStringIfOddLength=gi.isPaddedHex=gi.numberToPaddedHex=void 0;var iM=rM(jr());function nM(r){let e=new iM.default(r).toString(16);return EI(e)}gi.numberToPaddedHex=nM;function sM(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}gi.isPaddedHex=sM;function EI(r){return r=r||"",r.length%2==1?"0"+r:r}gi.zeroPadStringIfOddLength=EI});var Mg=B(Ut=>{"use strict";f();var oM=Ut&&Ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.prependByteToBuffer=Ut.flipBufferBitsInPlace=Ut.getHexMagnitudeOfBigInt=Ut.bigIntToBuffer=Ut.bufferToBigInt=Ut.cloneBuffer=Ut.isMsbZero=Ut.isMsbOne=void 0;var Bg=oM(jr()),aM=AI();function II(r,e=0){return r[e]>>7==1}Ut.isMsbOne=II;function uM(r,e=0){return!II(r,e)}Ut.isMsbZero=uM;function cM(r){let e=y.Buffer.alloc(r.length);return r.copy(e),e}Ut.cloneBuffer=cM;function lM(r){let e=r.toString("hex");return new Bg.default(`0x${e}`,16)}Ut.bufferToBigInt=lM;function fM(r){let e=_I(r);return y.Buffer.from(e,"hex")}Ut.bigIntToBuffer=fM;function _I(r){return r=new Bg.default(r),r?(r.isNegative()&&(r=r.multipliedBy(new Bg.default(-1))),aM.numberToPaddedHex(r)):""}Ut.getHexMagnitudeOfBigInt=_I;function hM(r){for(let e=0;e{"use strict";f();var pM=Ea&&Ea.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.NumericalBinaryCodec=void 0;var nc=pM(jr()),Rg=or(),bI=Af(),pt=Mg(),Lg=class{decodeNested(e,t){let i=0,n=t.sizeInBytes;n||(i=bI.SizeOfU32,n=e.readUInt32BE(0));let s=e.slice(i,i+n),o=this.decodeTopLevel(s,t),a=n+i;return[o,a]}decodeTopLevel(e,t){let i=pt.cloneBuffer(e);if(e.length==0)return new Rg.NumericalValue(t,new nc.default(0));if(!t.withSign||pt.isMsbZero(i)){let h=pt.bufferToBigInt(i);return new Rg.NumericalValue(t,h)}pt.flipBufferBitsInPlace(i);let u=pt.bufferToBigInt(i).multipliedBy(new nc.default(-1)).minus(new nc.default(1));return new Rg.NumericalValue(t,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),i=y.Buffer.alloc(bI.SizeOfU32);return i.writeUInt32BE(t.length),y.Buffer.concat([i,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return y.Buffer.alloc(t,0);if(!e.withSign){let o=pt.bigIntToBuffer(e.value),a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}if(e.value.isPositive()){let o=pt.bigIntToBuffer(e.value);pt.isMsbOne(o)&&(o=pt.prependByteToBuffer(o,0));let a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}let i=e.value.plus(new nc.default(1)),n=pt.bigIntToBuffer(i);pt.flipBufferBitsInPlace(n),pt.isMsbZero(n)&&(n=pt.prependByteToBuffer(n,255));let s=y.Buffer.alloc(t-n.length,255);return y.Buffer.concat([s,n])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?y.Buffer.alloc(0):t?this.encodePrimitive(e):pt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let n=pt.bigIntToBuffer(e.value);return pt.isMsbOne(n)&&(n=pt.prependByteToBuffer(n,0)),n}let t=e.value.plus(new nc.default(1)),i=pt.bigIntToBuffer(t);return pt.flipBufferBitsInPlace(i),pt.isMsbZero(i)&&(i=pt.prependByteToBuffer(i,255)),i}};Ea.NumericalBinaryCodec=Lg});var SI=B(If=>{"use strict";f();Object.defineProperty(If,"__esModule",{value:!0});If.H256BinaryCodec=void 0;var gM=rc(),Fg=class{decodeNested(e){let t=e.slice(0,32);return[new gM.H256Value(t),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};If.H256BinaryCodec=Fg});var Cf=B(bf=>{"use strict";f();Object.defineProperty(bf,"__esModule",{value:!0});bf.BytesBinaryCodec=void 0;var xI=mn(),_f=Af(),Ug=class{decodeNested(e){let t=e.readUInt32BE(0),i=e.slice(_f.SizeOfU32,_f.SizeOfU32+t);return[new xI.BytesValue(i),_f.SizeOfU32+t]}decodeTopLevel(e){return new xI.BytesValue(e)}encodeNested(e){let t=y.Buffer.alloc(_f.SizeOfU32);return t.writeUInt32BE(e.getLength()),y.Buffer.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};bf.BytesBinaryCodec=Ug});var NI=B(Sf=>{"use strict";f();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.TokenIdentifierCodec=void 0;var yM=mn(),TI=ya(),mM=Cf(),qg=class{constructor(){this.bytesCodec=new mM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesCodec.decodeNested(e);return[new TI.TokenIdentifierValue(t.toString()),i]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new TI.TokenIdentifierValue(t.toString())}encodeNested(e){let t=yM.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Sf.TokenIdentifierCodec=qg});var OI=B(xf=>{"use strict";f();Object.defineProperty(xf,"__esModule",{value:!0});xf.NothingCodec=void 0;var DI=or(),Vg=class{decodeNested(){return[new DI.NothingValue,0]}decodeTopLevel(){return new DI.NothingValue}encodeNested(){return y.Buffer.from([])}encodeTopLevel(){return y.Buffer.from([])}};xf.NothingCodec=Vg});var BI=B(Tf=>{"use strict";f();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.StringBinaryCodec=void 0;var PI=or(),wM=mn(),vM=Cf(),Hg=class{constructor(){this.bytesBinaryCodec=new vM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesBinaryCodec.decodeNested(e);return[new PI.StringValue(t.valueOf().toString()),i]}decodeTopLevel(e){return new PI.StringValue(e.toString())}encodeNested(e){let t=wM.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Tf.StringBinaryCodec=Hg});var MI=B(Df=>{"use strict";f();Object.defineProperty(Df,"__esModule",{value:!0});Df.PrimitiveBinaryCodec=void 0;var Nf=or(),EM=mI(),AM=vI(),IM=CI(),_M=SI(),bM=Cf(),CM=NI(),SM=OI(),xM=BI(),Qg=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new AM.BooleanBinaryCodec,this.numericalCodec=new IM.NumericalBinaryCodec,this.addressCodec=new EM.AddressBinaryCodec,this.h256Codec=new _M.H256BinaryCodec,this.bytesCodec=new bM.BytesBinaryCodec,this.stringCodec=new xM.StringBinaryCodec,this.tokenIdentifierCodec=new CM.TokenIdentifierCodec,this.nothingCodec=new SM.NothingCodec}decodeNested(e,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),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,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),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 Nf.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 Nf.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()})}};Df.PrimitiveBinaryCodec=Qg});var FI=B(Of=>{"use strict";f();Object.defineProperty(Of,"__esModule",{value:!0});Of.ListBinaryCodec=void 0;var RI=or(),LI=Af(),jg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.getFirstTypeParameter(),n=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=LI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,i);n.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(n.length)}return new RI.List(t,n)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=y.Buffer.alloc(LI.SizeOfU32);t.writeUInt32BE(e.getLength());let i=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);i.push(o)}return y.Buffer.concat([t,...i])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(let n of e.getItems()){let s=this.binaryCodec.encodeNested(n);t.push(s)}return y.Buffer.concat(t)}};Of.ListBinaryCodec=jg});var Kg=B(Pf=>{"use strict";f();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.FieldsBinaryCodec=void 0;var TM=or(),Gg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=[],n=0;for(let s of t){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),n+=a;let u=new TM.Field(o,s.name);i.push(u)}return[i,n]}encodeNested(e){let t=[];for(let i of e){let n=this.binaryCodec.encodeNested(i.value);t.push(n)}return y.Buffer.concat(t)}};Pf.FieldsBinaryCodec=Gg});var kg=B(Bf=>{"use strict";f();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.StructBinaryCodec=void 0;var NM=or(),DM=Kg(),zg=class{constructor(e){this.fieldsCodec=new DM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let i=t.getFieldsDefinitions(),[n,s]=this.fieldsCodec.decodeNested(e,i);return[new NM.Struct(t,n),s]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}};Bf.StructBinaryCodec=zg});var UI=B(Rf=>{"use strict";f();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.EnumBinaryCodec=void 0;var Mf=or(),OM=Kg(),Wg=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new OM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let[i,n]=this.readDiscriminant(e);e=e.slice(n);let s=t.getVariantByDiscriminant(i),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Mf.EnumValue(t,s,a),n+u]}readDiscriminant(e){let[t,i]=this.binaryCodec.decodeNested(e,new Mf.U8Type);return[t.valueOf(),i]}encodeNested(e){let t=new Mf.U8Value(e.discriminant),i=this.binaryCodec.encodeNested(t),n=e.getFields(),s=this.fieldsCodec.encodeNested(n);return y.Buffer.concat([i,s])}encodeTopLevel(e){let t=e.getFields(),i=t.length>0,n=this.fieldsCodec.encodeNested(t),s=new Mf.U8Value(e.discriminant),o=i?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return y.Buffer.concat([o,n])}};Rf.EnumBinaryCodec=Wg});var qI=B(Lf=>{"use strict";f();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.TupleBinaryCodec=void 0;var PM=kg(),$g=class{constructor(e){this.structCodec=new PM.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Lf.TupleBinaryCodec=$g});var VI=B(Ff=>{"use strict";f();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.ArrayVecBinaryCodec=void 0;var BM=or(),Yg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.length,n=t.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";f();var MM=Or&&Or.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),RM=Or&&Or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),LM=Or&&Or.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&MM(e,r,t);return RM(e,r),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.BinaryCodecConstraints=Or.BinaryCodec=void 0;var HI=LM(Ye()),Uf=or(),QI=Tr(),FM=yI(),UM=MI(),qM=FI(),VM=kg(),HM=UI(),QM=qI(),jM=VI(),Jg=class{constructor(e=null){this.constraints=e||new qf,this.optionCodec=new FM.OptionValueBinaryCodec(this),this.listCodec=new qM.ListBinaryCodec(this),this.arrayCodec=new jM.ArrayVecBinaryCodec(this),this.primitiveCodec=new UM.PrimitiveBinaryCodec(this),this.structCodec=new VM.StructBinaryCodec(this),this.tupleCodec=new QM.TupleBinaryCodec(this),this.enumCodec=new HM.EnumBinaryCodec(this)}decodeTopLevel(e,t){return this.constraints.checkBufferLength(e),Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[i,n]=Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t)});return[i,n]}encodeNested(e){return QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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 QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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)})}};Or.BinaryCodec=Jg;var qf=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||40960,this.maxListLength=e?.maxListLength||8192}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new HI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new HI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Or.BinaryCodecConstraints=qf});var jI=B(Pr=>{"use strict";f();var GM=Pr&&Pr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.decodeBigNumber=Pr.decodeString=Pr.decodeBool=Pr.decodeUnsignedNumber=void 0;var KM=GM(jr()),Vf=or(),zM=Xg(),Hf=new zM.BinaryCodec;function kM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return Number(e.valueOf())}Pr.decodeUnsignedNumber=kM;function WM(r){let e=Hf.decodeTopLevel(r,new Vf.BooleanType);return Boolean(e.valueOf())}Pr.decodeBool=WM;function $M(r){let e=Hf.decodeTopLevel(r,new Vf.BytesType);return String(e.valueOf())}Pr.decodeString=$M;function YM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return new KM.default(e.valueOf())}Pr.decodeBigNumber=YM});var KI=B(bn=>{"use strict";f();var JM=bn&&bn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),GI=bn&&bn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&JM(e,r,t)};Object.defineProperty(bn,"__esModule",{value:!0});GI(Xg(),bn);GI(jI(),bn)});var jf=B(Qf=>{"use strict";f();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ArgSerializer=void 0;var zI=Wu(),XM=KI(),Zg=nf(),ey=of(),ty=df(),ZM={codec:new XM.BinaryCodec},ry=class{constructor(e){e=Object.assign(Object.assign({},ZM),e),this.codec=e.codec}stringToValues(e,t){let i=this.stringToBuffers(e);return this.buffersToValues(i,t)}stringToBuffers(e){return e.split(zI.ARGUMENTS_SEPARATOR).map(t=>y.Buffer.from(t,"hex"))}buffersToValues(e,t){let i=this;e=e||[];let n=[],s=0,o=e.length;for(let p=0;p=o}return n}valuesToString(e){let t=this.valuesToStrings(e),i=t.join(zI.ARGUMENTS_SEPARATOR),n=t.length;return{argumentsString:i,count:n}}valuesToStrings(e){return this.valuesToBuffers(e).map(n=>n.toString("hex"))}valuesToBuffers(e){let t=this,i=[];for(let s of e)n(s);function n(s){if(s.hasExactClass(Zg.OptionalValue.ClassName)){let o=s;o.isSet()&&n(o.getTypedValue())}else if(s.hasExactClass(ty.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else if(s.hasExactClass(ey.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else{let o=t.codec.encodeTopLevel(s);i.push(o)}}return i}};Qf.ArgSerializer=ry});var cy=B(zr=>{"use strict";f();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var oy=sc(),ay=Tr(),eR=jf();zr.ArwenVirtualMachine="0500";var iy=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`${e}@${zr.ArwenVirtualMachine}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractDeployPayloadBuilder=iy;var ny=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`upgradeContract@${e}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractUpgradePayloadBuilder=ny;var sy=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(){ay.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=uy(e,this.arguments),new oy.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=sy;function uy(r,e){let{argumentsString:t,count:i}=new eR.ArgSerializer().valuesToString(e);return i==0?r:`${r}@${t}`}});var sc=B(Gf=>{"use strict";f();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.TransactionPayload=void 0;var ly=cy(),Aa=class{constructor(e){this.data=y.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Aa("");let t=y.Buffer.from(e,"base64").toString();return new Aa(t)}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=>y.Buffer.from(e,"hex"))}length(){return y.Buffer.from(this.data).length}static contractDeploy(){return new ly.ContractDeployPayloadBuilder}static contractUpgrade(){return new ly.ContractUpgradePayloadBuilder}static contractCall(){return new ly.ContractCallPayloadBuilder}};Gf.TransactionPayload=Aa});var $I=B(Cn=>{"use strict";f();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MultiESDTNFTTransferPayloadBuilder=Cn.ESDTNFTTransferPayloadBuilder=Cn.ESDTTransferPayloadBuilder=void 0;var kI=Gr(),py=jf(),kr=or(),WI=og(),gy=sc(),fy=class{constructor(){this.payment=WI.TokenPayment.fungibleFromAmount("","0",0)}setPayment(e){return this.payment=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.BigUIntValue(this.payment.valueOf())],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTTransfer@${t}`;return new gy.TransactionPayload(i)}};Cn.ESDTTransferPayloadBuilder=fy;var hy=class{constructor(){this.payment=WI.TokenPayment.nonFungible("",0),this.destination=new kI.Address("")}setPayment(e){return this.payment=e,this}setDestination(e){return this.destination=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.U64Value(this.payment.nonce),new kr.BigUIntValue(this.payment.valueOf()),new kr.AddressValue(this.destination)],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Cn.ESDTNFTTransferPayloadBuilder=hy;var dy=class{constructor(){this.payments=[],this.destination=new kI.Address("")}setPayments(e){return this.payments=e,this}setDestination(e){return this.destination=e,this}build(){let e=[new kr.AddressValue(this.destination),new kr.U16Value(this.payments.length)];for(let n of this.payments)e.push(kr.BytesValue.fromUTF8(n.tokenIdentifier),new kr.U64Value(n.nonce),new kr.BigUIntValue(n.valueOf()));let{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`MultiESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Cn.MultiESDTNFTTransferPayloadBuilder=dy});var zf=B(Kf=>{"use strict";f();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.Account=void 0;var tR=Gr(),yy=class{constructor(e){this.address=new tR.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()}}};Kf.Account=yy});var YI=B(yi=>{"use strict";f();var rR=yi&&yi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),iR=yi&&yi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),nR=yi&&yi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&rR(e,r,t);return iR(e,r),e};Object.defineProperty(yi,"__esModule",{value:!0});yi.Hash=void 0;var sR=nR(Ye()),oc=class{constructor(e){if(!e)this.hash=y.Buffer.from([]);else if(e instanceof y.Buffer)this.hash=e;else if(typeof e=="string")this.hash=y.Buffer.from(e,"hex");else throw new sR.ErrBadType("hash","buffer | string",e)}static empty(){return new oc(y.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};yi.Hash=oc});var XI=B(Br=>{"use strict";f();var oR=Br&&Br.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),aR=Br&&Br.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),uR=Br&&Br.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&oR(e,r,t);return aR(e,r),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionOptions=Br.TransactionVersion=void 0;var JI=uR(Ye()),kf=Wu(),Ia=class{constructor(e){if(e=Number(e),e<1)throw new JI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Ia(kf.TRANSACTION_VERSION_DEFAULT)}static withTxHashSignVersion(){return new Ia(kf.TRANSACTION_VERSION_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionVersion=Ia;var _a=class{constructor(e){if(e=Number(e),e<0)throw new JI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new _a(kf.TRANSACTION_OPTIONS_DEFAULT)}static withTxHashSignOptions(){return new _a(kf.TRANSACTION_OPTIONS_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionOptions=_a});var e_=B((UW,ZI)=>{"use strict";f();ZI.exports=cR;function cR(r,e){for(var t=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";f();var Wf=i_;Wf.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&e.charAt(t)==="=";)++i;return Math.ceil(e.length*3)/4-i};var ba=new Array(64),r_=new Array(123);for(Wr=0;Wr<64;)r_[ba[Wr]=Wr<26?Wr+65:Wr<52?Wr+71:Wr<62?Wr-4:Wr-59|43]=Wr++;var Wr;Wf.encode=function(e,t,i){for(var n=null,s=[],o=0,a=0,u;t>2],u=(h&3)<<4,a=1;break;case 1:s[o++]=ba[u|h>>4],u=(h&15)<<2,a=2;break;case 2:s[o++]=ba[u|h>>6],s[o++]=ba[h&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ba[u],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var t_="invalid encoding";Wf.decode=function(e,t,i){for(var n=i,s=0,o,a=0;a1)break;if((u=r_[u])===void 0)throw Error(t_);switch(s){case 0:o=u,s=1;break;case 1:t[i++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[i++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[i++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(t_);return i-n};Wf.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var o_=B((QW,s_)=>{"use strict";f();s_.exports=$f;function $f(){this._listeners={}}$f.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this};$f.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";f();h_.exports=a_(a_);function a_(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),i=t[3]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3]}function s(u,h,p){e[0]=u,h[p]=t[3],h[p+1]=t[2],h[p+2]=t[1],h[p+3]=t[0]}r.writeFloatLE=i?n:s,r.writeFloatBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],e[0]}function a(u,h){return t[3]=u[h],t[2]=u[h+1],t[1]=u[h+2],t[0]=u[h+3],e[0]}r.readFloatLE=i?o:a,r.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(n)/Math.LN2),h=Math.round(n*Math.pow(2,-u)*8388608)&8388607;i((a<<31|u+127<<23|h)>>>0,s,o)}}r.writeFloatLE=e.bind(null,u_),r.writeFloatBE=e.bind(null,c_);function t(i,n,s){var o=i(n,s),a=(o>>31)*2+1,u=o>>>23&255,h=o&8388607;return u===255?h?NaN:a*(1/0):u===0?a*1401298464324817e-60*h:a*Math.pow(2,u-150)*(h+8388608)}r.readFloatLE=t.bind(null,l_),r.readFloatBE=t.bind(null,f_)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),i=t[7]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3],h[p+4]=t[4],h[p+5]=t[5],h[p+6]=t[6],h[p+7]=t[7]}function s(u,h,p){e[0]=u,h[p]=t[7],h[p+1]=t[6],h[p+2]=t[5],h[p+3]=t[4],h[p+4]=t[3],h[p+5]=t[2],h[p+6]=t[1],h[p+7]=t[0]}r.writeDoubleLE=i?n:s,r.writeDoubleBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],t[4]=u[h+4],t[5]=u[h+5],t[6]=u[h+6],t[7]=u[h+7],e[0]}function a(u,h){return t[7]=u[h],t[6]=u[h+1],t[5]=u[h+2],t[4]=u[h+3],t[3]=u[h+4],t[2]=u[h+5],t[1]=u[h+6],t[0]=u[h+7],e[0]}r.readDoubleLE=i?o:a,r.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,u){var h=o<0?1:0;if(h&&(o=-o),o===0)i(0,a,u+n),i(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))i(0,a,u+n),i(2146959360,a,u+s);else if(o>17976931348623157e292)i(0,a,u+n),i((h<<31|2146435072)>>>0,a,u+s);else{var p;if(o<22250738585072014e-324)p=o/5e-324,i(p>>>0,a,u+n),i((h<<31|p/4294967296)>>>0,a,u+s);else{var w=Math.floor(Math.log(o)/Math.LN2);w===1024&&(w=1023),p=o*Math.pow(2,-w),i(p*4503599627370496>>>0,a,u+n),i((h<<31|w+1023<<20|p*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,u_,0,4),r.writeDoubleBE=e.bind(null,c_,4,0);function t(i,n,s,o,a){var u=i(o,a+n),h=i(o,a+s),p=(h>>31)*2+1,w=h>>>20&2047,N=4294967296*(h&1048575)+u;return w===2047?N?NaN:p*(1/0):w===0?p*5e-324*N:p*Math.pow(2,w-1075)*(N+4503599627370496)}r.readDoubleLE=t.bind(null,l_,0,4),r.readDoubleBE=t.bind(null,f_,4,0)}(),r}function u_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function c_(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function l_(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function f_(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var p_=B((exports,module)=>{"use strict";f();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(r){}return null}});var y_=B(g_=>{"use strict";f();var my=g_;my.length=function(e){for(var t=0,i=0,n=0;n191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&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))};my.write=function(e,t,i){for(var n=i,s,o,a=0;a>6|192,t[i++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128);return i-n}});var w_=B(($W,m_)=>{"use strict";f();m_.exports=lR;function lR(r,e,t){var i=t||8192,n=i>>>1,s=null,o=i;return function(u){if(u<1||u>n)return r(u);o+u>i&&(s=r(i),o=0);var h=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),h}}});var E_=B((JW,v_)=>{"use strict";f();v_.exports=zt;var ac=xn();function zt(r,e){this.lo=r>>>0,this.hi=e>>>0}var Qs=zt.zero=new zt(0,0);Qs.toNumber=function(){return 0};Qs.zzEncode=Qs.zzDecode=function(){return this};Qs.length=function(){return 1};var fR=zt.zeroHash="\0\0\0\0\0\0\0\0";zt.fromNumber=function(e){if(e===0)return Qs;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new zt(i,n)};zt.from=function(e){if(typeof e=="number")return zt.fromNumber(e);if(ac.isString(e))if(ac.Long)e=ac.Long.fromString(e);else return zt.fromNumber(parseInt(e,10));return e.low||e.high?new zt(e.low>>>0,e.high>>>0):Qs};zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+i*4294967296)}return this.lo+this.hi*4294967296};zt.prototype.toLong=function(e){return ac.Long?new ac.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Sn=String.prototype.charCodeAt;zt.fromHash=function(e){return e===fR?Qs:new zt((Sn.call(e,0)|Sn.call(e,1)<<8|Sn.call(e,2)<<16|Sn.call(e,3)<<24)>>>0,(Sn.call(e,4)|Sn.call(e,5)<<8|Sn.call(e,6)<<16|Sn.call(e,7)<<24)>>>0)};zt.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)};zt.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};zt.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};zt.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}});var xn=B(wy=>{"use strict";f();var we=wy;we.asPromise=e_();we.base64=n_();we.EventEmitter=o_();we.float=d_();we.inquire=p_();we.utf8=y_();we.pool=w_();we.LongBits=E_();we.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);we.global=we.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||wy;we.emptyArray=Object.freeze?Object.freeze([]):[];we.emptyObject=Object.freeze?Object.freeze({}):{};we.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};we.isString=function(e){return typeof e=="string"||e instanceof String};we.isObject=function(e){return e&&typeof e=="object"};we.isset=we.isSet=function(e,t){var i=e[t];return i!=null&&e.hasOwnProperty(t)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};we.Buffer=function(){try{var r=we.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();we._Buffer_from=null;we._Buffer_allocUnsafe=null;we.newBuffer=function(e){return typeof e=="number"?we.Buffer?we._Buffer_allocUnsafe(e):new we.Array(e):we.Buffer?we._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};we.Array=typeof Uint8Array<"u"?Uint8Array:Array;we.Long=we.global.dcodeIO&&we.global.dcodeIO.Long||we.global.Long||we.inquire("long");we.key2Re=/^true|false|0|1$/;we.key32Re=/^-?(?:0|[1-9][0-9]*)$/;we.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;we.longToHash=function(e){return e?we.LongBits.from(e).toHash():we.LongBits.zeroHash};we.longFromHash=function(e,t){var i=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))};function A_(r,e,t){for(var i=Object.keys(e),n=0;n-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};we.oneOfSetter=function(e){return function(t){for(var i=0;i{"use strict";f();S_.exports=qe;var Mr=xn(),vy,Yf=Mr.LongBits,__=Mr.base64,b_=Mr.utf8;function uc(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Ay(){}function hR(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function qe(){this.len=0,this.head=new uc(Ay,0,0),this.tail=this.head,this.states=null}var C_=function(){return Mr.Buffer?function(){return(qe.create=function(){return new vy})()}:function(){return new qe}};qe.create=C_();qe.alloc=function(e){return new Mr.Array(e)};Mr.Array!==Array&&(qe.alloc=Mr.pool(qe.alloc,Mr.Array.prototype.subarray));qe.prototype._push=function(e,t,i){return this.tail=this.tail.next=new uc(e,t,i),this.len+=t,this};function Iy(r,e,t){e[t]=r&255}function dR(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function _y(r,e){this.len=r,this.next=void 0,this.val=e}_y.prototype=Object.create(uc.prototype);_y.prototype.fn=dR;qe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new _y((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};qe.prototype.int32=function(e){return e<0?this._push(by,10,Yf.fromNumber(e)):this.uint32(e)};qe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function by(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}qe.prototype.uint64=function(e){var t=Yf.from(e);return this._push(by,t.length(),t)};qe.prototype.int64=qe.prototype.uint64;qe.prototype.sint64=function(e){var t=Yf.from(e).zzEncode();return this._push(by,t.length(),t)};qe.prototype.bool=function(e){return this._push(Iy,1,e?1:0)};function Ey(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}qe.prototype.fixed32=function(e){return this._push(Ey,4,e>>>0)};qe.prototype.sfixed32=qe.prototype.fixed32;qe.prototype.fixed64=function(e){var t=Yf.from(e);return this._push(Ey,4,t.lo)._push(Ey,4,t.hi)};qe.prototype.sfixed64=qe.prototype.fixed64;qe.prototype.float=function(e){return this._push(Mr.float.writeFloatLE,4,e)};qe.prototype.double=function(e){return this._push(Mr.float.writeDoubleLE,8,e)};var pR=Mr.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(Iy,1,0);if(Mr.isString(e)){var i=qe.alloc(t=__.length(e));__.decode(e,i,0),e=i}return this.uint32(t)._push(pR,t,e)};qe.prototype.string=function(e){var t=b_.length(e);return t?this.uint32(t)._push(b_.write,t,e):this._push(Iy,1,0)};qe.prototype.fork=function(){return this.states=new hR(this),this.head=this.tail=new uc(Ay,0,0),this.len=0,this};qe.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 uc(Ay,0,0),this.len=0),this};qe.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this};qe.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t};qe._configure=function(r){vy=r,qe.create=C_(),vy._configure()}});var N_=B((i$,T_)=>{"use strict";f();T_.exports=mi;var x_=Cy();(mi.prototype=Object.create(x_.prototype)).constructor=mi;var Tn=xn();function mi(){x_.call(this)}mi._configure=function(){mi.alloc=Tn._Buffer_allocUnsafe,mi.writeBytesBuffer=Tn.Buffer&&Tn.Buffer.prototype instanceof Uint8Array&&Tn.Buffer.prototype.set.name==="set"?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(mi.writeBytesBuffer,t,e),this};function gR(r,e,t){r.length<40?Tn.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}mi.prototype.string=function(e){var t=Tn.Buffer.byteLength(e);return this.uint32(t),t&&this._push(gR,t,e),this};mi._configure()});var Ty=B((s$,M_)=>{"use strict";f();M_.exports=gt;var wi=xn(),xy,P_=wi.LongBits,yR=wi.utf8;function $r(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function gt(r){this.buf=r,this.pos=0,this.len=r.length}var D_=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new gt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new gt(e);throw Error("illegal buffer")},B_=function(){return wi.Buffer?function(t){return(gt.create=function(n){return wi.Buffer.isBuffer(n)?new xy(n):D_(n)})(t)}:D_};gt.create=B_();gt.prototype._slice=wi.Array.prototype.subarray||wi.Array.prototype.slice;gt.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}}();gt.prototype.int32=function(){return this.uint32()|0};gt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Sy(){var r=new P_(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}gt.prototype.bool=function(){return this.uint32()!==0};function Jf(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}gt.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)};gt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)|0};function O_(){if(this.pos+8>this.len)throw $r(this,8);return new P_(Jf(this.buf,this.pos+=4),Jf(this.buf,this.pos+=4))}gt.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=wi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};gt.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=wi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};gt.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)};gt.prototype.string=function(){var e=this.bytes();return yR.read(e,0,e.length)};gt.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};gt.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};gt._configure=function(r){xy=r,gt.create=B_(),xy._configure();var e=wi.Long?"toLong":"toNumber";wi.merge(gt.prototype,{int64:function(){return Sy.call(this)[e](!1)},uint64:function(){return Sy.call(this)[e](!0)},sint64:function(){return Sy.call(this).zzDecode()[e](!1)},fixed64:function(){return O_.call(this)[e](!0)},sfixed64:function(){return O_.call(this)[e](!1)}})}});var U_=B((a$,F_)=>{"use strict";f();F_.exports=js;var L_=Ty();(js.prototype=Object.create(L_.prototype)).constructor=js;var R_=xn();function js(r){L_.call(this,r)}js._configure=function(){R_.Buffer&&(js.prototype._slice=R_.Buffer.prototype.slice)};js.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))};js._configure()});var V_=B((c$,q_)=>{"use strict";f();q_.exports=cc;var Ny=xn();(cc.prototype=Object.create(Ny.EventEmitter.prototype)).constructor=cc;function cc(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Ny.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}cc.prototype.rpcCall=function r(e,t,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Ny.asPromise(r,o,e,t,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(u,h){if(u)return o.emit("error",u,e),s(u);if(h===null){o.end(!0);return}if(!(h instanceof i))try{h=i[o.responseDelimited?"decodeDelimited":"decode"](h)}catch(p){return o.emit("error",p,e),s(p)}return o.emit("data",h,e),s(null,h)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};cc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Q_=B(H_=>{"use strict";f();var mR=H_;mR.Service=V_()});var G_=B((d$,j_)=>{"use strict";f();j_.exports={}});var k_=B(z_=>{"use strict";f();var yr=z_;yr.build="minimal";yr.Writer=Cy();yr.BufferWriter=N_();yr.Reader=Ty();yr.BufferReader=U_();yr.util=xn();yr.rpc=Q_();yr.roots=G_();yr.configure=K_;function K_(){yr.util._configure(),yr.Writer._configure(yr.BufferWriter),yr.Reader._configure(yr.BufferReader)}K_()});var $_=B((m$,W_)=>{"use strict";f();W_.exports=k_()});var J_=B((v$,Y_)=>{"use strict";f();var Ca=$_(),Xf=Ca.Reader,wR=Ca.Writer,le=Ca.util,lc=Ca.roots.default||(Ca.roots.default={});lc.proto=function(){var r={};return r.Transaction=function(){function e(t){if(t)for(var i=Object.keys(t),n=0;n>>3){case 1:o.Nonce=i.uint64();break;case 2:o.Value=i.bytes();break;case 3:o.RcvAddr=i.bytes();break;case 4:o.RcvUserName=i.bytes();break;case 5:o.SndAddr=i.bytes();break;case 6:o.SndUserName=i.bytes();break;case 7:o.GasPrice=i.uint64();break;case 8:o.GasLimit=i.uint64();break;case 9:o.Data=i.bytes();break;case 10:o.ChainID=i.bytes();break;case 11:o.Version=i.uint32();break;case 12:o.Signature=i.bytes();break;case 13:o.Options=i.uint32();break;default:i.skipType(a&7);break}}return o},e.decodeDelimited=function(i){return i instanceof Xf||(i=new Xf(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.Nonce!=null&&i.hasOwnProperty("Nonce")&&!le.isInteger(i.Nonce)&&!(i.Nonce&&le.isInteger(i.Nonce.low)&&le.isInteger(i.Nonce.high))?"Nonce: integer|Long expected":i.Value!=null&&i.hasOwnProperty("Value")&&!(i.Value&&typeof i.Value.length=="number"||le.isString(i.Value))?"Value: buffer expected":i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&!(i.RcvAddr&&typeof i.RcvAddr.length=="number"||le.isString(i.RcvAddr))?"RcvAddr: buffer expected":i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&!(i.RcvUserName&&typeof i.RcvUserName.length=="number"||le.isString(i.RcvUserName))?"RcvUserName: buffer expected":i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&!(i.SndAddr&&typeof i.SndAddr.length=="number"||le.isString(i.SndAddr))?"SndAddr: buffer expected":i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&!(i.SndUserName&&typeof i.SndUserName.length=="number"||le.isString(i.SndUserName))?"SndUserName: buffer expected":i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&!le.isInteger(i.GasPrice)&&!(i.GasPrice&&le.isInteger(i.GasPrice.low)&&le.isInteger(i.GasPrice.high))?"GasPrice: integer|Long expected":i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&!le.isInteger(i.GasLimit)&&!(i.GasLimit&&le.isInteger(i.GasLimit.low)&&le.isInteger(i.GasLimit.high))?"GasLimit: integer|Long expected":i.Data!=null&&i.hasOwnProperty("Data")&&!(i.Data&&typeof i.Data.length=="number"||le.isString(i.Data))?"Data: buffer expected":i.ChainID!=null&&i.hasOwnProperty("ChainID")&&!(i.ChainID&&typeof i.ChainID.length=="number"||le.isString(i.ChainID))?"ChainID: buffer expected":i.Version!=null&&i.hasOwnProperty("Version")&&!le.isInteger(i.Version)?"Version: integer expected":i.Signature!=null&&i.hasOwnProperty("Signature")&&!(i.Signature&&typeof i.Signature.length=="number"||le.isString(i.Signature))?"Signature: buffer expected":i.Options!=null&&i.hasOwnProperty("Options")&&!le.isInteger(i.Options)?"Options: integer expected":null},e.fromObject=function(i){if(i instanceof lc.proto.Transaction)return i;var n=new lc.proto.Transaction;return i.Nonce!=null&&(le.Long?(n.Nonce=le.Long.fromValue(i.Nonce)).unsigned=!0:typeof i.Nonce=="string"?n.Nonce=parseInt(i.Nonce,10):typeof i.Nonce=="number"?n.Nonce=i.Nonce:typeof i.Nonce=="object"&&(n.Nonce=new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0))),i.Value!=null&&(typeof i.Value=="string"?le.base64.decode(i.Value,n.Value=le.newBuffer(le.base64.length(i.Value)),0):i.Value.length&&(n.Value=i.Value)),i.RcvAddr!=null&&(typeof i.RcvAddr=="string"?le.base64.decode(i.RcvAddr,n.RcvAddr=le.newBuffer(le.base64.length(i.RcvAddr)),0):i.RcvAddr.length&&(n.RcvAddr=i.RcvAddr)),i.RcvUserName!=null&&(typeof i.RcvUserName=="string"?le.base64.decode(i.RcvUserName,n.RcvUserName=le.newBuffer(le.base64.length(i.RcvUserName)),0):i.RcvUserName.length&&(n.RcvUserName=i.RcvUserName)),i.SndAddr!=null&&(typeof i.SndAddr=="string"?le.base64.decode(i.SndAddr,n.SndAddr=le.newBuffer(le.base64.length(i.SndAddr)),0):i.SndAddr.length&&(n.SndAddr=i.SndAddr)),i.SndUserName!=null&&(typeof i.SndUserName=="string"?le.base64.decode(i.SndUserName,n.SndUserName=le.newBuffer(le.base64.length(i.SndUserName)),0):i.SndUserName.length&&(n.SndUserName=i.SndUserName)),i.GasPrice!=null&&(le.Long?(n.GasPrice=le.Long.fromValue(i.GasPrice)).unsigned=!0:typeof i.GasPrice=="string"?n.GasPrice=parseInt(i.GasPrice,10):typeof i.GasPrice=="number"?n.GasPrice=i.GasPrice:typeof i.GasPrice=="object"&&(n.GasPrice=new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0))),i.GasLimit!=null&&(le.Long?(n.GasLimit=le.Long.fromValue(i.GasLimit)).unsigned=!0:typeof i.GasLimit=="string"?n.GasLimit=parseInt(i.GasLimit,10):typeof i.GasLimit=="number"?n.GasLimit=i.GasLimit:typeof i.GasLimit=="object"&&(n.GasLimit=new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0))),i.Data!=null&&(typeof i.Data=="string"?le.base64.decode(i.Data,n.Data=le.newBuffer(le.base64.length(i.Data)),0):i.Data.length&&(n.Data=i.Data)),i.ChainID!=null&&(typeof i.ChainID=="string"?le.base64.decode(i.ChainID,n.ChainID=le.newBuffer(le.base64.length(i.ChainID)),0):i.ChainID.length&&(n.ChainID=i.ChainID)),i.Version!=null&&(n.Version=i.Version>>>0),i.Signature!=null&&(typeof i.Signature=="string"?le.base64.decode(i.Signature,n.Signature=le.newBuffer(le.base64.length(i.Signature)),0):i.Signature.length&&(n.Signature=i.Signature)),i.Options!=null&&(n.Options=i.Options>>>0),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(le.Long){var o=new le.Long(0,0,!0);s.Nonce=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.Nonce=n.longs===String?"0":0;if(n.bytes===String?s.Value="":(s.Value=[],n.bytes!==Array&&(s.Value=le.newBuffer(s.Value))),n.bytes===String?s.RcvAddr="":(s.RcvAddr=[],n.bytes!==Array&&(s.RcvAddr=le.newBuffer(s.RcvAddr))),n.bytes===String?s.RcvUserName="":(s.RcvUserName=[],n.bytes!==Array&&(s.RcvUserName=le.newBuffer(s.RcvUserName))),n.bytes===String?s.SndAddr="":(s.SndAddr=[],n.bytes!==Array&&(s.SndAddr=le.newBuffer(s.SndAddr))),n.bytes===String?s.SndUserName="":(s.SndUserName=[],n.bytes!==Array&&(s.SndUserName=le.newBuffer(s.SndUserName))),le.Long){var o=new le.Long(0,0,!0);s.GasPrice=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasPrice=n.longs===String?"0":0;if(le.Long){var o=new le.Long(0,0,!0);s.GasLimit=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasLimit=n.longs===String?"0":0;n.bytes===String?s.Data="":(s.Data=[],n.bytes!==Array&&(s.Data=le.newBuffer(s.Data))),n.bytes===String?s.ChainID="":(s.ChainID=[],n.bytes!==Array&&(s.ChainID=le.newBuffer(s.ChainID))),s.Version=0,n.bytes===String?s.Signature="":(s.Signature=[],n.bytes!==Array&&(s.Signature=le.newBuffer(s.Signature))),s.Options=0}return i.Nonce!=null&&i.hasOwnProperty("Nonce")&&(typeof i.Nonce=="number"?s.Nonce=n.longs===String?String(i.Nonce):i.Nonce:s.Nonce=n.longs===String?le.Long.prototype.toString.call(i.Nonce):n.longs===Number?new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0):i.Nonce),i.Value!=null&&i.hasOwnProperty("Value")&&(s.Value=n.bytes===String?le.base64.encode(i.Value,0,i.Value.length):n.bytes===Array?Array.prototype.slice.call(i.Value):i.Value),i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&(s.RcvAddr=n.bytes===String?le.base64.encode(i.RcvAddr,0,i.RcvAddr.length):n.bytes===Array?Array.prototype.slice.call(i.RcvAddr):i.RcvAddr),i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&(s.RcvUserName=n.bytes===String?le.base64.encode(i.RcvUserName,0,i.RcvUserName.length):n.bytes===Array?Array.prototype.slice.call(i.RcvUserName):i.RcvUserName),i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&(s.SndAddr=n.bytes===String?le.base64.encode(i.SndAddr,0,i.SndAddr.length):n.bytes===Array?Array.prototype.slice.call(i.SndAddr):i.SndAddr),i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&(s.SndUserName=n.bytes===String?le.base64.encode(i.SndUserName,0,i.SndUserName.length):n.bytes===Array?Array.prototype.slice.call(i.SndUserName):i.SndUserName),i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&(typeof i.GasPrice=="number"?s.GasPrice=n.longs===String?String(i.GasPrice):i.GasPrice:s.GasPrice=n.longs===String?le.Long.prototype.toString.call(i.GasPrice):n.longs===Number?new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0):i.GasPrice),i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&(typeof i.GasLimit=="number"?s.GasLimit=n.longs===String?String(i.GasLimit):i.GasLimit:s.GasLimit=n.longs===String?le.Long.prototype.toString.call(i.GasLimit):n.longs===Number?new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0):i.GasLimit),i.Data!=null&&i.hasOwnProperty("Data")&&(s.Data=n.bytes===String?le.base64.encode(i.Data,0,i.Data.length):n.bytes===Array?Array.prototype.slice.call(i.Data):i.Data),i.ChainID!=null&&i.hasOwnProperty("ChainID")&&(s.ChainID=n.bytes===String?le.base64.encode(i.ChainID,0,i.ChainID.length):n.bytes===Array?Array.prototype.slice.call(i.ChainID):i.ChainID),i.Version!=null&&i.hasOwnProperty("Version")&&(s.Version=i.Version),i.Signature!=null&&i.hasOwnProperty("Signature")&&(s.Signature=n.bytes===String?le.base64.encode(i.Signature,0,i.Signature.length):n.bytes===Array?Array.prototype.slice.call(i.Signature):i.Signature),i.Options!=null&&i.hasOwnProperty("Options")&&(s.Options=i.Options),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Ca.util.toJSONOptions)},e}(),r}();Y_.exports=lc});var eb=B(Rr=>{"use strict";f();var vR=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),ER=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AR=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&vR(e,r,t);return ER(e,r),e},IR=Rr&&Rr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var _R=IR(jr()),X_=Gr(),bR=Wu(),CR=AR(Ye()),SR=Mg(),Z_=J_(),Dy=class{serializeTransaction(e){let t=new X_.Address(e.getReceiver().bech32()).pubkey(),i=new X_.Address(e.getSender().bech32()).pubkey(),n=new Z_.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:t,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:y.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:y.Buffer.from(e.getSignature().hex(),"hex")});e.getOptions().valueOf()!==bR.TRANSACTION_OPTIONS_DEFAULT&&(n.Options=e.getOptions().valueOf());let s=Z_.proto.Transaction.encode(n).finish();return y.Buffer.from(s)}serializeTransactionValue(e){let t=new _R.default(e.toString());if(t.isZero())return y.Buffer.from([0,0]);let i=SR.bigIntToBuffer(t);return i=y.Buffer.concat([y.Buffer.from([0]),i]),i}deserializeTransaction(e){throw new CR.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=Dy});var tb=B(Gs=>{"use strict";f();var xR=Gs&&Gs.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),TR=Gs&&Gs.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xR(e,r,t)};Object.defineProperty(Gs,"__esModule",{value:!0});TR(eb(),Gs)});var nb=B(vi=>{"use strict";f();var NR=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),DR=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),OR=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&NR(e,r,t);return DR(e,r),e};Object.defineProperty(vi,"__esModule",{value:!0});vi.Signature=void 0;var rb=OR(Ye()),ib=64,Yr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Yr.fromHex(e);if(e instanceof y.Buffer)return Yr.fromBuffer(e)}}static empty(){return new Yr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Yr.isValidHex(e))throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==ib}static fromValidHex(e){let t=new Yr;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=ib)throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};vi.Signature=Yr});var Oy=B((x$,sb)=>{f();$i.notEqual=BR;$i.notOk=MR;$i.equal=PR;$i.ok=$i;sb.exports=$i;function PR(r,e,t){$i(r==e,t)}function BR(r,e,t){$i(r!=e,t)}function MR(r,e){$i(!r,e)}function $i(r,e){if(!r)throw new Error(e||"AssertionError")}});var Ib=B(Na=>{"use strict";f();var Py=y0(),xa=w0(),ob=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Na.Buffer=ne;Na.SlowBuffer=VR;Na.INSPECT_MAX_BYTES=50;var Zf=2147483647;Na.kMaxLength=Zf;ne.TYPED_ARRAY_SUPPORT=RR();!ne.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 RR(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(ne.prototype,"parent",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.buffer}});Object.defineProperty(ne.prototype,"offset",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.byteOffset}});function Yi(r){if(r>Zf)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,ne.prototype),e}function ne(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ly(r)}return lb(r,e,t)}ne.poolSize=8192;function lb(r,e,t){if(typeof r=="string")return FR(r,e);if(ArrayBuffer.isView(r))return UR(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Ei(r,ArrayBuffer)||r&&Ei(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ei(r,SharedArrayBuffer)||r&&Ei(r.buffer,SharedArrayBuffer)))return My(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return ne.from(i,e,t);let n=qR(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return ne.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}ne.from=function(r,e,t){return lb(r,e,t)};Object.setPrototypeOf(ne.prototype,Uint8Array.prototype);Object.setPrototypeOf(ne,Uint8Array);function fb(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function LR(r,e,t){return fb(r),r<=0?Yi(r):e!==void 0?typeof t=="string"?Yi(r).fill(e,t):Yi(r).fill(e):Yi(r)}ne.alloc=function(r,e,t){return LR(r,e,t)};function Ly(r){return fb(r),Yi(r<0?0:Fy(r)|0)}ne.allocUnsafe=function(r){return Ly(r)};ne.allocUnsafeSlow=function(r){return Ly(r)};function FR(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ne.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=hb(r,e)|0,i=Yi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function By(r){let e=r.length<0?0:Fy(r.length)|0,t=Yi(e);for(let i=0;i=Zf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zf.toString(16)+" bytes");return r|0}function VR(r){return+r!=r&&(r=0),ne.alloc(+r)}ne.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ne.prototype};ne.compare=function(e,t){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),Ei(t,Uint8Array)&&(t=ne.from(t,t.offset,t.byteLength)),!ne.isBuffer(e)||!ne.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let s=0,o=Math.min(i,n);sn.length?(ne.isBuffer(o)||(o=ne.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(ne.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function hb(r,e){if(ne.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Ei(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Ry(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ab(r).length;default:if(n)return i?-1:Ry(r).length;e=(""+e).toLowerCase(),n=!0}}ne.byteLength=hb;function HR(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return JR(this,e,t);case"utf8":case"utf-8":return pb(this,e,t);case"ascii":return $R(this,e,t);case"latin1":case"binary":return YR(this,e,t);case"base64":return kR(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XR(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}ne.prototype._isBuffer=!0;function Ks(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}ne.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 t=0;tt&&(e+=" ... "),""};ob&&(ne.prototype[ob]=ne.prototype.inspect);ne.prototype.compare=function(e,t,i,n,s){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),!ne.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i);for(let w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,qy(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=ne.from(e,i)),ne.isBuffer(e))return e.length===0?-1:ab(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):ab(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function ab(r,e,t,i,n){let s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(p,w){return s===1?p[w]:p.readUInt16BE(w*s)}let h;if(n){let p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){let p=!0;for(let w=0;wn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return QR(this,e,t,i);case"utf8":case"utf-8":return jR(this,e,t,i);case"ascii":case"latin1":case"binary":return GR(this,e,t,i);case"base64":return KR(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zR(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function kR(r,e,t){return e===0&&t===r.length?Py.fromByteArray(r):Py.fromByteArray(r.slice(e,t))}function pb(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+a<=t){let u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return WR(i)}var ub=4096;function WR(r){let e=r.length;if(e<=ub)return String.fromCharCode.apply(String,r);let t="",i=0;for(;ii)&&(t=i);let n="";for(let s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}ne.prototype.readUintLE=ne.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};ne.prototype.readUint8=ne.prototype.readUInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]};ne.prototype.readUint16LE=ne.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]|this[e+1]<<8};ne.prototype.readUint16BE=ne.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]<<8|this[e+1]};ne.prototype.readUint32LE=ne.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ne.prototype.readUint32BE=ne.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ne.prototype.readBigUInt64LE=Nn(function(e){e=e>>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t*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+i;return(BigInt(n)<>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*t)),n};ne.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};ne.prototype.readInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ne.prototype.readInt16LE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt16BE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ne.prototype.readInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ne.prototype.readBigInt64LE=Nn(function(e){e=e>>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,t||kt(e,4,this.length),xa.read(this,e,!0,23,4)};ne.prototype.readFloatBE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),xa.read(this,e,!1,23,4)};ne.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),xa.read(this,e,!0,52,8)};ne.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),xa.read(this,e,!1,52,8)};function mr(r,e,t,i,n,s){if(!ne.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}ne.prototype.writeUintLE=ne.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=i-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+i};ne.prototype.writeUint8=ne.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,255,0),this[t]=e&255,t+1};ne.prototype.writeUint16LE=ne.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeUint16BE=ne.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeUint32LE=ne.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};ne.prototype.writeUint32BE=ne.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function gb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function yb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}ne.prototype.writeBigUInt64LE=Nn(function(e,t=0){return gb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeBigUInt64BE=Nn(function(e,t=0){return yb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=0,o=1,a=0;for(this[t]=e&255;++s>0)-a&255;return t+i};ne.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=i-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i};ne.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};ne.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};ne.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};ne.prototype.writeBigInt64LE=Nn(function(e,t=0){return gb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ne.prototype.writeBigInt64BE=Nn(function(e,t=0){return yb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mb(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function wb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,4,34028234663852886e22,-34028234663852886e22),xa.write(r,e,t,i,23,4),t+4}ne.prototype.writeFloatLE=function(e,t,i){return wb(this,e,t,!0,i)};ne.prototype.writeFloatBE=function(e,t,i){return wb(this,e,t,!1,i)};function vb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,8,17976931348623157e292,-17976931348623157e292),xa.write(r,e,t,i,52,8),t+8}ne.prototype.writeDoubleLE=function(e,t,i){return vb(this,e,t,!0,i)};ne.prototype.writeDoubleBE=function(e,t,i){return vb(this,e,t,!1,i)};ne.prototype.copy=function(e,t,i,n){if(!ne.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s2**32?n=cb(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=cb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function cb(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function ZR(r,e,t){Ta(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&fc(e,r.length-(t+1))}function Eb(r,e,t,i,n,s){if(r>t||r3?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 <= ${t}${o}`,new Sa.ERR_OUT_OF_RANGE("value",a,r)}ZR(i,n,s)}function Ta(r,e){if(typeof r!="number")throw new Sa.ERR_INVALID_ARG_TYPE(e,"number",r)}function fc(r,e,t){throw Math.floor(r)!==r?(Ta(r,t),new Sa.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Sa.ERR_BUFFER_OUT_OF_BOUNDS:new Sa.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var eL=/[^+/0-9A-Za-z-_]/g;function tL(r){if(r=r.split("=")[0],r=r.trim().replace(eL,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Ry(r,e){e=e||1/0;let t,i=r.length,n=null,s=[];for(let o=0;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function rL(r){let e=[];for(let t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function Ab(r){return Py.toByteArray(tL(r))}function eh(r,e,t,i){let n;for(n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function Ei(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function qy(r){return r!==r}var nL=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function Nn(r){return typeof BigInt>"u"?sL:r}function sL(){throw new Error("BigInt not supported")}});var bb=B((P$,_b)=>{f();_b.exports=Vy;Vy.supported=typeof WebAssembly<"u";function Vy(r){if(!Vy.supported)return null;var e=r&&r.imports,t=oL("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"),i=null,n={buffer:t,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),n;function s(u){n.exports.memory.grow(Math.ceil(Math.abs(u-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function o(u){if(n.exports)return u();if(i){i.then(u.bind(null,null)).catch(u);return}try{if(r&&r.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{i=WebAssembly.instantiate(t,e).then(a)}o(u)}function a(u){n.exports=u.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function oL(r){return typeof atob=="function"?new Uint8Array(atob(r).split("").map(aL)):new(Ib()).Buffer(r,"base64")}function aL(r){return r.charCodeAt(0)}});var Ob=B((L$,Ii)=>{f();var Ai=Oy(),ke=bb()(),Ji=64,th=[];Ii.exports=Lr;var Cb=Ii.exports.BYTES_MIN=16,Sb=Ii.exports.BYTES_MAX=64,M$=Ii.exports.BYTES=32,xb=Ii.exports.KEYBYTES_MIN=16,Tb=Ii.exports.KEYBYTES_MAX=64,R$=Ii.exports.KEYBYTES=32,Nb=Ii.exports.SALTBYTES=16,Db=Ii.exports.PERSONALBYTES=16;function Lr(r,e,t,i,n){if(!(this instanceof Lr))return new Lr(r,e,t,i,n);if(!(ke&&ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");r||(r=32),n!==!0&&(Ai(r>=Cb,"digestLength must be at least "+Cb+", was given "+r),Ai(r<=Sb,"digestLength must be at most "+Sb+", was given "+r),e!=null&&Ai(e.length>=xb,"key must be at least "+xb+", was given "+e.length),e!=null&&Ai(e.length<=Tb,"key must be at least "+Tb+", was given "+e.length),t!=null&&Ai(t.length===Nb,"salt must be exactly "+Nb+", was given "+t.length),i!=null&&Ai(i.length===Db,"personal must be exactly "+Db+", was given "+i.length)),th.length||(th.push(Ji),Ji+=216),this.digestLength=r,this.finalized=!1,this.pointer=th.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,t&&ke.memory.set(t,32),i&&ke.memory.set(i,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,Ji,Ji+e.length),ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(r){return Ai(this.finalized===!1,"Hash instance finalized"),Ai(r,"input must be TypedArray or Buffer"),Ji+r.length>ke.memory.length&&ke.realloc(Ji+r.length),ke.memory.set(r,Ji),ke.exports.blake2b_update(this.pointer,Ji,Ji+r.length),this};Lr.prototype.digest=function(r){if(Ai(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,th.push(this.pointer),ke.exports.blake2b_final(this.pointer),!r||r==="binary")return ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(r==="hex")return cL(ke.memory,this.pointer+128,this.digestLength);Ai(r.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{f();var Pn=Oy(),dc=Ob();function rh(r,e,t){var i=r[e]+r[t],n=r[e+1]+r[t+1];i>=4294967296&&n++,r[e]=i,r[e+1]=n}function Pb(r,e,t,i){var n=r[e]+t;t<0&&(n+=4294967296);var s=r[e+1]+i;n>=4294967296&&s++,r[e]=n,r[e+1]=s}function qb(r,e){return r[e]^r[e+1]<<8^r[e+2]<<16^r[e+3]<<24}function Dn(r,e,t,i,n,s){var o=hc[n],a=hc[n+1],u=hc[s],h=hc[s+1];rh(Se,r,e),Pb(Se,r,o,a);var p=Se[i]^Se[r],w=Se[i+1]^Se[r+1];Se[i]=w,Se[i+1]=p,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=p>>>24^w<<8,Se[e+1]=w>>>24^p<<8,rh(Se,r,e),Pb(Se,r,u,h),p=Se[i]^Se[r],w=Se[i+1]^Se[r+1],Se[i]=p>>>16^w<<16,Se[i+1]=w>>>16^p<<16,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=w>>>31^p<<1,Se[e+1]=p>>>31^w<<1}var Vb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),fL=[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],ar=new Uint8Array(fL.map(function(r){return r*2})),Se=new Uint32Array(32),hc=new Uint32Array(32);function Hb(r,e){var t=0;for(t=0;t<16;t++)Se[t]=r.h[t],Se[t+16]=Vb[t];for(Se[24]=Se[24]^r.t,Se[25]=Se[25]^r.t/4294967296,e&&(Se[28]=~Se[28],Se[29]=~Se[29]),t=0;t<32;t++)hc[t]=qb(r.b,4*t);for(t=0;t<12;t++)Dn(0,8,16,24,ar[t*16+0],ar[t*16+1]),Dn(2,10,18,26,ar[t*16+2],ar[t*16+3]),Dn(4,12,20,28,ar[t*16+4],ar[t*16+5]),Dn(6,14,22,30,ar[t*16+6],ar[t*16+7]),Dn(0,10,20,30,ar[t*16+8],ar[t*16+9]),Dn(2,12,22,24,ar[t*16+10],ar[t*16+11]),Dn(4,14,16,26,ar[t*16+12],ar[t*16+13]),Dn(6,8,18,28,ar[t*16+14],ar[t*16+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^Se[t]^Se[t+16]}var On=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 Da(r,e,t,i){On.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=r,On[0]=r,e&&(On[1]=e.length),On[2]=1,On[3]=1,t&&On.set(t,32),i&&On.set(i,48);for(var n=0;n<16;n++)this.h[n]=Vb[n]^qb(On,n*4);e&&(Qb(this,e),this.c=128)}Da.prototype.update=function(r){return Pn(r!=null,"input must be Uint8Array or Buffer"),Qb(this,r),this};Da.prototype.digest=function(r){var e=!r||r==="binary"||r==="hex"?new Uint8Array(this.outlen):r;return Pn(e.length>=this.outlen,"out must have at least outlen bytes of space"),hL(this,e),r==="hex"?dL(e):e};Da.prototype.final=Da.prototype.digest;Da.ready=function(r){dc.ready(function(){r()})};function Qb(r,e){for(var t=0;t>2]>>8*(t&3);return e}function dL(r){for(var e="",t=0;t=Bb,"outlen must be at least "+Bb+", was given "+e),Pn(e<=Mb,"outlen must be at most "+Mb+", was given "+e),t!=null&&Pn(t.length>=Rb,"key must be at least "+Rb+", was given "+t.length),t!=null&&Pn(t.length<=Lb,"key must be at most "+Lb+", was given "+t.length),i!=null&&Pn(i.length===Fb,"salt must be exactly "+Fb+", was given "+i.length),n!=null&&Pn(n.length===Ub,"personal must be exactly "+Ub+", was given "+n.length)),new jb(e,t,i,n)};wr.exports.ready=function(r){dc.ready(function(){r()})};wr.exports.WASM_SUPPORTED=dc.SUPPORTED;wr.exports.WASM_LOADED=!1;var Bb=wr.exports.BYTES_MIN=16,Mb=wr.exports.BYTES_MAX=64,U$=wr.exports.BYTES=32,Rb=wr.exports.KEYBYTES_MIN=16,Lb=wr.exports.KEYBYTES_MAX=64,q$=wr.exports.KEYBYTES=32,Fb=wr.exports.SALTBYTES=16,Ub=wr.exports.PERSONALBYTES=16;dc.ready(function(r){r||(wr.exports.WASM_LOADED=!0,jb=dc)})});var jy=B(Fr=>{"use strict";f();var gL=Fr&&Fr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),yL=Fr&&Fr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),mL=Fr&&Fr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gL(e,r,t);return yL(e,r),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var Oa=jr(),Hy=Gr(),wL=Wu(),vL=mL(Ye()),EL=YI(),Qy=XI(),AL=tb(),Kb=nb(),zb=sc(),IL=Tr(),_L=Gb(),bL=32,pc=class{constructor({nonce:e,value:t,receiver:i,sender:n,gasPrice:s,gasLimit:o,data:a,chainID:u,version:h,options:p}){this.nonce=e||0,this.value=t?new Oa.BigNumber(t.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.gasPrice=s||wL.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new zb.TransactionPayload,this.chainID=u,this.version=h||Qy.TransactionVersion.withDefaultVersion(),this.options=p||Qy.TransactionOptions.withDefaultOptions(),this.signature=Kb.Signature.empty(),this.hash=zs.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}getReceiver(){return this.receiver}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}getOptions(){return this.options}getSignature(){return this.signature}getHash(){return IL.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(e){let t=this.toPlainObject(e);t.signature&&delete t.signature;let i=JSON.stringify(t);return y.Buffer.from(i)}toPlainObject(e){return{nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:e?e.bech32():this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),signature:this.signature.hex()?this.signature.hex():void 0}}static fromPlainObject(e){let t=new pc({nonce:Number(e.nonce),value:new Oa.BigNumber(e.value).toFixed(0),receiver:Hy.Address.fromString(e.receiver),sender:Hy.Address.fromString(e.sender),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new zb.TransactionPayload(y.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Qy.TransactionVersion(e.version)});return e.signature&&t.applySignature(new Kb.Signature(e.signature),Hy.Address.fromString(e.sender)),t}applySignature(e,t){this.signature=e,this.sender=t,this.hash=zs.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let t=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(t>this.gasLimit.valueOf())throw new vL.ErrNotEnoughGas(this.gasLimit.valueOf());let i=new Oa.BigNumber(this.gasPrice.valueOf()),n=new Oa.BigNumber(t).multipliedBy(i);if(t===this.gasLimit.valueOf())return n;let s=new Oa.BigNumber(this.gasLimit.valueOf()-t),o=i.multipliedBy(new Oa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return n.plus(a)}};Fr.Transaction=pc;var zs=class extends EL.Hash{constructor(e){super(e)}static compute(e){let i=new AL.ProtoSerializer().serializeTransaction(e),n=_L(bL).update(i).digest("hex");return new zs(n)}};Fr.TransactionHash=zs});var Gy=B(Ws=>{"use strict";f();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Logger=Ws.LogLevel=void 0;var ks;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warn=3]="Warn",r[r.Error=4]="Error",r[r.None=5]="None"})(ks=Ws.LogLevel||(Ws.LogLevel={}));var Jr=class{static setLevel(e){Jr.logLevel=e}static trace(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static debug(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static info(e,...t){Jr.logLevel>=ks.Info||console.log(e,t)}static warn(e,...t){Jr.logLevel>=ks.Warn||console.warn(e,t)}static error(e,...t){Jr.logLevel>=ks.Error||console.error(e,t)}};Ws.Logger=Jr;Jr.logLevel=ks.Debug});var kb=B(_i=>{"use strict";f();var CL=_i&&_i.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),SL=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),xL=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&CL(e,r,t);return SL(e,r),e};Object.defineProperty(_i,"__esModule",{value:!0});_i.AsyncTimer=void 0;var TL=xL(Ye()),NL=Ye(),Ky=Gy(),zy=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new TL.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((t,i)=>{this.rejectionFunc=i;let n=()=>{this.rejectionFunc=null,this.stop(),t()};this.timeoutHandle=setTimeout(n,e)})}abort(){Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new NL.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_i.AsyncTimer=zy});var Wy=B(Ba=>{"use strict";f();var Ur=Ba&&Ba.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Ba,"__esModule",{value:!0});Ba.TransactionWatcher=void 0;var Wb=kb(),$b=Gy(),Pa=Ye(),bi=class{constructor(e,t=bi.DefaultPollingInterval,i=bi.DefaultTimeout){this.fetcher=new ky(e),this.pollingInterval=t,this.timeout=i}awaitPending(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.status.isPending(),i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Pa.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitCompleted(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.isCompleted,i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Pa.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitAllEvents(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.every(h=>a.includes(h))},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Pa.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitAnyEvent(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.find(h=>a.includes(h))!=null},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Pa.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitOnCondition(e,t){return Ur(this,void 0,void 0,function*(){let i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Pa.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitConditionally(e,t,i){return Ur(this,void 0,void 0,function*(){let n=new Wb.AsyncTimer("watcher:periodic"),s=new Wb.AsyncTimer("watcher:timeout"),o=!1,a,u=!1;for(s.start(this.timeout).finally(()=>{s.stop(),o=!0});!o;){yield n.start(this.pollingInterval);try{if(a=yield t(),u=e(a),u||o)break}catch(h){if($b.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(h instanceof Pa.Err))throw h}}if(s.isStopped()||s.stop(),!a||!u)throw i();return a})}getAllTransactionEvents(e){let t=[...e.logs.events];for(let i of e.contractResults.items)t.push(...i.logs.events);return t}};Ba.TransactionWatcher=bi;bi.DefaultPollingInterval=6e3;bi.DefaultTimeout=bi.DefaultPollingInterval*15;bi.NoopOnStatusReceived=r=>{};var ky=class{constructor(e){this.fetcher=e}getTransaction(e){return Ur(this,void 0,void 0,function*(){return $b.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var Yb=B(Ci=>{"use strict";f();var DL=Ci&&Ci.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),OL=Ci&&Ci.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),PL=Ci&&Ci.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&DL(e,r,t);return OL(e,r),e};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ContractFunction=void 0;var BL=PL(Ye()),gc=class{constructor(e){if(this.name=e,e==null)throw new BL.ErrInvalidFunctionName}static none(){return new gc("untitled")}toString(){return this.name}valueOf(){return this.name}equals(e){return e?this.name==e.name:!1}};Ci.ContractFunction=gc});var Jb=B(Ma=>{"use strict";f();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.Signature=Ma.Address=void 0;var $y=class{constructor(e){this.value=e}bech32(){return this.value}};Ma.Address=$y;var Yy=class{constructor(e){this.value=e}hex(){return this.value}};Ma.Signature=Yy});var Xb=B(yc=>{"use strict";f();Object.defineProperty(yc,"__esModule",{value:!0});yc.Operation=void 0;var ML;(function(r){r.Connect="connect",r.Logout="logout",r.SignTransactions="signTransactions",r.SignMessage="signMessage",r.CancelAction="cancelAction"})(ML=yc.Operation||(yc.Operation={}))});var Zb=B(Bn=>{"use strict";f();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ErrAccountNotConnected=Bn.ErrCannotSignSingleTransaction=Bn.Err=void 0;var mc=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Bn.Err=mc;var Jy=class extends mc{constructor(){super("Cannot sign single transaction.")}};Bn.ErrCannotSignSingleTransaction=Jy;var Xy=class extends mc{constructor(){super("Account is not connected.")}};Bn.ErrAccountNotConnected=Xy});var Zy=B(Ra=>{"use strict";f();var Mn=Ra&&Ra.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.ExtensionProvider=void 0;var ih=Jb(),wc=Xb(),eC=Zb(),Si=class{constructor(){if(this.account={address:""},this.initialized=!1,Si._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");Si._instance=this}static getInstance(){return Si._instance}setAddress(e){return this.account.address=e,Si._instance}init(){return Mn(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Mn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:t}=e,i=t||"";return yield this.startBgrMsgChannel(wc.Operation.Connect,i),this.account.address})}logout(){return Mn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(wc.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 Mn(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 Mn(this,void 0,void 0,function*(){return Boolean(this.account.address)})}signTransaction(e){return Mn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.signTransactions([e]);if(t.length!=1)throw new eC.ErrCannotSignSingleTransaction;return t[0]})}ensureConnected(){if(!this.account.address)throw new eC.ErrAccountNotConnected}signTransactions(e){return Mn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.startBgrMsgChannel(wc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(i=>i.toPlainObject())});try{for(let i=0;i{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);let n=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&Boolean(s.data.data.address)&&(this.account=s.data.data),window.removeEventListener("message",n),i(s.data.data)):(window.removeEventListener("message",n),i(s.data.data)))};window.addEventListener("message",n,!1)})}};Ra.ExtensionProvider=Si;Si._instance=new Si});var oC=B((gY,sC)=>{"use strict";f();function RL(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}sC.exports=LL;function LL(r,e,t){var i=t&&t.stringify||RL,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var a=1;a-1?w:0,r.charCodeAt(O+1)){case 100:case 102:if(p>=u||e[p]==null)break;w=u||e[p]==null)break;w=u||e[p]===void 0)break;w",w=O+2,O++;break}h+=i(e[p]),w=O+2,O++;break;case 115:if(p>=u)break;w{"use strict";f();var aC=oC();lC.exports=Ti;var vc=zL().console||{},FL={mapHttpRequest:uh,mapHttpResponse:uh,wrapRequestSerializer:em,wrapResponseSerializer:em,wrapErrorSerializer:em,req:uh,res:uh,err:QL};function UL(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Ti(r){r=r||{},r.browser=r.browser||{};let e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let t=r.browser.write||vc;r.browser.write&&(r.browser.asObject=!0);let i=r.serializers||{},n=UL(r.browser.serialize,i),s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");let a=r.level||"info",u=Object.create(t);u.log||(u.log=Ec),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:w,set:N});let h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:jL(r)};u.levels=Ti.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=Ec,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=O,e&&(u._logEvent=tm());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function N(T){if(T!=="silent"&&!this.levels.values[T])throw Error("unknown level "+T);this._level=T,La(h,u,"error","log"),La(h,u,"fatal","error"),La(h,u,"warn","error"),La(h,u,"info","log"),La(h,u,"debug","log"),La(h,u,"trace","log")}function O(T,V){if(!T)throw new Error("missing bindings for child Pino");V=V||{},n&&T.serializers&&(V.serializers=T.serializers);let z=V.serializers;if(n&&z){var $=Object.assign({},i,z),se=r.browser.serialize===!0?Object.keys($):n;delete T.serializers,ch([T],se,$,this._stdErrSerialize)}function Y(j){this._childLevel=(j._childLevel|0)+1,this.error=Fa(j,T,"error"),this.fatal=Fa(j,T,"fatal"),this.warn=Fa(j,T,"warn"),this.info=Fa(j,T,"info"),this.debug=Fa(j,T,"debug"),this.trace=Fa(j,T,"trace"),$&&(this.serializers=$,this._serialize=se),e&&(this._logEvent=tm([].concat(j._logEvent.bindings,T)))}return Y.prototype=this,new Y(this)}return u}Ti.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"}};Ti.stdSerializers=FL;Ti.stdTimeFunctions=Object.assign({},{nullTime:uC,epochTime:cC,unixTime:GL,isoTime:KL});function La(r,e,t,i){let n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Ec:n[t]?n[t]:vc[t]||vc[i]||Ec,qL(r,e,t)}function qL(r,e,t){!r.transmit&&e[t]===Ec||(e[t]=function(i){return function(){let s=r.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vc?vc:this;for(var u=0;u-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Fa(r,e,t){return function(){let i=new Array(1+arguments.length);i[0]=e;for(var n=1;n{"use strict";f();var Ua=typeof Reflect=="object"?Reflect:null,fC=Ua&&typeof Ua.apply=="function"?Ua.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},fh;Ua&&typeof Ua.ownKeys=="function"?fh=Ua.ownKeys:Object.getOwnPropertySymbols?fh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:fh=function(e){return Object.getOwnPropertyNames(e)};function kL(r){console&&console.warn&&console.warn(r)}var dC=Number.isNaN||function(e){return e!==e};function je(){je.init.call(this)}rm.exports=je;rm.exports.once=JL;je.EventEmitter=je;je.prototype._events=void 0;je.prototype._eventsCount=0;je.prototype._maxListeners=void 0;var hC=10;function hh(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return hC},set:function(r){if(typeof r!="number"||r<0||dC(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");hC=r}});je.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};je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dC(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 pC(r){return r._maxListeners===void 0?je.defaultMaxListeners:r._maxListeners}je.prototype.getMaxListeners=function(){return pC(this)};je.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[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")fC(u,this,t);else for(var h=u.length,p=vC(u,h),i=0;i0&&o.length>n&&!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=r,a.type=e,a.count=o.length,kL(a)}return r}je.prototype.addListener=function(e,t){return gC(this,e,t,!1)};je.prototype.on=je.prototype.addListener;je.prototype.prependListener=function(e,t){return gC(this,e,t,!0)};function WL(){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 yC(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=WL.bind(i);return n.listener=t,i.wrapFn=n,n}je.prototype.once=function(e,t){return hh(t),this.on(e,yC(this,e,t)),this};je.prototype.prependOnceListener=function(e,t){return hh(t),this.prependListener(e,yC(this,e,t)),this};je.prototype.removeListener=function(e,t){var i,n,s,o,a;if(hh(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():$L(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};je.prototype.off=je.prototype.removeListener;je.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function mC(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?YL(n):vC(n,n.length)}je.prototype.listeners=function(e){return mC(this,e,!0)};je.prototype.rawListeners=function(e){return mC(this,e,!1)};je.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):wC.call(r,e)};je.prototype.listenerCount=wC;function wC(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}je.prototype.eventNames=function(){return this._eventsCount>0?fh(this._events):[]};function vC(r,e){for(var t=new Array(e),i=0;inm,__asyncDelegator:()=>f5,__asyncGenerator:()=>l5,__asyncValues:()=>h5,__await:()=>Ac,__awaiter:()=>n5,__classPrivateFieldGet:()=>y5,__classPrivateFieldSet:()=>m5,__createBinding:()=>o5,__decorate:()=>t5,__exportStar:()=>a5,__extends:()=>ZL,__generator:()=>s5,__importDefault:()=>g5,__importStar:()=>p5,__makeTemplateObject:()=>d5,__metadata:()=>i5,__param:()=>r5,__read:()=>AC,__rest:()=>e5,__spread:()=>u5,__spreadArrays:()=>c5,__values:()=>sm});function ZL(r,e){im(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function e5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n=0;a--)(o=r[a])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function r5(r,e){return function(t,i){e(t,i,r)}}function i5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function n5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})}function s5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,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(h){return function(p){return u([h,p])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=h[0]&2?n.return:h[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,h[1])).done)return s;switch(n=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,n=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function AC(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function u5(){for(var r=[],e=0;e1||a(N,O)})})}function a(N,O){try{u(i[N](O))}catch(T){w(s[0][3],T)}}function u(N){N.value instanceof Ac?Promise.resolve(N.value.v).then(h,p):w(s[0][2],N)}function h(N){a("next",N)}function p(N){a("throw",N)}function w(N,O){N(O),s.shift(),s.length&&a(s[0][0],s[0][1])}}function f5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(o){return(t=!t)?{value:Ac(r[n](o)),done:n==="return"}:s?s(o):o}:s}}function h5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof sm=="function"?sm(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(o){return new Promise(function(a,u){o=r[s](o),n(a,u,o.done,o.value)})}}function n(s,o,a,u){Promise.resolve(u).then(function(h){s({value:h,done:a})},o)}}function d5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function p5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function g5(r){return r&&r.__esModule?r:{default:r}}function y5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function m5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var im,nm,br=me(()=>{f();im=function(r,e){return im=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},im(r,e)};nm=function(){return nm=Object.assign||function(e){for(var t,i=1,n=arguments.length;i{"use strict";f();Object.defineProperty(dh,"__esModule",{value:!0});function w5(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}dh.safeJsonParse=w5;function v5(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}dh.safeJsonStringify=v5});var IC=B((bY,ph)=>{"use strict";f();(function(){"use strict";let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){let t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?ph.exports=global.localStorage:typeof window<"u"&&window.localStorage?ph.exports=window.localStorage:ph.exports=new e})()});var _C=B(gh=>{"use strict";f();Object.defineProperty(gh,"__esModule",{value:!0});gh.IKeyValueStorage=void 0;var am=class{};gh.IKeyValueStorage=am});var bC=B(yh=>{"use strict";f();Object.defineProperty(yh,"__esModule",{value:!0});yh.parseEntry=void 0;var E5=om();function A5(r){var e;return[r[0],E5.safeJsonParse((e=r[1])!==null&&e!==void 0?e:"")]}yh.parseEntry=A5});var SC=B(mh=>{"use strict";f();Object.defineProperty(mh,"__esModule",{value:!0});var CC=(br(),at(_r));CC.__exportStar(_C(),mh);CC.__exportStar(bC(),mh)});var TC=B(Ic=>{"use strict";f();Object.defineProperty(Ic,"__esModule",{value:!0});Ic.KeyValueStorage=void 0;var qa=(br(),at(_r)),xC=om(),I5=qa.__importDefault(IC()),_5=SC(),wh=class{constructor(){this.localStorage=I5.default}getKeys(){return qa.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return qa.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_5.parseEntry)})}getItem(e){return qa.__awaiter(this,void 0,void 0,function*(){let t=this.localStorage.getItem(e);if(t!==null)return xC.safeJsonParse(t)})}setItem(e,t){return qa.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,xC.safeJsonStringify(t))})}removeItem(e){return qa.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Ic.KeyValueStorage=wh;Ic.default=wh});var NC=B(vh=>{"use strict";f();Object.defineProperty(vh,"__esModule",{value:!0});vh.delay=void 0;function b5(r){return new Promise(e=>{setTimeout(()=>{e(!0)},r)})}vh.delay=b5});var DC=B(Va=>{"use strict";f();Object.defineProperty(Va,"__esModule",{value:!0});Va.ONE_THOUSAND=Va.ONE_HUNDRED=void 0;Va.ONE_HUNDRED=100;Va.ONE_THOUSAND=1e3});var OC=B(ye=>{"use strict";f();Object.defineProperty(ye,"__esModule",{value:!0});ye.ONE_YEAR=ye.FOUR_WEEKS=ye.THREE_WEEKS=ye.TWO_WEEKS=ye.ONE_WEEK=ye.THIRTY_DAYS=ye.SEVEN_DAYS=ye.FIVE_DAYS=ye.THREE_DAYS=ye.ONE_DAY=ye.TWENTY_FOUR_HOURS=ye.TWELVE_HOURS=ye.SIX_HOURS=ye.THREE_HOURS=ye.ONE_HOUR=ye.SIXTY_MINUTES=ye.THIRTY_MINUTES=ye.TEN_MINUTES=ye.FIVE_MINUTES=ye.ONE_MINUTE=ye.SIXTY_SECONDS=ye.THIRTY_SECONDS=ye.TEN_SECONDS=ye.FIVE_SECONDS=ye.ONE_SECOND=void 0;ye.ONE_SECOND=1;ye.FIVE_SECONDS=5;ye.TEN_SECONDS=10;ye.THIRTY_SECONDS=30;ye.SIXTY_SECONDS=60;ye.ONE_MINUTE=ye.SIXTY_SECONDS;ye.FIVE_MINUTES=ye.ONE_MINUTE*5;ye.TEN_MINUTES=ye.ONE_MINUTE*10;ye.THIRTY_MINUTES=ye.ONE_MINUTE*30;ye.SIXTY_MINUTES=ye.ONE_MINUTE*60;ye.ONE_HOUR=ye.SIXTY_MINUTES;ye.THREE_HOURS=ye.ONE_HOUR*3;ye.SIX_HOURS=ye.ONE_HOUR*6;ye.TWELVE_HOURS=ye.ONE_HOUR*12;ye.TWENTY_FOUR_HOURS=ye.ONE_HOUR*24;ye.ONE_DAY=ye.TWENTY_FOUR_HOURS;ye.THREE_DAYS=ye.ONE_DAY*3;ye.FIVE_DAYS=ye.ONE_DAY*5;ye.SEVEN_DAYS=ye.ONE_DAY*7;ye.THIRTY_DAYS=ye.ONE_DAY*30;ye.ONE_WEEK=ye.SEVEN_DAYS;ye.TWO_WEEKS=ye.ONE_WEEK*2;ye.THREE_WEEKS=ye.ONE_WEEK*3;ye.FOUR_WEEKS=ye.ONE_WEEK*4;ye.ONE_YEAR=ye.ONE_DAY*365});var um=B(Eh=>{"use strict";f();Object.defineProperty(Eh,"__esModule",{value:!0});var PC=(br(),at(_r));PC.__exportStar(DC(),Eh);PC.__exportStar(OC(),Eh)});var MC=B(Ha=>{"use strict";f();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.fromMiliseconds=Ha.toMiliseconds=void 0;var BC=um();function C5(r){return r*BC.ONE_THOUSAND}Ha.toMiliseconds=C5;function S5(r){return Math.floor(r/BC.ONE_THOUSAND)}Ha.fromMiliseconds=S5});var LC=B(Ah=>{"use strict";f();Object.defineProperty(Ah,"__esModule",{value:!0});var RC=(br(),at(_r));RC.__exportStar(NC(),Ah);RC.__exportStar(MC(),Ah)});var FC=B(_c=>{"use strict";f();Object.defineProperty(_c,"__esModule",{value:!0});_c.Watch=void 0;var Ih=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 t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let i=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:i})}get(e){let t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};_c.Watch=Ih;_c.default=Ih});var UC=B(_h=>{"use strict";f();Object.defineProperty(_h,"__esModule",{value:!0});_h.IWatch=void 0;var cm=class{};_h.IWatch=cm});var qC=B(lm=>{"use strict";f();Object.defineProperty(lm,"__esModule",{value:!0});var x5=(br(),at(_r));x5.__exportStar(UC(),lm)});var Ys=B(Qa=>{"use strict";f();Object.defineProperty(Qa,"__esModule",{value:!0});var bh=(br(),at(_r));bh.__exportStar(LC(),Qa);bh.__exportStar(FC(),Qa);bh.__exportStar(qC(),Qa);bh.__exportStar(um(),Qa)});var fm,VC=me(()=>{f();fm=class{}});var hm={};ot(hm,{IEvents:()=>fm});var dm=me(()=>{f();VC()});var HC=B(Ch=>{"use strict";f();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.IHeartBeat=void 0;var T5=(dm(),at(hm)),pm=class extends T5.IEvents{constructor(e){super()}};Ch.IHeartBeat=pm});var ym=B(gm=>{"use strict";f();Object.defineProperty(gm,"__esModule",{value:!0});var N5=(br(),at(_r));N5.__exportStar(HC(),gm)});var QC=B(ja=>{"use strict";f();Object.defineProperty(ja,"__esModule",{value:!0});ja.HEARTBEAT_EVENTS=ja.HEARTBEAT_INTERVAL=void 0;var D5=Ys();ja.HEARTBEAT_INTERVAL=D5.FIVE_SECONDS;ja.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var wm=B(mm=>{"use strict";f();Object.defineProperty(mm,"__esModule",{value:!0});var O5=(br(),at(_r));O5.__exportStar(QC(),mm)});var jC=B(Sh=>{"use strict";f();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.HeartBeat=void 0;var vm=(br(),at(_r)),P5=$s(),B5=Ys(),M5=ym(),Em=wm(),bc=class extends M5.IHeartBeat{constructor(e){super(e),this.events=new P5.EventEmitter,this.interval=Em.HEARTBEAT_INTERVAL,this.interval=e?.interval||Em.HEARTBEAT_INTERVAL}static init(e){return vm.__awaiter(this,void 0,void 0,function*(){let t=new bc(e);return yield t.init(),t})}init(){return vm.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return vm.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),B5.toMiliseconds(this.interval))})}pulse(){this.events.emit(Em.HEARTBEAT_EVENTS.pulse)}};Sh.HeartBeat=bc});var GC=B(Cc=>{"use strict";f();Object.defineProperty(Cc,"__esModule",{value:!0});var Am=(br(),at(_r));Am.__exportStar(jC(),Cc);Am.__exportStar(ym(),Cc);Am.__exportStar(wm(),Cc)});var Im=B(Ga=>{"use strict";f();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.PINO_CUSTOM_CONTEXT_KEY=Ga.PINO_LOGGER_DEFAULTS=void 0;Ga.PINO_LOGGER_DEFAULTS={level:"info"};Ga.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var $C=B(vr=>{"use strict";f();Object.defineProperty(vr,"__esModule",{value:!0});vr.generateChildLogger=vr.formatChildLoggerContext=vr.getLoggerContext=vr.setBrowserLoggerContext=vr.getBrowserLoggerContext=vr.getDefaultLoggerOptions=void 0;var Ka=Im();function R5(r){return Object.assign(Object.assign({},r),{level:r?.level||Ka.PINO_LOGGER_DEFAULTS.level})}vr.getDefaultLoggerOptions=R5;function KC(r,e=Ka.PINO_CUSTOM_CONTEXT_KEY){return r[e]||""}vr.getBrowserLoggerContext=KC;function zC(r,e,t=Ka.PINO_CUSTOM_CONTEXT_KEY){return r[t]=e,r}vr.setBrowserLoggerContext=zC;function kC(r,e=Ka.PINO_CUSTOM_CONTEXT_KEY){let t="";return typeof r.bindings>"u"?t=KC(r,e):t=r.bindings().context||"",t}vr.getLoggerContext=kC;function WC(r,e,t=Ka.PINO_CUSTOM_CONTEXT_KEY){let i=kC(r,t);return i.trim()?`${i}/${e}`:e}vr.formatChildLoggerContext=WC;function L5(r,e,t=Ka.PINO_CUSTOM_CONTEXT_KEY){let i=WC(r,e,t),n=r.child({context:i});return zC(n,i,t)}vr.generateChildLogger=L5});var bm=B(za=>{"use strict";f();Object.defineProperty(za,"__esModule",{value:!0});za.pino=void 0;var _m=(br(),at(_r)),F5=_m.__importDefault(lh());Object.defineProperty(za,"pino",{enumerable:!0,get:function(){return F5.default}});_m.__exportStar(Im(),za);_m.__exportStar($C(),za)});var Hm=B(Wt=>{"use strict";f();Object.defineProperty(Wt,"__esModule",{value:!0});var ka=(dm(),at(hm)),YC=$s();function U5(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var q5=U5(YC),Cm=class extends ka.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Sm=class{constructor(e,t,i){this.core=e,this.logger=t}},xm=class extends ka.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Tm=class{constructor(e,t){this.logger=e,this.core=t}},Nm=class extends ka.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Dm=class extends ka.IEvents{constructor(e){super()}},Om=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},Pm=class{constructor(){this.map=new Map}},Bm=class extends ka.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Mm=class{constructor(e,t){this.core=e,this.logger=t}},Rm=class extends ka.IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},Lm=class{constructor(e,t){this.logger=e,this.core=t}},Fm=class extends q5.default{constructor(){super()}},Um=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qm=class extends YC.EventEmitter{constructor(){super()}},Vm=class{constructor(e){this.client=e}};Wt.ICore=Cm,Wt.ICrypto=Sm,Wt.IEngine=Vm,Wt.IEngineEvents=qm,Wt.IExpirer=Rm,Wt.IJsonRpcHistory=xm,Wt.IKeyChain=Mm,Wt.IMessageTracker=Tm,Wt.IPairing=Lm,Wt.IPublisher=Nm,Wt.IRelayer=Dm,Wt.ISignClient=Um,Wt.ISignClientEvents=Fm,Wt.IStore=Om,Wt.ISubscriber=Bm,Wt.ISubscriberTopicMap=Pm});var JC={};ot(JC,{safeJsonParse:()=>Sc,safeJsonStringify:()=>xc});function Sc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}function xc(r){return typeof r=="string"?r:JSON.stringify(r)}var xh=me(()=>{f()});var ZC=B(Th=>{"use strict";f();Object.defineProperty(Th,"__esModule",{value:!0});Th.BrowserRandomSource=void 0;var XC=65536,Qm=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 t=new Uint8Array(e);for(let i=0;i{"use strict";f();Object.defineProperty(jm,"__esModule",{value:!0});function V5(r){for(var e=0;e{f()});var tS=B(Nh=>{"use strict";f();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.NodeRandomSource=void 0;var H5=qr(),Gm=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof PE<"u"){let e=eS();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 t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let i=new Uint8Array(e);for(let n=0;n{"use strict";f();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.SystemRandomSource=void 0;var Q5=ZC(),j5=tS(),Km=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Q5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new j5.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)}};Dh.SystemRandomSource=Km});var iS=B(Cr=>{"use strict";f();Object.defineProperty(Cr,"__esModule",{value:!0});function G5(r,e){var t=r>>>16&65535,i=r&65535,n=e>>>16&65535,s=e&65535;return i*s+(t*s+i*n<<16>>>0)|0}Cr.mul=Math.imul||G5;function K5(r,e){return r+e|0}Cr.add=K5;function z5(r,e){return r-e|0}Cr.sub=z5;function k5(r,e){return r<>>32-e}Cr.rotl=k5;function W5(r,e){return r<<32-e|r>>>e}Cr.rotr=W5;function $5(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}Cr.isInteger=Number.isInteger||$5;Cr.MAX_SAFE_INTEGER=9007199254740991;Cr.isSafeInteger=function(r){return Cr.isInteger(r)&&r>=-Cr.MAX_SAFE_INTEGER&&r<=Cr.MAX_SAFE_INTEGER}});var Wa=B(Oe=>{"use strict";f();Object.defineProperty(Oe,"__esModule",{value:!0});var nS=iS();function Y5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Oe.readInt16BE=Y5;function J5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Oe.readUint16BE=J5;function X5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Oe.readInt16LE=X5;function Z5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Oe.readUint16LE=Z5;function sS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Oe.writeUint16BE=sS;Oe.writeInt16BE=sS;function oS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Oe.writeUint16LE=oS;Oe.writeInt16LE=oS;function zm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Oe.readInt32BE=zm;function km(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Oe.readUint32BE=km;function Wm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Oe.readInt32LE=Wm;function $m(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Oe.readUint32LE=$m;function Oh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Oe.writeUint32BE=Oh;Oe.writeInt32BE=Oh;function Ph(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Oe.writeUint32LE=Ph;Oe.writeInt32LE=Ph;function eF(r,e){e===void 0&&(e=0);var t=zm(r,e),i=zm(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Oe.readInt64BE=eF;function tF(r,e){e===void 0&&(e=0);var t=km(r,e),i=km(r,e+4);return t*4294967296+i}Oe.readUint64BE=tF;function rF(r,e){e===void 0&&(e=0);var t=Wm(r,e),i=Wm(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Oe.readInt64LE=rF;function iF(r,e){e===void 0&&(e=0);var t=$m(r,e),i=$m(r,e+4);return i*4294967296+t}Oe.readUint64LE=iF;function aS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Oh(r/4294967296>>>0,e,t),Oh(r>>>0,e,t+4),e}Oe.writeUint64BE=aS;Oe.writeInt64BE=aS;function uS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Ph(r>>>0,e,t),Ph(r/4294967296>>>0,e,t+4),e}Oe.writeUint64LE=uS;Oe.writeInt64LE=uS;function nF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Oe.readUintBE=nF;function sF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s=i;s--)t[s]=e/n&255,n*=256;return t}Oe.writeUintBE=oF;function aF(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nS.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s{"use strict";f();Object.defineProperty(ur,"__esModule",{value:!0});ur.randomStringForEntropy=ur.randomString=ur.randomUint32=ur.randomBytes=ur.defaultRandomSource=void 0;var yF=rS(),mF=Wa(),cS=qr();ur.defaultRandomSource=new yF.SystemRandomSource;function Ym(r,e=ur.defaultRandomSource){return e.randomBytes(r)}ur.randomBytes=Ym;function wF(r=ur.defaultRandomSource){let e=Ym(4,r),t=(0,mF.readUint32LE)(e);return(0,cS.wipe)(e),t}ur.randomUint32=wF;var lS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function fS(r,e=lS,t=ur.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 i="",n=e.length,s=256-256%n;for(;r>0;){let o=Ym(Math.ceil(r*256/s),t);for(let a=0;a0;a++){let u=o[a];u{"use strict";f();Object.defineProperty(Xi,"__esModule",{value:!0});var Ya=Wa(),$a=qr();Xi.DIGEST_LENGTH=64;Xi.BLOCK_SIZE=128;var dS=function(){function r(){this.digestLength=Xi.DIGEST_LENGTH,this.blockSize=Xi.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){$a.wipe(this._buffer),$a.wipe(this._tempHi),$a.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){$a.wipe(e.stateHi),$a.wipe(e.stateLo),e.buffer&&$a.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Xi.SHA512=dS;var hS=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 Jm(r,e,t,i,n,s,o){for(var a=t[0],u=t[1],h=t[2],p=t[3],w=t[4],N=t[5],O=t[6],T=t[7],V=i[0],z=i[1],$=i[2],se=i[3],Y=i[4],j=i[5],W=i[6],k=i[7],R,F,G,ce,J,X,A,c;o>=128;){for(var d=0;d<16;d++){var g=8*d+s;r[d]=Ya.readUint32BE(n,g),e[d]=Ya.readUint32BE(n,g+4)}for(var d=0;d<80;d++){var m=a,v=u,S=h,D=p,I=w,l=N,C=O,Z=T,ie=V,ee=z,ae=$,E=se,b=Y,x=j,L=W,P=k;if(R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(w>>>14|Y<<32-14)^(w>>>18|Y<<32-18)^(Y>>>41-32|w<<32-(41-32)),F=(Y>>>14|w<<32-14)^(Y>>>18|w<<32-18)^(w>>>41-32|Y<<32-(41-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=w&N^~w&O,F=Y&j^~Y&W,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=hS[d*2],F=hS[d*2+1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=r[d%16],F=e[d%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,G=A&65535|c<<16,ce=J&65535|X<<16,R=G,F=ce,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(a>>>28|V<<32-28)^(V>>>34-32|a<<32-(34-32))^(V>>>39-32|a<<32-(39-32)),F=(V>>>28|a<<32-28)^(a>>>34-32|V<<32-(34-32))^(a>>>39-32|V<<32-(39-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=a&u^a&h^u&h,F=V&z^V&$^z&$,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,Z=A&65535|c<<16,P=J&65535|X<<16,R=D,F=E,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=G,F=ce,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,D=A&65535|c<<16,E=J&65535|X<<16,u=m,h=v,p=S,w=D,N=I,O=l,T=C,a=Z,z=ie,$=ee,se=ae,Y=E,j=b,W=x,k=L,V=P,d%16===15)for(var g=0;g<16;g++)R=r[g],F=e[g],J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=r[(g+9)%16],F=e[(g+9)%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+1)%16],ce=e[(g+1)%16],R=(G>>>1|ce<<32-1)^(G>>>8|ce<<32-8)^G>>>7,F=(ce>>>1|G<<32-1)^(ce>>>8|G<<32-8)^(ce>>>7|G<<32-7),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+14)%16],ce=e[(g+14)%16],R=(G>>>19|ce<<32-19)^(ce>>>61-32|G<<32-(61-32))^G>>>6,F=(ce>>>19|G<<32-19)^(G>>>61-32|ce<<32-(61-32))^(ce>>>6|G<<32-6),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,r[g]=A&65535|c<<16,e[g]=J&65535|X<<16}R=a,F=V,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[0],F=i[0],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[0]=a=A&65535|c<<16,i[0]=V=J&65535|X<<16,R=u,F=z,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[1],F=i[1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[1]=u=A&65535|c<<16,i[1]=z=J&65535|X<<16,R=h,F=$,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[2],F=i[2],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[2]=h=A&65535|c<<16,i[2]=$=J&65535|X<<16,R=p,F=se,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[3],F=i[3],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[3]=p=A&65535|c<<16,i[3]=se=J&65535|X<<16,R=w,F=Y,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[4],F=i[4],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[4]=w=A&65535|c<<16,i[4]=Y=J&65535|X<<16,R=N,F=j,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[5],F=i[5],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[5]=N=A&65535|c<<16,i[5]=j=J&65535|X<<16,R=O,F=W,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[6],F=i[6],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[6]=O=A&65535|c<<16,i[6]=W=J&65535|X<<16,R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[7],F=i[7],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[7]=T=A&65535|c<<16,i[7]=k=J&65535|X<<16,s+=128,o-=128}return s}function EF(r){var e=new dS;e.update(r);var t=e.digest();return e.clean(),t}Xi.hash=EF});var TS=B(He=>{"use strict";f();Object.defineProperty(He,"__esModule",{value:!0});He.convertSecretKeyToX25519=He.convertPublicKeyToX25519=He.verify=He.sign=He.extractPublicKeyFromSecretKey=He.generateKeyPair=He.generateKeyPairFromSeed=He.SEED_LENGTH=He.SECRET_KEY_LENGTH=He.PUBLIC_KEY_LENGTH=He.SIGNATURE_LENGTH=void 0;var AF=Tc(),Nc=pS(),vS=qr();He.SIGNATURE_LENGTH=64;He.PUBLIC_KEY_LENGTH=32;He.SECRET_KEY_LENGTH=64;He.SEED_LENGTH=32;function ve(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,ES(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function AS(r,e){let t=0;for(let i=0;i<32;i++)t|=r[i]^e[i];return(1&t-1>>>8)-1}function mS(r,e){let t=new Uint8Array(32),i=new Uint8Array(32);return Dc(t,r),Dc(i,e),AS(t,i)}function IS(r){let e=new Uint8Array(32);return Dc(e,r),e[0]&1}function SF(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function Js(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function Zs(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function Ge(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Xs(r,e){Ge(r,e,e)}function _S(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=253;i>=0;i--)Xs(t,t),i!==2&&i!==4&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function xF(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=250;i>=0;i--)Xs(t,t),i!==1&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function tw(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve(),h=ve(),p=ve();Zs(t,r[1],r[0]),Zs(p,e[1],e[0]),Ge(t,t,p),Js(i,r[0],r[1]),Js(p,e[0],e[1]),Ge(i,i,p),Ge(n,r[3],e[3]),Ge(n,n,bF),Ge(s,r[2],e[2]),Js(s,s,s),Zs(o,i,t),Zs(a,s,n),Js(u,s,n),Js(h,i,t),Ge(r[0],o,a),Ge(r[1],h,u),Ge(r[2],u,a),Ge(r[3],o,h)}function wS(r,e,t){for(let i=0;i<4;i++)ES(r[i],e[i],t)}function iw(r,e){let t=ve(),i=ve(),n=ve();_S(n,e[2]),Ge(t,e[0],n),Ge(i,e[1],n),Dc(r,i),r[31]^=IS(t)<<7}function bS(r,e,t){Rn(r[0],ew),Rn(r[1],Ja),Rn(r[2],Ja),Rn(r[3],ew);for(let i=255;i>=0;--i){let n=t[i/8|0]>>(i&7)&1;wS(r,e,n),tw(e,r),tw(r,r),wS(r,e,n)}}function nw(r,e){let t=[ve(),ve(),ve(),ve()];Rn(t[0],gS),Rn(t[1],yS),Rn(t[2],Ja),Ge(t[3],gS,yS),bS(r,t,e)}function CS(r){if(r.length!==He.SEED_LENGTH)throw new Error(`ed25519: seed must be ${He.SEED_LENGTH} bytes`);let e=(0,Nc.hash)(r);e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(32),i=[ve(),ve(),ve(),ve()];nw(i,e),iw(t,i);let n=new Uint8Array(64);return n.set(r),n.set(t,32),{publicKey:t,secretKey:n}}He.generateKeyPairFromSeed=CS;function TF(r){let e=(0,AF.randomBytes)(32,r),t=CS(e);return(0,vS.wipe)(e),t}He.generateKeyPair=TF;function NF(r){if(r.length!==He.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${He.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))}He.extractPublicKeyFromSecretKey=NF;var Zm=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 SS(r,e){let t,i,n,s;for(i=63;i>=32;--i){for(t=0,n=i-32,s=i-12;n>4)*Zm[n],t=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=t*Zm[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,r[i]=e[i]&255}function rw(r){let e=new Float64Array(64);for(let t=0;t<64;t++)e[t]=r[t];for(let t=0;t<64;t++)r[t]=0;SS(r,e)}function DF(r,e){let t=new Float64Array(64),i=[ve(),ve(),ve(),ve()],n=(0,Nc.hash)(r.subarray(0,32));n[0]&=248,n[31]&=127,n[31]|=64;let s=new Uint8Array(64);s.set(n.subarray(32),32);let o=new Nc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),rw(a),nw(i,a),iw(s,i),o.reset(),o.update(s.subarray(0,32)),o.update(r.subarray(32)),o.update(e);let u=o.digest();rw(u);for(let h=0;h<32;h++)t[h]=a[h];for(let h=0;h<32;h++)for(let p=0;p<32;p++)t[h+p]+=u[h]*n[p];return SS(s.subarray(32),t),s}He.sign=DF;function xS(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve();return Rn(r[2],Ja),SF(r[1],e),Xs(n,r[1]),Ge(s,n,_F),Zs(n,n,r[2]),Js(s,r[2],s),Xs(o,s),Xs(a,o),Ge(u,a,o),Ge(t,u,n),Ge(t,t,s),xF(t,t),Ge(t,t,n),Ge(t,t,s),Ge(t,t,s),Ge(r[0],t,s),Xs(i,r[0]),Ge(i,i,s),mS(i,n)&&Ge(r[0],r[0],CF),Xs(i,r[0]),Ge(i,i,s),mS(i,n)?-1:(IS(r[0])===e[31]>>7&&Zs(r[0],ew,r[0]),Ge(r[3],r[0],r[1]),0)}function OF(r,e,t){let i=new Uint8Array(32),n=[ve(),ve(),ve(),ve()],s=[ve(),ve(),ve(),ve()];if(t.length!==He.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${He.SIGNATURE_LENGTH} bytes`);if(xS(s,r))return!1;let o=new Nc.SHA512;o.update(t.subarray(0,32)),o.update(r),o.update(e);let a=o.digest();return rw(a),bS(n,s,a),nw(s,t.subarray(32)),tw(n,s),iw(i,n),!AS(t,i)}He.verify=OF;function PF(r){let e=[ve(),ve(),ve(),ve()];if(xS(e,r))throw new Error("Ed25519: invalid public key");let t=ve(),i=ve(),n=e[1];Js(t,Ja,n),Zs(i,Ja,n),_S(i,i),Ge(t,t,i);let s=new Uint8Array(32);return Dc(s,t),s}He.convertPublicKeyToX25519=PF;function BF(r){let e=(0,Nc.hash)(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(e.subarray(0,32));return(0,vS.wipe)(e),t}He.convertSecretKeyToX25519=BF});var Bh,Mh,eo,Xa,Rh,Oc,Lh,Fh,Uh,Za,qh,Vh,NS,DS,Hh=me(()=>{f();Bh="EdDSA",Mh="JWT",eo=".",Xa="base64url",Rh="utf8",Oc="utf8",Lh=":",Fh="did",Uh="key",Za="base58btc",qh="z",Vh="K36",NS=32,DS=32});function eu(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Qh=me(()=>{f()});function jh(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));let t=eu(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var sw=me(()=>{f();Qh()});function MF(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var RF,LF,OS,PS=me(()=>{f();RF=MF,LF=RF,OS=LF});var rX,BS,Zi,MS,RS,Ln=me(()=>{f();rX=new Uint8Array(0),BS=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},MS=r=>new TextEncoder().encode(r),RS=r=>new TextDecoder().decode(r)});var ow,aw,uw,FS,cw,tu,Fn,FF,UF,ut,Xr=me(()=>{f();PS();Ln();ow=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},aw=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 FS(this,e)}},uw=class{constructor(e){this.decoders=e}or(e){return FS(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FS=(r,e)=>new uw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),cw=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new ow(e,t,i),this.decoder=new aw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},tu=({name:r,prefix:e,encode:t,decode:i})=>new cw(r,e,t,i),Fn=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=OS(t,e);return tu({prefix:r,name:e,encode:i,decode:s=>Zi(n(s))})},FF=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},UF=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<tu({prefix:e,name:r,encode(n){return UF(n,i,t)},decode(n){return FF(n,i,t,r)}})});var lw={};ot(lw,{identity:()=>qF});var qF,US=me(()=>{f();Xr();Ln();qF=tu({prefix:"\0",name:"identity",encode:r=>RS(r),decode:r=>MS(r)})});var fw={};ot(fw,{base2:()=>VF});var VF,qS=me(()=>{f();Xr();VF=ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var hw={};ot(hw,{base8:()=>HF});var HF,VS=me(()=>{f();Xr();HF=ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var dw={};ot(dw,{base10:()=>QF});var QF,HS=me(()=>{f();Xr();QF=Fn({prefix:"9",name:"base10",alphabet:"0123456789"})});var pw={};ot(pw,{base16:()=>jF,base16upper:()=>GF});var jF,GF,QS=me(()=>{f();Xr();jF=ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),GF=ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var gw={};ot(gw,{base32:()=>ru,base32hex:()=>WF,base32hexpad:()=>YF,base32hexpadupper:()=>JF,base32hexupper:()=>$F,base32pad:()=>zF,base32padupper:()=>kF,base32upper:()=>KF,base32z:()=>XF});var ru,KF,zF,kF,WF,$F,YF,JF,XF,yw=me(()=>{f();Xr();ru=ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),KF=ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zF=ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kF=ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),WF=ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$F=ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YF=ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),JF=ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),XF=ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var mw={};ot(mw,{base36:()=>ZF,base36upper:()=>e4});var ZF,e4,jS=me(()=>{f();Xr();ZF=Fn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),e4=Fn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var ww={};ot(ww,{base58btc:()=>Ni,base58flickr:()=>t4});var Ni,t4,vw=me(()=>{f();Xr();Ni=Fn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),t4=Fn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Ew={};ot(Ew,{base64:()=>r4,base64pad:()=>i4,base64url:()=>n4,base64urlpad:()=>s4});var r4,i4,n4,s4,GS=me(()=>{f();Xr();r4=ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),i4=ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),n4=ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),s4=ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Aw={};ot(Aw,{base256emoji:()=>l4});function u4(r){return r.reduce((e,t)=>(e+=o4[t],e),"")}function c4(r){let e=[];for(let t of r){let i=a4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var KS,o4,a4,l4,zS=me(()=>{f();Xr();KS=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}"),o4=KS.reduce((r,e,t)=>(r[t]=e,r),[]),a4=KS.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);l4=tu({prefix:"\u{1F680}",name:"base256emoji",encode:u4,decode:c4})});function $S(r,e,t){e=e||[],t=t||0;for(var i=t;r>=p4;)e[t++]=r&255|kS,r/=128;for(;r&d4;)e[t++]=r&255|kS,r>>>=7;return e[t]=r|0,$S.bytes=t-i+1,e}function Iw(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Iw.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WS)<=y4);return Iw.bytes=s-i,t}var f4,kS,h4,d4,p4,g4,y4,WS,m4,w4,v4,E4,A4,I4,_4,b4,C4,S4,x4,T4,Pc,YS=me(()=>{f();f4=$S,kS=128,h4=127,d4=~h4,p4=Math.pow(2,31);g4=Iw,y4=128,WS=127;m4=Math.pow(2,7),w4=Math.pow(2,14),v4=Math.pow(2,21),E4=Math.pow(2,28),A4=Math.pow(2,35),I4=Math.pow(2,42),_4=Math.pow(2,49),b4=Math.pow(2,56),C4=Math.pow(2,63),S4=function(r){return r{f();YS();Bc=(r,e=0)=>[Pc.decode(r,e),Pc.decode.bytes],iu=(r,e,t=0)=>(Pc.encode(r,e,t),e),nu=r=>Pc.encodingLength(r)});var to,JS,XS,su,Rc=me(()=>{f();Ln();Kh();to=(r,e)=>{let t=e.byteLength,i=nu(r),n=i+nu(t),s=new Uint8Array(n+t);return iu(r,s,0),iu(t,s,i),s.set(e,n),new su(r,t,e,s)},JS=r=>{let e=Zi(r),[t,i]=Bc(e),[n,s]=Bc(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new su(t,n,o,e)},XS=(r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&BS(r.bytes,e.bytes),su=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}});var bw,_w,Cw=me(()=>{f();Rc();bw=({name:r,code:e,encode:t})=>new _w(r,e,t),_w=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?to(this.code,t):t.then(i=>to(this.code,i))}else throw Error("Unknown type, must be binary type")}}});var Sw={};ot(Sw,{sha256:()=>N4,sha512:()=>D4});var ex,N4,D4,tx=me(()=>{f();Cw();ex=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),N4=bw({name:"sha2-256",code:18,encode:ex("SHA-256")}),D4=bw({name:"sha2-512",code:19,encode:ex("SHA-512")})});var xw={};ot(xw,{identity:()=>B4});var rx,O4,ix,P4,B4,nx=me(()=>{f();Ln();Rc();rx=0,O4="identity",ix=Zi,P4=r=>to(rx,ix(r)),B4={code:rx,name:O4,encode:ix,digest:P4}});var sx=me(()=>{f();Ln()});var QX,jX,ox=me(()=>{f();QX=new TextEncoder,jX=new TextDecoder});var Vt,L4,F4,U4,Lc,q4,ax,ux,zh,kh,V4,H4,Q4,cx=me(()=>{f();Kh();Rc();vw();yw();Ln();Vt=class{constructor(e,t,i,n){this.code=t,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:kh,byteLength:kh,code:zh,version:zh,multihash:zh,bytes:zh,_baseCache:kh,asCID:kh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Lc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==q4)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Vt.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,i=to(e,t);return Vt.createV1(this.code,i)}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&&XS(this.multihash,e.multihash)}toString(e){let{bytes:t,version:i,_baseCache:n}=this;switch(i){case 0:return F4(t,n,e||Ni.encoder);default:return U4(t,n,e||ru.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 H4(/^0\.0/,Q4),!!(e&&(e[ux]||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 Vt)return e;if(e!=null&&e.asCID===e){let{version:t,code:i,multihash:n,bytes:s}=e;return new Vt(t,i,n,s||ax(t,i,n.bytes))}else if(e!=null&&e[ux]===!0){let{version:t,multihash:i,code:n}=e,s=JS(i);return Vt.create(t,n,s)}else return null}static create(e,t,i){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Lc)throw new Error(`Version 0 CID must use dag-pb (code: ${Lc}) block encoding`);return new Vt(e,t,i,i.bytes)}case 1:{let n=ax(e,t,i.bytes);return new Vt(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return Vt.create(0,Lc,e)}static createV1(e,t){return Vt.create(1,e,t)}static decode(e){let[t,i]=Vt.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Vt.inspectBytes(e),i=t.size-t.multihashSize,n=Zi(e.subarray(i,i+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),o=new su(t.multihashCode,t.digestSize,s,n);return[t.version===0?Vt.createV0(o):Vt.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,i=()=>{let[w,N]=Bc(e.subarray(t));return t+=N,w},n=i(),s=Lc;if(n===18?(n=0,t=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=t,a=i(),u=i(),h=t+u,p=h-o;return{version:n,codec:s,multihashCode:a,digestSize:u,multihashSize:p,size:h}}static parse(e,t){let[i,n]=L4(e,t),s=Vt.decode(n);return s._baseCache.set(i,e),s}},L4=(r,e)=>{switch(r[0]){case"Q":{let t=e||Ni;return[Ni.prefix,t.decode(`${Ni.prefix}${r}`)]}case Ni.prefix:{let t=e||Ni;return[Ni.prefix,t.decode(r)]}case ru.prefix:{let t=e||ru;return[ru.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},F4=(r,e,t)=>{let{prefix:i}=t;if(i!==Ni.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(i);if(n==null){let s=t.encode(r).slice(1);return e.set(i,s),s}else return n},U4=(r,e,t)=>{let{prefix:i}=t,n=e.get(i);if(n==null){let s=t.encode(r);return e.set(i,s),s}else return n},Lc=112,q4=18,ax=(r,e,t)=>{let i=nu(r),n=i+nu(e),s=new Uint8Array(n+t.byteLength);return iu(r,s,0),iu(e,s,i),s.set(t,n),s},ux=Symbol.for("@ipld/js-cid/CID"),zh={writable:!1,configurable:!1,enumerable:!0},kh={writable:!1,enumerable:!1,configurable:!1},V4="0.0.0-dev",H4=(r,e)=>{if(r.test(V4))console.warn(e);else throw new Error(e)},Q4=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=$0;var Y0=class extends Le{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};ge.ErrMissingFieldOnStruct=Y0;var J0=class extends Le{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};ge.ErrMissingFieldOnEnum=J0;var X0=class extends Le{constructor(e){super(`cannot parse contract results: ${e}`)}};ge.ErrCannotParseContractResults=X0;var Z0=class extends Le{constructor(e,t){super(`cannot parse outcome of transaction ${e}: ${t}`)}};ge.ErrCannotParseTransactionOutcome=Z0;var eg=class extends Le{constructor(e){super(e)}};ge.ErrCodec=eg;var tg=class extends Le{constructor(e){super(e)}};ge.ErrContractInteraction=tg;var rg=class extends Le{constructor(){super("Method not yet implemented")}};ge.ErrNotImplemented=rg;var ig=class extends Le{constructor(){super("invalid arguments for relayed v1 builder")}};ge.ErrInvalidRelayedV1BuilderArguments=ig;var ng=class extends Le{constructor(){super("invalid arguments for relayed v2 builder")}};ge.ErrInvalidRelayedV2BuilderArguments=ng;var sg=class extends Le{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ge.ErrGasLimitShouldBe0ForInnerTransaction=sg});var og=B(To=>{"use strict";f();var aP=To&&To.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(To,"__esModule",{value:!0});To.TokenPayment=void 0;var zu=aP(jr()),uP=Ye(),eA="EGLD",tA=18;zu.default.set({ROUNDING_MODE:1});var Ki=class{constructor(e,t,i,n){let s=new zu.default(i);if(!s.isInteger()||s.isNegative())throw new uP.ErrInvalidArgument(`bad amountAsBigInteger: ${i}`);this.tokenIdentifier=e,this.nonce=t,this.amountAsBigInteger=s,this.numDecimals=n}static egldFromAmount(e){let t=new zu.default(e).shiftedBy(tA).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new Ki(eA,0,e,tA)}static fungibleFromAmount(e,t,i){let n=new zu.default(t).shiftedBy(i).decimalPlaces(0);return this.fungibleFromBigInteger(e,n,i)}static fungibleFromBigInteger(e,t,i=0){return new Ki(e,0,t,i)}static nonFungible(e,t){return new Ki(e,t,1,0)}static semiFungible(e,t,i){return new Ki(e,t,i,0)}static metaEsdtFromAmount(e,t,i,n){let s=new zu.default(i).shiftedBy(n).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,n)}static metaEsdtFromBigInteger(e,t,i,n=0){return new Ki(e,t,i,n)}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toRationalNumber()} ${this.tokenIdentifier}`}toRationalNumber(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==eA}isFungible(){return this.nonce==0}};To.TokenPayment=Ki});var kl=B((wz,nA)=>{"use strict";f();var Kl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ag={};for(ku=0;ku>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function rA(r){for(var e=1,t=0;t126)return"Invalid prefix ("+r+")";e=No(e)^i>>5}for(e=No(e),t=0;tt)throw new TypeError("Exceeds length limit");r=r.toLowerCase();var i=rA(r);if(typeof i=="string")throw new Error(i);for(var n=r+"1",s=0;s>5)throw new Error("Non 5-bit word");i=No(i)^o,n+=Kl.charAt(o)}for(s=0;s<6;++s)i=No(i);for(i^=1,s=0;s<6;++s){var a=i>>(5-s)*5&31;n+=Kl.charAt(a)}return n}function iA(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var t=r.toLowerCase(),i=r.toUpperCase();if(r!==t&&r!==i)return"Mixed-case string "+r;r=t;var n=r.lastIndexOf("1");if(n===-1)return"No separator character for "+r;if(n===0)return"Missing prefix for "+r;var s=r.slice(0,n),o=r.slice(n+1);if(o.length<6)return"Data too short";var a=rA(s);if(typeof a=="string")return a;for(var u=[],h=0;h=o.length)&&u.push(w)}return a!==1?"Invalid checksum for "+r:{prefix:s,words:u}}function lP(){var r=iA.apply(null,arguments);if(typeof r=="object")return r}function fP(r){var e=iA.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zl(r,e,t,i){for(var n=0,s=0,o=(1<=t;)s-=t,a.push(n>>s&o);if(i)s>0&&a.push(n<=e)return"Excess padding";if(n<{"use strict";f();var yP=ai&&ai.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),mP=ai&&ai.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sA=ai&&ai.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yP(e,r,t);return mP(e,r),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.Address=void 0;var Wl=sA(kl()),Do=sA(Ye()),ug="erd",cg=32,wP="0".repeat(16),Kt=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof Kt)return Kt.fromAddress(e);if(e instanceof y.Buffer)return Kt.fromBuffer(e);if(typeof e=="string")return Kt.fromString(e);throw new Do.ErrAddressCannotCreate(e)}}static fromAddress(e){return Kt.fromValidHex(e.valueHex)}static fromValidHex(e){let t=new Kt;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=cg)throw new Do.ErrAddressCannotCreate(e);return Kt.fromValidHex(e.toString("hex"))}static fromString(e){return Kt.isValidHex(e)?Kt.fromValidHex(e):Kt.fromBech32(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==cg}static fromHex(e){if(!Kt.isValidHex(e))throw new Do.ErrAddressCannotCreate(e);return Kt.fromValidHex(e)}static fromBech32(e){let t;try{t=Wl.decode(e)}catch(s){throw new Do.ErrAddressCannotCreate(e,s)}let i=t.prefix;if(i!=ug)throw new Do.ErrAddressBadHrp(ug,i);let n=y.Buffer.from(Wl.fromWords(t.words));if(n.length!=cg)throw new Do.ErrAddressCannotCreate(e);return Kt.fromValidHex(n.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Wl.toWords(this.pubkey());return Wl.encode(ug,e)}pubkey(){return this.isEmpty()?y.Buffer.from([]):y.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 Kt("0".repeat(64))}isContractAddress(){return this.hex().startsWith(wP)}};ai.Address=Kt});var Wu=B(tt=>{"use strict";f();Object.defineProperty(tt,"__esModule",{value:!0});tt.ARGUMENTS_SEPARATOR=tt.ESDT_TRANSFER_VALUE=tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_GAS_LIMIT=tt.TRANSACTION_VERSION_TX_HASH_SIGN=tt.TRANSACTION_VERSION_DEFAULT=tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=tt.TRANSACTION_OPTIONS_DEFAULT=tt.TRANSACTION_MIN_GAS_PRICE=void 0;tt.TRANSACTION_MIN_GAS_PRICE=1e9;tt.TRANSACTION_OPTIONS_DEFAULT=0;tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;tt.TRANSACTION_VERSION_DEFAULT=1;tt.TRANSACTION_VERSION_TX_HASH_SIGN=2;tt.ESDT_TRANSFER_GAS_LIMIT=5e5;tt.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";tt.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";tt.ESDT_TRANSFER_VALUE="0";tt.ARGUMENTS_SEPARATOR="@"});var Tr=B(rt=>{"use strict";f();var vP=rt&&rt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),EP=rt&&rt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AP=rt&&rt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&vP(e,r,t);return EP(e,r),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.isEmpty=rt.guardEmpty=rt.guardNotEmpty=rt.guardLength=rt.guardSameLength=rt.guardValueIsSetWithMessage=rt.guardValueIsSet=rt.guardTrue=void 0;var Oo=AP(Ye());function IP(r,e){if(!r)throw new Oo.ErrInvariantFailed(`[<${e}>] isn't true`)}rt.guardTrue=IP;function _P(r,e){oA(`${r} isn't set (null or undefined)`,e)}rt.guardValueIsSet=_P;function oA(r,e){if(e==null||e===void 0)throw new Oo.ErrInvariantFailed(r)}rt.guardValueIsSetWithMessage=oA;function bP(r,e){if(r=r||[],e=e||[],r.length!=e.length)throw new Oo.ErrInvariantFailed("arrays do not have the same length")}rt.guardSameLength=bP;function CP(r,e){let t=r.length||0;if(t!=e)throw new Oo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${t}`)}rt.guardLength=CP;function SP(r,e){if(lg(r))throw new Oo.ErrInvariantFailed(`${e} is empty`)}rt.guardNotEmpty=SP;function xP(r,e){if(!lg(r))throw new Oo.ErrInvariantFailed(`${e} is not empty`)}rt.guardEmpty=xP;function lg(r){return r.isEmpty?r.isEmpty():r.length===0}rt.isEmpty=lg});var aA=B($l=>{"use strict";f();Object.defineProperty($l,"__esModule",{value:!0});$l.getJavascriptPrototypesInHierarchy=void 0;function TP(r,e){let t=[],i=Object.getPrototypeOf(r);for(;i&&e(i);)t.push(i),i=Object.getPrototypeOf(i);return t}$l.getJavascriptPrototypesInHierarchy=TP});var Ft=B(Lt=>{"use strict";f();Object.defineProperty(Lt,"__esModule",{value:!0});Lt.NullType=Lt.TypePlaceholder=Lt.isTyped=Lt.PrimitiveValue=Lt.TypedValue=Lt.CustomType=Lt.PrimitiveType=Lt.TypeCardinality=Lt.Type=void 0;var fg=aA(),uA=Tr(),Ir=class{constructor(e,t=[],i=zi.fixed(1)){uA.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=i}getName(){return this.name}getClassName(){return Ir.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(t=>t.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 uA.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(i=>i.toString()).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return Ir.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every((i,n)=>i.equals(t[n]))}static isAssignableFromMany(e,t){return e.every((i,n)=>i.isAssignableFrom(t[n]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!Ir.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let i=this.getFullyQualifiedName();return Ir.getFullyQualifiedNamesInHierarchy(e).includes(i)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return fg.getJavascriptPrototypesInHierarchy(e,n=>n.belongsToTypesystem).map(n=>n.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Lt.Type=Ir;Ir.ClassName="Type";var zi=class{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new zi(e,e)}static variable(e){return new zi(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||zi.MaxCardinality}};Lt.TypeCardinality=zi;zi.MaxCardinality=4096;var Po=class extends Ir{constructor(e){super(e)}getClassName(){return Po.ClassName}};Lt.PrimitiveType=Po;Po.ClassName="PrimitiveType";var Bo=class extends Ir{getClassName(){return Bo.ClassName}};Lt.CustomType=Bo;Bo.ClassName="CustomType";var hs=class{constructor(e){this.type=e}getClassName(){return hs.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Lt.TypedValue=hs;hs.ClassName="TypedValue";var Mo=class extends hs{constructor(e){super(e)}getClassName(){return Mo.ClassName}};Lt.PrimitiveValue=Mo;Mo.ClassName="PrimitiveValue";function NP(r){return r.belongsToTypesystem!==void 0}Lt.isTyped=NP;var Ro=class extends Ir{constructor(){super("...")}getClassName(){return Ro.ClassName}};Lt.TypePlaceholder=Ro;Ro.ClassName="TypePlaceholder";var Lo=class extends Ir{constructor(){super("?")}getClassName(){return Lo.ClassName}};Lt.NullType=Lo;Lo.ClassName="NullType"});var cA=B((Fo,Uo)=>{f();(function(r){var e=typeof Fo=="object"&&Fo&&!Fo.nodeType&&Fo,t=typeof Uo=="object"&&Uo&&!Uo.nodeType&&Uo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var n,s=2147483647,o=36,a=1,u=26,h=38,p=700,w=72,N=128,O="-",T=/^xn--/,V=/[^\x20-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,$={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},se=o-a,Y=Math.floor,j=String.fromCharCode,W;function k(v){throw new RangeError($[v])}function R(v,S){for(var D=v.length,I=[];D--;)I[D]=S(v[D]);return I}function F(v,S){var D=v.split("@"),I="";D.length>1&&(I=D[0]+"@",v=D[1]),v=v.replace(z,".");var l=v.split("."),C=R(l,S).join(".");return I+C}function G(v){for(var S=[],D=0,I=v.length,l,C;D=55296&&l<=56319&&D65535&&(S-=65536,D+=j(S>>>10&1023|55296),S=56320|S&1023),D+=j(S),D}).join("")}function J(v){return v-48<10?v-22:v-65<26?v-65:v-97<26?v-97:o}function X(v,S){return v+22+75*(v<26)-((S!=0)<<5)}function A(v,S,D){var I=0;for(v=D?Y(v/p):v>>1,v+=Y(v/S);v>se*u>>1;I+=o)v=Y(v/se);return Y(I+(se+1)*v/(v+h))}function c(v){var S=[],D=v.length,I,l=0,C=N,Z=w,ie,ee,ae,E,b,x,L,P,U;for(ie=v.lastIndexOf(O),ie<0&&(ie=0),ee=0;ee=128&&k("not-basic"),S.push(v.charCodeAt(ee));for(ae=ie>0?ie+1:0;ae=D&&k("invalid-input"),L=J(v.charCodeAt(ae++)),(L>=o||L>Y((s-l)/b))&&k("overflow"),l+=L*b,P=x<=Z?a:x>=Z+u?u:x-Z,!(LY(s/U)&&k("overflow"),b*=U;I=S.length+1,Z=A(l-E,I,E==0),Y(l/I)>s-C&&k("overflow"),C+=Y(l/I),l%=I,S.splice(l++,0,C)}return ce(S)}function d(v){var S,D,I,l,C,Z,ie,ee,ae,E,b,x=[],L,P,U,q;for(v=G(v),L=v.length,S=N,D=0,C=w,Z=0;Z=S&&bY((s-D)/P)&&k("overflow"),D+=(ie-S)*P,S=ie,Z=0;Zs&&k("overflow"),b==S){for(ee=D,ae=o;E=ae<=C?a:ae>=C+u?u:ae-C,!(ee{"use strict";f();var fA=cA();function DP(r,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=r}function hg(r){return r>="0"&&r<="7"}function OP(r){return r>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F"}function lA(r){return r=parseInt(r,16),fA.ucs2.encode([r])}function hA(r,e,t){var i=!1,n=[];function s(u){var h=r[u];if(!OP(h))throw new DP(u,"Unexpected token ILLEGAL");return h}for(;e{f();var yA=dA();vA.exports={validate:PP,parse:BP};function PP(r,e){var t;if(e=e||!1,typeof r!="string")t="Input must be a string";else try{Yl(r,0,e,!1)}catch(i){t=i.message}return t}function BP(r,e){if(typeof r!="string")throw new Error("Input must be a string");e=e||!1;var t=Yl(r,0,e,!0);return t.value}function mA(r,e){for(var t=r.length,i=e,n,s=e;s-1&&r[t]==="\\";)i++,t--;return i%2===0}function FP(r,e,t,i){for(var n=e,s=",",o=[],a=e;ds(r[a]);)a++;if(r[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Yl(r,n,t,i),h=mA(r,u.end);i&&o.push(u.value),n=h.end,s=h.value}return{start:e,end:n,value:o}}function UP(r,e){return r.substr(e,4)==="true"}function qP(r,e){return r.substr(e,5)==="false"}function VP(r,e){return r.substr(e,4)==="null"}var HP=new RegExp(/^\s$/);function ds(r){return HP.test(r)}var QP=new RegExp(/^\d$/);function pA(r){return QP.test(r)}function ki(r,e,t){var i=10,n;r.length{"use strict";f();var jP=ui&&ui.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),GP=ui&&ui.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),KP=ui&&ui.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&jP(e,r,t);return GP(e,r),e};Object.defineProperty(ui,"__esModule",{value:!0});ui.TypeExpressionParser=void 0;var AA=KP(Ye()),zP=Ft(),kP=EA(),pg=class{parse(e){let t=this.doParse(e),i=Object.keys(t);if(i.length!=1)throw new AA.ErrTypingSystem(`bad type expression: ${e}`);let n=i[0];return this.nodeToType(n,t[n])}doParse(e){let t=this.getJsonedString(e);try{return kP.parse(t)}catch{throw new AA.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${t}.`)}}getJsonedString(e){let t="";for(var i=0;i"?a!=">"?t+=": {} }":t+="}":o==","?u==">"||(a==">"?t+=",":t+=": {},"):t+=o}let n=/(:|\{|\}|,|\s)/,s=t.replace(/utf\-8\sstring/ig,"utf-8-string").split(n).filter(o=>o);return t=s.map(o=>n.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${t}: {}}`:`{${t}}`}nodeToType(e,t){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let i=Object.keys(t).map(n=>this.nodeToType(n,t[n]));return new zP.Type(e,i)}};ui.TypeExpressionParser=pg});var Zl=B(dn=>{"use strict";f();Object.defineProperty(dn,"__esModule",{value:!0});dn.EndpointParameterDefinition=dn.EndpointModifiers=dn.EndpointDefinition=void 0;var WP=Jl(),IA="?",$P="N / A",$u=class{constructor(e,t,i,n){this.input=[],this.output=[],this.name=e,this.input=t||[],this.output=i||[],this.modifiers=n}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?IA:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let t=e.inputs.map(s=>ps.fromJSON(s)),i=e.outputs.map(s=>ps.fromJSON(s)),n=new Xl(e.mutability,e.payableInTokens);return new $u(e.name,t,i,n)}};dn.EndpointDefinition=$u;var Xl=class{constructor(e,t){this.mutability=e||"",this.payableInTokens=t||[]}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"}};dn.EndpointModifiers=Xl;var ps=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new WP.TypeExpressionParser().parse(e.type);return new ps(e.name||IA,e.description||$P,t)}};dn.EndpointParameterDefinition=ps});var gg=B(ef=>{"use strict";f();Object.defineProperty(ef,"__esModule",{value:!0});ef.ContractInterface=void 0;var YP=Tr(),_A=Zl(),JP="?",Yu=class{constructor(e,t,i){this.endpoints=[],this.name=e,this.constructorDefinition=t,this.endpoints=i}static fromJSON(e){e.name=e.name||JP,e.endpoints=e.endpoints||[];let t=XP(e),i=e.endpoints.map(n=>_A.EndpointDefinition.fromJSON(n));return new Yu(e.name,t,i)}getConstructorDefinition(){return this.constructorDefinition}getEndpoint(e){let t=this.endpoints.find(i=>i.name==e);return YP.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}};ef.ContractInterface=Yu;function XP(r){if(r.constructor.inputs===void 0||r.constructor.outputs===void 0)return null;let e=Object.assign({name:"constructor"},r.constructor);return _A.EndpointDefinition.fromJSON(e)}});var qo=B(gr=>{"use strict";f();var ZP=gr&&gr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eB=gr&&gr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tB=gr&&gr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ZP(e,r,t);return eB(e,r),e};Object.defineProperty(gr,"__esModule",{value:!0});gr.Fields=gr.Field=gr.FieldDefinition=void 0;var yg=tB(Ye()),rB=Jl(),Ju=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new rB.TypeExpressionParser().parse(e.type);return new Ju(e.name,e.description,t)}};gr.FieldDefinition=Ju;var mg=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){let t=this.value.getType();if(!t.equals(e.type))throw new yg.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new yg.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};gr.Field=mg;var wg=class{static checkTyping(e,t){if(e.length!=t.length)throw new yg.ErrTypingSystem("fields length vs. field definitions length");for(let i=0;i{"use strict";f();Object.defineProperty(gn,"__esModule",{value:!0});gn.EnumValue=gn.EnumVariantDefinition=gn.EnumType=void 0;var iB=Ye(),vg=Tr(),tf=qo(),CA=Ft(),bA=256,gs=class extends CA.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return gs.ClassName}static fromJSON(e){let t=(e.variants||[]).map(i=>Vo.fromJSON(i));return new gs(e.name,t)}getVariantByDiscriminant(e){let t=this.variants.find(i=>i.discriminant==e);return vg.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find(i=>i.name==e);return vg.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){let e=[];for(let t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}};gn.EnumType=gs;gs.ClassName="EnumType";var Vo=class{constructor(e,t,i=[]){this.fieldsDefinitions=[],vg.guardTrue(ttf.FieldDefinition.fromJSON(i));return new Vo(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return tf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};gn.EnumVariantDefinition=Vo;var pn=class extends CA.TypedValue{constructor(e,t,i){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=i,this.fieldsByName=new Map(i.map(s=>[s.name,s]));let n=t.getFieldsDefinitions();tf.Fields.checkTyping(this.fields,n)}getClassName(){return pn.ClassName}static fromName(e,t){let i=e.getVariantByName(t);return new pn(e,i,[])}static fromDiscriminant(e,t){let i=e.getVariantByDiscriminant(t);return new pn(e,i,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields(),n=this.name==e.name,s=this.discriminant==e.discriminant,o=tf.Fields.equals(t,i);return n&&s&&o}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new iB.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(t=>e.fields[t.name]=t.value.valueOf()),e}};gn.EnumValue=pn;pn.ClassName="EnumValue"});var ms=B(Qo=>{"use strict";f();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.Struct=Qo.StructType=void 0;var nB=Ye(),rf=qo(),SA=Ft(),ys=class extends SA.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return ys.ClassName}static fromJSON(e){let t=(e.fields||[]).map(i=>rf.FieldDefinition.fromJSON(i));return new ys(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return rf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Qo.StructType=ys;ys.ClassName="StructType";var Ho=class extends SA.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map(i=>[i.name,i])),this.checkTyping()}getClassName(){return Ho.ClassName}checkTyping(){let t=this.getType().getFieldsDefinitions();rf.Fields.checkTyping(this.fields,t)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new nB.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields();return rf.Fields.equals(t,i)}};Qo.Struct=Ho;Ho.ClassName="Struct"});var Ko=B(Go=>{"use strict";f();Object.defineProperty(Go,"__esModule",{value:!0});Go.AddressValue=Go.AddressType=void 0;var sB=Gr(),xA=Ft(),ws=class extends xA.PrimitiveType{constructor(){super("Address")}getClassName(){return ws.ClassName}};Go.AddressType=ws;ws.ClassName="AddressType";var jo=class extends xA.PrimitiveValue{constructor(e){super(new ws),this.value=new sB.Address(e.bech32())}getClassName(){return jo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Go.AddressValue=jo;jo.ClassName="AddressValue"});var nf=B(zo=>{"use strict";f();Object.defineProperty(zo,"__esModule",{value:!0});zo.OptionalValue=zo.OptionalType=void 0;var oB=Tr(),Zu=Ft(),yn=class extends Zu.Type{constructor(e){super("Optional",[e],Zu.TypeCardinality.variable(1))}getClassName(){return yn.ClassName}isAssignableFrom(e){if(!e.hasExactClass(yn.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(Zu.NullType.ClassName);return t||i}};zo.OptionalType=yn;yn.ClassName="OptionalType";var vs=class extends Zu.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return vs.ClassName}static newMissing(){let e=new yn(new Zu.NullType);return new vs(e)}isSet(){return!!this.value}getTypedValue(){return oB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};zo.OptionalValue=vs;vs.ClassName="OptionalValue"});var ec=B(Wo=>{"use strict";f();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.BooleanValue=Wo.BooleanType=void 0;var TA=Ft(),Es=class extends TA.PrimitiveType{constructor(){super("bool")}getClassName(){return Es.ClassName}};Wo.BooleanType=Es;Es.ClassName="BooleanType";var ko=class extends TA.PrimitiveValue{constructor(e){super(new Es),this.value=e}getClassName(){return ko.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Wo.BooleanValue=ko;ko.ClassName="BooleanValue"});var wn=B($o=>{"use strict";f();Object.defineProperty($o,"__esModule",{value:!0});$o.BytesValue=$o.BytesType=void 0;var NA=Ft(),As=class extends NA.PrimitiveType{constructor(){super("bytes")}getClassName(){return As.ClassName}};$o.BytesType=As;As.ClassName="BytesType";var mn=class extends NA.PrimitiveValue{constructor(e){super(new As),this.value=e}getClassName(){return mn.ClassName}static fromUTF8(e){let t=y.Buffer.from(e,"utf-8");return new mn(t)}static fromHex(e){let t=y.Buffer.from(e,"hex");return new mn(t)}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()}};$o.BytesValue=mn;mn.ClassName="BytesValue"});var OA=B(Yo=>{"use strict";f();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.CodeMetadataValue=Yo.CodeMetadataType=void 0;var DA=Ft(),sf=class extends DA.PrimitiveType{constructor(){super("CodeMetadata")}};Yo.CodeMetadataType=sf;var Eg=class extends DA.PrimitiveValue{constructor(e){super(new sf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Yo.CodeMetadataValue=Eg});var of=B(Jo=>{"use strict";f();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.CompositeValue=Jo.CompositeType=void 0;var aB=Tr(),Ag=Ft(),Is=class extends Ag.Type{constructor(...e){super("Composite",e,Ag.TypeCardinality.variable(e.length))}getClassName(){return Is.ClassName}};Jo.CompositeType=Is;Is.ClassName="CompositeType";var _s=class extends Ag.TypedValue{constructor(e,t){super(e),aB.guardLength(t,e.getTypeParameters().length),this.items=t}getClassName(){return _s.ClassName}static fromItems(...e){let t=e.map(n=>n.getType()),i=new Is(...t);return new _s(i,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 t=0;t{"use strict";f();Object.defineProperty(af,"__esModule",{value:!0});af.CollectionOfTypedValues=void 0;var Ig=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 t=0;t{"use strict";f();Object.defineProperty(ci,"__esModule",{value:!0});ci.List=ci.OptionValue=ci.ListType=ci.OptionType=void 0;var uB=Tr(),cB=_g(),bs=Ft(),li=class extends bs.Type{constructor(e){super("Option",[e])}getClassName(){return li.ClassName}isAssignableFrom(e){if(!e.hasExactClass(li.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(bs.NullType.ClassName);return t||i}};ci.OptionType=li;li.ClassName="OptionType";var Cs=class extends bs.Type{constructor(e){super("List",[e])}getClassName(){return Cs.ClassName}};ci.ListType=Cs;Cs.ClassName="ListType";var Wi=class extends bs.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return Wi.ClassName}static newMissing(){let e=new li(new bs.NullType);return new Wi(e)}static newMissingTyped(e){return new Wi(new li(e))}static newProvided(e){let t=new li(e.getType());return new Wi(t,e)}isSet(){return!!this.value}getTypedValue(){return uB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ci.OptionValue=Wi;Wi.ClassName="OptionValue";var vn=class extends bs.TypedValue{constructor(e,t){super(e),this.backingCollection=new cB.CollectionOfTypedValues(t)}getClassName(){return vn.ClassName}static fromItems(e){if(e.length==0)return new vn(new bs.TypePlaceholder,[]);let t=e[0].getType(),i=new Cs(t);return new vn(i,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ci.List=vn;vn.ClassName="List"});var uf=B(ea=>{"use strict";f();Object.defineProperty(ea,"__esModule",{value:!0});ea.ArrayVec=ea.ArrayVecType=void 0;var PA=Tr(),lB=_g(),BA=Ft(),Xo=class extends BA.Type{constructor(e,t){super("Array",[t]),PA.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return Xo.ClassName}};ea.ArrayVecType=Xo;Xo.ClassName="ArrayVecType";var Zo=class extends BA.TypedValue{constructor(e,t){super(e),PA.guardLength(t,e.length),this.backingCollection=new lB.CollectionOfTypedValues(t)}getClassName(){return Zo.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ea.ArrayVec=Zo;Zo.ClassName="ArrayVec"});var rc=B(ra=>{"use strict";f();Object.defineProperty(ra,"__esModule",{value:!0});ra.H256Value=ra.H256Type=void 0;var MA=Ft(),Ss=class extends MA.PrimitiveType{constructor(){super("H256")}getClassName(){return Ss.ClassName}};ra.H256Type=Ss;Ss.ClassName="H256Type";var ta=class extends MA.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return ta.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ra.H256Value=ta;ta.ClassName="H256Value"});var cf=B(na=>{"use strict";f();Object.defineProperty(na,"__esModule",{value:!0});na.NothingValue=na.NothingType=void 0;var RA=Ft(),xs=class extends RA.PrimitiveType{constructor(){super("nothing")}getClassName(){return xs.ClassName}};na.NothingType=xs;xs.ClassName="NothingType";var ia=class extends RA.PrimitiveValue{constructor(){super(new xs)}getClassName(){return ia.ClassName}equals(e){return!1}valueOf(){return{}}};na.NothingValue=ia;ia.ClassName="NothingValue"});var ic=B(Ae=>{"use strict";f();var fB=Ae&&Ae.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),hB=Ae&&Ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),dB=Ae&&Ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&fB(e,r,t);return hB(e,r),e},pB=Ae&&Ae.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var LA=dB(Ye()),FA=Ft(),Us=pB(jr()),ir=class extends FA.PrimitiveType{constructor(e,t,i){super(e),this.sizeInBytes=t,this.withSign=i}getClassName(){return ir.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=ir;ir.ClassName="NumericalType";var Ts=class extends ir{constructor(){super("u8",1,!1)}getClassName(){return Ts.ClassName}};Ae.U8Type=Ts;Ts.ClassName="U8Type";var Ns=class extends ir{constructor(){super("i8",1,!0)}getClassName(){return Ns.ClassName}};Ae.I8Type=Ns;Ns.ClassName="I8Type";var Ds=class extends ir{constructor(){super("u16",2,!1)}getClassName(){return Ds.ClassName}};Ae.U16Type=Ds;Ds.ClassName="U16Type";var Os=class extends ir{constructor(){super("i16",2,!0)}getClassName(){return Os.ClassName}};Ae.I16Type=Os;Os.ClassName="I16Type";var Ps=class extends ir{constructor(){super("u32",4,!1)}getClassName(){return Ps.ClassName}};Ae.U32Type=Ps;Ps.ClassName="U32Type";var Bs=class extends ir{constructor(){super("i32",4,!0)}getClassName(){return Bs.ClassName}};Ae.I32Type=Bs;Bs.ClassName="I32Type";var Ms=class extends ir{constructor(){super("u64",8,!1)}getClassName(){return Ms.ClassName}};Ae.U64Type=Ms;Ms.ClassName="U64Type";var Rs=class extends ir{constructor(){super("i64",8,!0)}getClassName(){return Rs.ClassName}};Ae.I64Type=Rs;Rs.ClassName="I64Type";var Ls=class extends ir{constructor(){super("BigUint",0,!1)}getClassName(){return Ls.ClassName}};Ae.BigUIntType=Ls;Ls.ClassName="BigUIntType";var Fs=class extends ir{constructor(){super("Bigint",0,!0)}getClassName(){return Fs.ClassName}};Ae.BigIntType=Fs;Fs.ClassName="BigIntType";var nr=class extends FA.PrimitiveValue{constructor(e,t){if(super(e),this.value=new Us.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new LA.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new LA.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return nr.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=nr;nr.ClassName="NumericalValue";var sa=class extends nr{constructor(e){super(new Ts,new Us.default(e))}getClassName(){return sa.ClassName}};Ae.U8Value=sa;sa.ClassName="U8Value";var oa=class extends nr{constructor(e){super(new Ns,new Us.default(e))}getClassName(){return oa.ClassName}};Ae.I8Value=oa;oa.ClassName="I8Value";var aa=class extends nr{constructor(e){super(new Ds,new Us.default(e))}getClassName(){return aa.ClassName}};Ae.U16Value=aa;aa.ClassName="U16Value";var ua=class extends nr{constructor(e){super(new Os,new Us.default(e))}getClassName(){return ua.ClassName}};Ae.I16Value=ua;ua.ClassName="I16Value";var ca=class extends nr{constructor(e){super(new Ps,new Us.default(e))}getClassName(){return ca.ClassName}};Ae.U32Value=ca;ca.ClassName="U32Value";var la=class extends nr{constructor(e){super(new Bs,new Us.default(e))}getClassName(){return la.ClassName}};Ae.I32Value=la;la.ClassName="I32Value";var fa=class extends nr{constructor(e){super(new Ms,e)}getClassName(){return fa.ClassName}};Ae.U64Value=fa;fa.ClassName="U64Value";var ha=class extends nr{constructor(e){super(new Rs,e)}getClassName(){return ha.ClassName}};Ae.I64Value=ha;ha.ClassName="I64Value";var da=class extends nr{constructor(e){super(new Ls,e)}getClassName(){return da.ClassName}};Ae.BigUIntValue=da;da.ClassName="BigUIntValue";var pa=class extends nr{constructor(e){super(new Fs,e)}getClassName(){return pa.ClassName}};Ae.BigIntValue=pa;pa.ClassName="BigIntValue"});var lf=B(ga=>{"use strict";f();Object.defineProperty(ga,"__esModule",{value:!0});ga.StringValue=ga.StringType=void 0;var UA=Ft(),qs=class extends UA.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return qs.ClassName}};ga.StringType=qs;qs.ClassName="StringType";var En=class extends UA.PrimitiveValue{constructor(e){super(new qs),this.value=e}getClassName(){return En.ClassName}static fromUTF8(e){return new En(e)}static fromHex(e){let t=y.Buffer.from(e,"hex").toString();return new En(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};ga.StringValue=En;En.ClassName="StringValue"});var ma=B(ya=>{"use strict";f();Object.defineProperty(ya,"__esModule",{value:!0});ya.TokenIdentifierValue=ya.TokenIdentifierType=void 0;var qA=Ft(),gB="EGLD",Vs=class extends qA.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Vs.ClassName}};ya.TokenIdentifierType=Vs;Vs.ClassName="TokenIdentifierType";var An=class extends qA.PrimitiveValue{constructor(e){super(new Vs),this.value=e}static egld(){return new An(gB)}static esdtTokenIdentifier(e){return new An(e)}getClassName(){return An.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()}};ya.TokenIdentifierValue=An;An.ClassName="TokenIdentifierValue"});var ff=B(Nr=>{"use strict";f();var yB=Nr&&Nr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),mB=Nr&&Nr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),wB=Nr&&Nr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yB(e,r,t);return mB(e,r),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.Tuple=Nr.TupleType=void 0;var vB=wB(Ye()),EB=ms(),VA=qo(),AB=ms(),$i=class extends AB.StructType{constructor(...e){super($i.prepareName(e),$i.prepareFieldDefinitions(e))}getClassName(){return $i.ClassName}static prepareName(e){let t=e.map(n=>n.toString()).join(", ");return`tuple${t.length}<${t}>`}static prepareFieldDefinitions(e){return e.map((i,n)=>new VA.FieldDefinition(HA(n),"anonymous tuple field",i))}};Nr.TupleType=$i;$i.ClassName="TupleType";function HA(r){return`field${r}`}var Hs=class extends EB.Struct{constructor(e,t){super(e,t)}getClassName(){return Hs.ClassName}static fromItems(e){if(e.length<1)throw new vB.ErrTypingSystem("bad tuple items");let t=e.map(s=>s.getType()),i=new $i(...t),n=e.map((s,o)=>new VA.Field(s,HA(o)));return new Hs(i,n)}};Nr.Tuple=Hs;Hs.ClassName="Tuple"});var df=B(wa=>{"use strict";f();Object.defineProperty(wa,"__esModule",{value:!0});wa.VariadicValue=wa.VariadicType=void 0;var hf=Ft(),_n=class extends hf.Type{constructor(e){super("Variadic",[e],hf.TypeCardinality.variable())}getClassName(){return _n.ClassName}};wa.VariadicType=_n;_n.ClassName="VariadicType";var In=class extends hf.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return In.ClassName}static fromItems(...e){if(e.length==0)return new In(new _n(new hf.TypePlaceholder),[]);let t=e[0].getType();return new In(new _n(t),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 t=0;t{"use strict";f();var IB=fi&&fi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),_B=fi&&fi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bB=fi&&fi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&IB(e,r,t);return _B(e,r),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.TypeMapper=void 0;var QA=bB(Ye()),CB=Ko(),bg=nf(),SB=ec(),xB=wn(),TB=OA(),pf=of(),Cg=Xu(),NB=qo(),jA=tc(),gf=uf(),DB=rc(),GA=cf(),Dr=ic(),OB=lf(),KA=ms(),zA=ma(),bn=ff(),Sg=df(),xg=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...t)=>new jA.OptionType(t[0])],["List",(...t)=>new jA.ListType(t[0])],["VarArgs",(...t)=>new Sg.VariadicType(t[0])],["MultiResultVec",(...t)=>new Sg.VariadicType(t[0])],["variadic",(...t)=>new Sg.VariadicType(t[0])],["OptionalArg",(...t)=>new bg.OptionalType(t[0])],["optional",(...t)=>new bg.OptionalType(t[0])],["OptionalResult",(...t)=>new bg.OptionalType(t[0])],["multi",(...t)=>new pf.CompositeType(...t)],["MultiArg",(...t)=>new pf.CompositeType(...t)],["MultiResult",(...t)=>new pf.CompositeType(...t)],["multi",(...t)=>new pf.CompositeType(...t)],["tuple",(...t)=>new bn.TupleType(...t)],["tuple2",(...t)=>new bn.TupleType(...t)],["tuple3",(...t)=>new bn.TupleType(...t)],["tuple4",(...t)=>new bn.TupleType(...t)],["tuple5",(...t)=>new bn.TupleType(...t)],["tuple6",(...t)=>new bn.TupleType(...t)],["tuple7",(...t)=>new bn.TupleType(...t)],["tuple8",(...t)=>new bn.TupleType(...t)],["array20",(...t)=>new gf.ArrayVecType(20,t[0])],["array32",(...t)=>new gf.ArrayVecType(32,t[0])],["array46",(...t)=>new gf.ArrayVecType(46,t[0])],["array64",(...t)=>new gf.ArrayVecType(64,t[0])]]),this.closedTypesMap=new Map([["u8",new Dr.U8Type],["u16",new Dr.U16Type],["u32",new Dr.U32Type],["u64",new Dr.U64Type],["U64",new Dr.U64Type],["BigUint",new Dr.BigUIntType],["i8",new Dr.I8Type],["i16",new Dr.I16Type],["i32",new Dr.I32Type],["i64",new Dr.I64Type],["Bigint",new Dr.BigIntType],["BigInt",new Dr.BigIntType],["bool",new SB.BooleanType],["bytes",new xB.BytesType],["Address",new CB.AddressType],["H256",new DB.H256Type],["utf-8 string",new OB.StringType],["TokenIdentifier",new zA.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new zA.TokenIdentifierType],["CodeMetadata",new TB.CodeMetadataType],["nothing",new GA.NothingType],["AsyncCall",new GA.NothingType]]),this.learnedTypesMap=new Map;for(let t of e)this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapTypeRecursively(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new QA.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let t=e.isGenericType(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let n=this.closedTypesMap.get(e.getName());return n||(e.hasExactClass(Cg.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(KA.StructType.ClassName)?this.mapStructType(e):t?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new KA.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map(n=>new Cg.EnumVariantDefinition(n.name,n.discriminant,this.mappedFields(n.getFieldsDefinitions())));return new Cg.EnumType(e.getName(),t)}mappedFields(e){return e.map(t=>new NB.FieldDefinition(t.name,t.description,this.mapType(t.type)))}mapGenericType(e){let i=e.getTypeParameters().map(s=>this.mapType(s)),n=this.openTypesFactories.get(e.getName());if(!n)throw new QA.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return n(...i)}};fi.TypeMapper=xg});var XA=B(hi=>{"use strict";f();var PB=hi&&hi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),BB=hi&&hi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),MB=hi&&hi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&PB(e,r,t);return BB(e,r),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.AbiRegistry=void 0;var kA=MB(Ye()),Ng=Tr(),WA=gg(),Dg=Zl(),$A=Xu(),YA=ms(),RB=Tg(),va=class{constructor(){this.interfaces=[],this.customTypes=[]}static create(e){return new va().extend(e).remapToKnownTypes()}extend(e){e.types=e.types||{};let t=WA.ContractInterface.fromJSON(e);this.interfaces.push(t);for(let i in e.types){let n=e.types[i],s=n.type;n.name=i;let o=this.createCustomType(s,n);this.customTypes.push(o)}return this}createCustomType(e,t){if(e=="struct")return YA.StructType.fromJSON(t);if(e=="enum")return $A.EnumType.fromJSON(t);throw new kA.ErrTypingSystem(`Unknown type discriminant: ${e}`)}getInterface(e){let t=this.interfaces.find(i=>i.name==e);return Ng.guardValueIsSetWithMessage(`interface [${e}] not found`,t),t}getInterfaces(e){return e.map(t=>this.getInterface(t))}getStruct(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(YA.StructType.ClassName));return Ng.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map(t=>this.getStruct(t))}getEnum(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass($A.EnumType.ClassName));return Ng.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map(t=>this.getEnum(t))}remapToKnownTypes(){let e=new RB.TypeMapper([]),t=[],i=[];for(let s of this.customTypes)this.mapCustomTypeDepthFirst(s,this.customTypes,e,t);if(this.customTypes.length!=t.length)throw new kA.ErrTypingSystem("Did not re-map all custom types");for(let s of this.interfaces){let o=[];for(let u of s.endpoints)o.push(JA(u,e));let a=s.constructorDefinition?JA(s.constructorDefinition,e):null;i.push(new WA.ContractInterface(s.name,a,o))}let n=new va;return n.customTypes.push(...t),n.interfaces.push(...i),n}mapCustomTypeDepthFirst(e,t,i,n){if(n.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=t.find(h=>h.getName()==a);u&&this.mapCustomTypeDepthFirst(u,t,i,n)}let o=i.mapType(e);n.push(o)}};hi.AbiRegistry=va;function JA(r,e){let t=r.input.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type))),i=r.output.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type)));return new Dg.EndpointDefinition(r.name,t,i,r.modifiers)}});var eI=B(Ea=>{"use strict";f();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.createListOfTokenIdentifiers=Ea.createListOfAddresses=void 0;var LB=Ko(),ZA=tc(),FB=ma();function UB(r){let e=r.map(i=>new LB.AddressValue(i));return ZA.List.fromItems(e)}Ea.createListOfAddresses=UB;function qB(r){let e=r.map(i=>new FB.TokenIdentifierValue(i));return ZA.List.fromItems(e)}Ea.createListOfTokenIdentifiers=qB});var pI=B(sr=>{"use strict";f();var VB=sr&&sr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),HB=sr&&sr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),QB=sr&&sr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&VB(e,r,t);return HB(e,r),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.onPrimitiveTypeSelect=sr.onPrimitiveValueSelect=sr.onTypedValueSelect=sr.onTypeSelect=void 0;var mf=QB(Ye()),tI=Ko(),rI=ec(),iI=wn(),nI=Xu(),yf=tc(),sI=rc(),oI=ic(),aI=cf(),uI=ms(),cI=ma(),lI=ff(),fI=Ft(),hI=uf(),dI=lf();function jB(r,e){if(r.hasExactClass(yf.OptionType.ClassName))return e.onOption();if(r.hasExactClass(yf.ListType.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVecType.ClassName))return e.onArray();if(r.hasClassOrSuperclass(fI.PrimitiveType.ClassName))return e.onPrimitive();if(r.hasExactClass(uI.StructType.ClassName))return e.onStruct();if(r.hasExactClass(lI.TupleType.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't known: ${r}`)}sr.onTypeSelect=jB;function GB(r,e){if(r.hasClassOrSuperclass(fI.PrimitiveValue.ClassName))return e.onPrimitive();if(r.hasExactClass(yf.OptionValue.ClassName))return e.onOption();if(r.hasExactClass(yf.List.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVec.ClassName))return e.onArray();if(r.hasExactClass(uI.Struct.ClassName))return e.onStruct();if(r.hasExactClass(lI.Tuple.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't typed: ${r}`)}sr.onTypedValueSelect=GB;function KB(r,e){if(r.hasExactClass(rI.BooleanValue.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalValue.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressValue.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesValue.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringValue.ClassName))return e.onString();if(r.hasExactClass(sI.H256Value.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(r.hasExactClass(aI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't a primitive: ${r.getType()}`)}sr.onPrimitiveValueSelect=KB;function zB(r,e){if(r.hasExactClass(rI.BooleanType.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalType.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressType.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesType.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringType.ClassName))return e.onString();if(r.hasExactClass(sI.H256Type.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(r.hasExactClass(aI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't a known primitive: ${r}`)}sr.onPrimitiveTypeSelect=zB});var or=B(Ve=>{"use strict";f();var kB=Ve&&Ve.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),Je=Ve&&Ve.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&kB(e,r,t)};Object.defineProperty(Ve,"__esModule",{value:!0});Je(XA(),Ve);Je(Ko(),Ve);Je(nf(),Ve);Je(ec(),Ve);Je(wn(),Ve);Je(of(),Ve);Je(gg(),Ve);Je(Zl(),Ve);Je(Xu(),Ve);Je(eI(),Ve);Je(qo(),Ve);Je(tc(),Ve);Je(uf(),Ve);Je(rc(),Ve);Je(pI(),Ve);Je(cf(),Ve);Je(ic(),Ve);Je(lf(),Ve);Je(ms(),Ve);Je(ff(),Ve);Je(ma(),Ve);Je(Jl(),Ve);Je(Tg(),Ve);Je(Ft(),Ve);Je(df(),Ve)});var yI=B(di=>{"use strict";f();var WB=di&&di.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),$B=di&&di.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),YB=di&&di.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&WB(e,r,t);return $B(e,r),e};Object.defineProperty(di,"__esModule",{value:!0});di.OptionValueBinaryCodec=void 0;var gI=YB(Ye()),wf=or(),Og=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(e[0]==0)return[wf.OptionValue.newMissingTyped(t),1];if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return[wf.OptionValue.newProvided(i),n+1]}decodeTopLevel(e,t){if(e.length==0)return new wf.OptionValue(t);if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return new wf.OptionValue(t,i)}encodeNested(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([])}};di.OptionValueBinaryCodec=Og});var mI=B(vf=>{"use strict";f();Object.defineProperty(vf,"__esModule",{value:!0});vf.AddressBinaryCodec=void 0;var JB=Gr(),XB=or(),Pg=class{decodeNested(e){let t=e.slice(0,32),i=new JB.Address(t);return[new XB.AddressValue(i),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};vf.AddressBinaryCodec=Pg});var vI=B(pi=>{"use strict";f();var ZB=pi&&pi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eM=pi&&pi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tM=pi&&pi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ZB(e,r,t);return eM(e,r),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.BooleanBinaryCodec=void 0;var rM=tM(Ye()),wI=or(),Kr=class{decodeNested(e){let t=e.readUInt8(0);return[new wI.BooleanValue(t==Kr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new rM.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new wI.BooleanValue(t==Kr.TRUE)}encodeNested(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([Kr.FALSE])}encodeTopLevel(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([])}};pi.BooleanBinaryCodec=Kr;Kr.TRUE=1;Kr.FALSE=0});var Af=B(Ef=>{"use strict";f();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.SizeOfU32=void 0;Ef.SizeOfU32=4});var AI=B(gi=>{"use strict";f();var iM=gi&&gi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(gi,"__esModule",{value:!0});gi.zeroPadStringIfOddLength=gi.isPaddedHex=gi.numberToPaddedHex=void 0;var nM=iM(jr());function sM(r){let e=new nM.default(r).toString(16);return EI(e)}gi.numberToPaddedHex=sM;function oM(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}gi.isPaddedHex=oM;function EI(r){return r=r||"",r.length%2==1?"0"+r:r}gi.zeroPadStringIfOddLength=EI});var Mg=B(Ut=>{"use strict";f();var aM=Ut&&Ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.prependByteToBuffer=Ut.flipBufferBitsInPlace=Ut.getHexMagnitudeOfBigInt=Ut.bigIntToBuffer=Ut.bufferToBigInt=Ut.cloneBuffer=Ut.isMsbZero=Ut.isMsbOne=void 0;var Bg=aM(jr()),uM=AI();function II(r,e=0){return r[e]>>7==1}Ut.isMsbOne=II;function cM(r,e=0){return!II(r,e)}Ut.isMsbZero=cM;function lM(r){let e=y.Buffer.alloc(r.length);return r.copy(e),e}Ut.cloneBuffer=lM;function fM(r){let e=r.toString("hex");return new Bg.default(`0x${e}`,16)}Ut.bufferToBigInt=fM;function hM(r){let e=_I(r);return y.Buffer.from(e,"hex")}Ut.bigIntToBuffer=hM;function _I(r){return r=new Bg.default(r),r?(r.isNegative()&&(r=r.multipliedBy(new Bg.default(-1))),uM.numberToPaddedHex(r)):""}Ut.getHexMagnitudeOfBigInt=_I;function dM(r){for(let e=0;e{"use strict";f();var gM=Aa&&Aa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Aa,"__esModule",{value:!0});Aa.NumericalBinaryCodec=void 0;var nc=gM(jr()),Rg=or(),bI=Af(),pt=Mg(),Lg=class{decodeNested(e,t){let i=0,n=t.sizeInBytes;n||(i=bI.SizeOfU32,n=e.readUInt32BE(0));let s=e.slice(i,i+n),o=this.decodeTopLevel(s,t),a=n+i;return[o,a]}decodeTopLevel(e,t){let i=pt.cloneBuffer(e);if(e.length==0)return new Rg.NumericalValue(t,new nc.default(0));if(!t.withSign||pt.isMsbZero(i)){let h=pt.bufferToBigInt(i);return new Rg.NumericalValue(t,h)}pt.flipBufferBitsInPlace(i);let u=pt.bufferToBigInt(i).multipliedBy(new nc.default(-1)).minus(new nc.default(1));return new Rg.NumericalValue(t,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),i=y.Buffer.alloc(bI.SizeOfU32);return i.writeUInt32BE(t.length),y.Buffer.concat([i,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return y.Buffer.alloc(t,0);if(!e.withSign){let o=pt.bigIntToBuffer(e.value),a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}if(e.value.isPositive()){let o=pt.bigIntToBuffer(e.value);pt.isMsbOne(o)&&(o=pt.prependByteToBuffer(o,0));let a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}let i=e.value.plus(new nc.default(1)),n=pt.bigIntToBuffer(i);pt.flipBufferBitsInPlace(n),pt.isMsbZero(n)&&(n=pt.prependByteToBuffer(n,255));let s=y.Buffer.alloc(t-n.length,255);return y.Buffer.concat([s,n])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?y.Buffer.alloc(0):t?this.encodePrimitive(e):pt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let n=pt.bigIntToBuffer(e.value);return pt.isMsbOne(n)&&(n=pt.prependByteToBuffer(n,0)),n}let t=e.value.plus(new nc.default(1)),i=pt.bigIntToBuffer(t);return pt.flipBufferBitsInPlace(i),pt.isMsbZero(i)&&(i=pt.prependByteToBuffer(i,255)),i}};Aa.NumericalBinaryCodec=Lg});var SI=B(If=>{"use strict";f();Object.defineProperty(If,"__esModule",{value:!0});If.H256BinaryCodec=void 0;var yM=rc(),Fg=class{decodeNested(e){let t=e.slice(0,32);return[new yM.H256Value(t),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};If.H256BinaryCodec=Fg});var Cf=B(bf=>{"use strict";f();Object.defineProperty(bf,"__esModule",{value:!0});bf.BytesBinaryCodec=void 0;var xI=wn(),_f=Af(),Ug=class{decodeNested(e){let t=e.readUInt32BE(0),i=e.slice(_f.SizeOfU32,_f.SizeOfU32+t);return[new xI.BytesValue(i),_f.SizeOfU32+t]}decodeTopLevel(e){return new xI.BytesValue(e)}encodeNested(e){let t=y.Buffer.alloc(_f.SizeOfU32);return t.writeUInt32BE(e.getLength()),y.Buffer.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};bf.BytesBinaryCodec=Ug});var NI=B(Sf=>{"use strict";f();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.TokenIdentifierCodec=void 0;var mM=wn(),TI=ma(),wM=Cf(),qg=class{constructor(){this.bytesCodec=new wM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesCodec.decodeNested(e);return[new TI.TokenIdentifierValue(t.toString()),i]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new TI.TokenIdentifierValue(t.toString())}encodeNested(e){let t=mM.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Sf.TokenIdentifierCodec=qg});var OI=B(xf=>{"use strict";f();Object.defineProperty(xf,"__esModule",{value:!0});xf.NothingCodec=void 0;var DI=or(),Vg=class{decodeNested(){return[new DI.NothingValue,0]}decodeTopLevel(){return new DI.NothingValue}encodeNested(){return y.Buffer.from([])}encodeTopLevel(){return y.Buffer.from([])}};xf.NothingCodec=Vg});var BI=B(Tf=>{"use strict";f();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.StringBinaryCodec=void 0;var PI=or(),vM=wn(),EM=Cf(),Hg=class{constructor(){this.bytesBinaryCodec=new EM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesBinaryCodec.decodeNested(e);return[new PI.StringValue(t.valueOf().toString()),i]}decodeTopLevel(e){return new PI.StringValue(e.toString())}encodeNested(e){let t=vM.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Tf.StringBinaryCodec=Hg});var MI=B(Df=>{"use strict";f();Object.defineProperty(Df,"__esModule",{value:!0});Df.PrimitiveBinaryCodec=void 0;var Nf=or(),AM=mI(),IM=vI(),_M=CI(),bM=SI(),CM=Cf(),SM=NI(),xM=OI(),TM=BI(),Qg=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new IM.BooleanBinaryCodec,this.numericalCodec=new _M.NumericalBinaryCodec,this.addressCodec=new AM.AddressBinaryCodec,this.h256Codec=new bM.H256BinaryCodec,this.bytesCodec=new CM.BytesBinaryCodec,this.stringCodec=new TM.StringBinaryCodec,this.tokenIdentifierCodec=new SM.TokenIdentifierCodec,this.nothingCodec=new xM.NothingCodec}decodeNested(e,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),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,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),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 Nf.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 Nf.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()})}};Df.PrimitiveBinaryCodec=Qg});var FI=B(Of=>{"use strict";f();Object.defineProperty(Of,"__esModule",{value:!0});Of.ListBinaryCodec=void 0;var RI=or(),LI=Af(),jg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.getFirstTypeParameter(),n=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=LI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,i);n.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(n.length)}return new RI.List(t,n)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=y.Buffer.alloc(LI.SizeOfU32);t.writeUInt32BE(e.getLength());let i=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);i.push(o)}return y.Buffer.concat([t,...i])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(let n of e.getItems()){let s=this.binaryCodec.encodeNested(n);t.push(s)}return y.Buffer.concat(t)}};Of.ListBinaryCodec=jg});var Kg=B(Pf=>{"use strict";f();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.FieldsBinaryCodec=void 0;var NM=or(),Gg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=[],n=0;for(let s of t){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),n+=a;let u=new NM.Field(o,s.name);i.push(u)}return[i,n]}encodeNested(e){let t=[];for(let i of e){let n=this.binaryCodec.encodeNested(i.value);t.push(n)}return y.Buffer.concat(t)}};Pf.FieldsBinaryCodec=Gg});var kg=B(Bf=>{"use strict";f();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.StructBinaryCodec=void 0;var DM=or(),OM=Kg(),zg=class{constructor(e){this.fieldsCodec=new OM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let i=t.getFieldsDefinitions(),[n,s]=this.fieldsCodec.decodeNested(e,i);return[new DM.Struct(t,n),s]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}};Bf.StructBinaryCodec=zg});var UI=B(Rf=>{"use strict";f();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.EnumBinaryCodec=void 0;var Mf=or(),PM=Kg(),Wg=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new PM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let[i,n]=this.readDiscriminant(e);e=e.slice(n);let s=t.getVariantByDiscriminant(i),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Mf.EnumValue(t,s,a),n+u]}readDiscriminant(e){let[t,i]=this.binaryCodec.decodeNested(e,new Mf.U8Type);return[t.valueOf(),i]}encodeNested(e){let t=new Mf.U8Value(e.discriminant),i=this.binaryCodec.encodeNested(t),n=e.getFields(),s=this.fieldsCodec.encodeNested(n);return y.Buffer.concat([i,s])}encodeTopLevel(e){let t=e.getFields(),i=t.length>0,n=this.fieldsCodec.encodeNested(t),s=new Mf.U8Value(e.discriminant),o=i?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return y.Buffer.concat([o,n])}};Rf.EnumBinaryCodec=Wg});var qI=B(Lf=>{"use strict";f();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.TupleBinaryCodec=void 0;var BM=kg(),$g=class{constructor(e){this.structCodec=new BM.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Lf.TupleBinaryCodec=$g});var VI=B(Ff=>{"use strict";f();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.ArrayVecBinaryCodec=void 0;var MM=or(),Yg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.length,n=t.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";f();var RM=Or&&Or.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),LM=Or&&Or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),FM=Or&&Or.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&RM(e,r,t);return LM(e,r),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.BinaryCodecConstraints=Or.BinaryCodec=void 0;var HI=FM(Ye()),Uf=or(),QI=Tr(),UM=yI(),qM=MI(),VM=FI(),HM=kg(),QM=UI(),jM=qI(),GM=VI(),Jg=class{constructor(e=null){this.constraints=e||new qf,this.optionCodec=new UM.OptionValueBinaryCodec(this),this.listCodec=new VM.ListBinaryCodec(this),this.arrayCodec=new GM.ArrayVecBinaryCodec(this),this.primitiveCodec=new qM.PrimitiveBinaryCodec(this),this.structCodec=new HM.StructBinaryCodec(this),this.tupleCodec=new jM.TupleBinaryCodec(this),this.enumCodec=new QM.EnumBinaryCodec(this)}decodeTopLevel(e,t){return this.constraints.checkBufferLength(e),Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[i,n]=Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t)});return[i,n]}encodeNested(e){return QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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 QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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)})}};Or.BinaryCodec=Jg;var qf=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||40960,this.maxListLength=e?.maxListLength||8192}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new HI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new HI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Or.BinaryCodecConstraints=qf});var jI=B(Pr=>{"use strict";f();var KM=Pr&&Pr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.decodeBigNumber=Pr.decodeString=Pr.decodeBool=Pr.decodeUnsignedNumber=void 0;var zM=KM(jr()),Vf=or(),kM=Xg(),Hf=new kM.BinaryCodec;function WM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return Number(e.valueOf())}Pr.decodeUnsignedNumber=WM;function $M(r){let e=Hf.decodeTopLevel(r,new Vf.BooleanType);return Boolean(e.valueOf())}Pr.decodeBool=$M;function YM(r){let e=Hf.decodeTopLevel(r,new Vf.BytesType);return String(e.valueOf())}Pr.decodeString=YM;function JM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return new zM.default(e.valueOf())}Pr.decodeBigNumber=JM});var KI=B(Cn=>{"use strict";f();var XM=Cn&&Cn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),GI=Cn&&Cn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&XM(e,r,t)};Object.defineProperty(Cn,"__esModule",{value:!0});GI(Xg(),Cn);GI(jI(),Cn)});var jf=B(Qf=>{"use strict";f();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ArgSerializer=void 0;var zI=Wu(),ZM=KI(),Zg=nf(),ey=of(),ty=df(),eR={codec:new ZM.BinaryCodec},ry=class{constructor(e){e=Object.assign(Object.assign({},eR),e),this.codec=e.codec}stringToValues(e,t){let i=this.stringToBuffers(e);return this.buffersToValues(i,t)}stringToBuffers(e){return e.split(zI.ARGUMENTS_SEPARATOR).map(t=>y.Buffer.from(t,"hex"))}buffersToValues(e,t){let i=this;e=e||[];let n=[],s=0,o=e.length;for(let p=0;p=o}return n}valuesToString(e){let t=this.valuesToStrings(e),i=t.join(zI.ARGUMENTS_SEPARATOR),n=t.length;return{argumentsString:i,count:n}}valuesToStrings(e){return this.valuesToBuffers(e).map(n=>n.toString("hex"))}valuesToBuffers(e){let t=this,i=[];for(let s of e)n(s);function n(s){if(s.hasExactClass(Zg.OptionalValue.ClassName)){let o=s;o.isSet()&&n(o.getTypedValue())}else if(s.hasExactClass(ty.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else if(s.hasExactClass(ey.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else{let o=t.codec.encodeTopLevel(s);i.push(o)}}return i}};Qf.ArgSerializer=ry});var cy=B(zr=>{"use strict";f();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var oy=sc(),ay=Tr(),tR=jf();zr.ArwenVirtualMachine="0500";var iy=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`${e}@${zr.ArwenVirtualMachine}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractDeployPayloadBuilder=iy;var ny=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`upgradeContract@${e}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractUpgradePayloadBuilder=ny;var sy=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(){ay.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=uy(e,this.arguments),new oy.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=sy;function uy(r,e){let{argumentsString:t,count:i}=new tR.ArgSerializer().valuesToString(e);return i==0?r:`${r}@${t}`}});var sc=B(Gf=>{"use strict";f();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.TransactionPayload=void 0;var ly=cy(),Ia=class{constructor(e){this.data=y.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ia("");let t=y.Buffer.from(e,"base64").toString();return new Ia(t)}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=>y.Buffer.from(e,"hex"))}length(){return y.Buffer.from(this.data).length}static contractDeploy(){return new ly.ContractDeployPayloadBuilder}static contractUpgrade(){return new ly.ContractUpgradePayloadBuilder}static contractCall(){return new ly.ContractCallPayloadBuilder}};Gf.TransactionPayload=Ia});var $I=B(Sn=>{"use strict";f();Object.defineProperty(Sn,"__esModule",{value:!0});Sn.MultiESDTNFTTransferPayloadBuilder=Sn.ESDTNFTTransferPayloadBuilder=Sn.ESDTTransferPayloadBuilder=void 0;var kI=Gr(),py=jf(),kr=or(),WI=og(),gy=sc(),fy=class{constructor(){this.payment=WI.TokenPayment.fungibleFromAmount("","0",0)}setPayment(e){return this.payment=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.BigUIntValue(this.payment.valueOf())],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTTransfer@${t}`;return new gy.TransactionPayload(i)}};Sn.ESDTTransferPayloadBuilder=fy;var hy=class{constructor(){this.payment=WI.TokenPayment.nonFungible("",0),this.destination=new kI.Address("")}setPayment(e){return this.payment=e,this}setDestination(e){return this.destination=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.U64Value(this.payment.nonce),new kr.BigUIntValue(this.payment.valueOf()),new kr.AddressValue(this.destination)],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Sn.ESDTNFTTransferPayloadBuilder=hy;var dy=class{constructor(){this.payments=[],this.destination=new kI.Address("")}setPayments(e){return this.payments=e,this}setDestination(e){return this.destination=e,this}build(){let e=[new kr.AddressValue(this.destination),new kr.U16Value(this.payments.length)];for(let n of this.payments)e.push(kr.BytesValue.fromUTF8(n.tokenIdentifier),new kr.U64Value(n.nonce),new kr.BigUIntValue(n.valueOf()));let{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`MultiESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Sn.MultiESDTNFTTransferPayloadBuilder=dy});var zf=B(Kf=>{"use strict";f();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.Account=void 0;var rR=Gr(),yy=class{constructor(e){this.address=new rR.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()}}};Kf.Account=yy});var YI=B(yi=>{"use strict";f();var iR=yi&&yi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),nR=yi&&yi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sR=yi&&yi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iR(e,r,t);return nR(e,r),e};Object.defineProperty(yi,"__esModule",{value:!0});yi.Hash=void 0;var oR=sR(Ye()),oc=class{constructor(e){if(!e)this.hash=y.Buffer.from([]);else if(e instanceof y.Buffer)this.hash=e;else if(typeof e=="string")this.hash=y.Buffer.from(e,"hex");else throw new oR.ErrBadType("hash","buffer | string",e)}static empty(){return new oc(y.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};yi.Hash=oc});var XI=B(Br=>{"use strict";f();var aR=Br&&Br.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),uR=Br&&Br.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),cR=Br&&Br.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&aR(e,r,t);return uR(e,r),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionOptions=Br.TransactionVersion=void 0;var JI=cR(Ye()),kf=Wu(),_a=class{constructor(e){if(e=Number(e),e<1)throw new JI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new _a(kf.TRANSACTION_VERSION_DEFAULT)}static withTxHashSignVersion(){return new _a(kf.TRANSACTION_VERSION_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionVersion=_a;var ba=class{constructor(e){if(e=Number(e),e<0)throw new JI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new ba(kf.TRANSACTION_OPTIONS_DEFAULT)}static withTxHashSignOptions(){return new ba(kf.TRANSACTION_OPTIONS_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionOptions=ba});var e_=B((qW,ZI)=>{"use strict";f();ZI.exports=lR;function lR(r,e){for(var t=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";f();var Wf=i_;Wf.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&e.charAt(t)==="=";)++i;return Math.ceil(e.length*3)/4-i};var Ca=new Array(64),r_=new Array(123);for(Wr=0;Wr<64;)r_[Ca[Wr]=Wr<26?Wr+65:Wr<52?Wr+71:Wr<62?Wr-4:Wr-59|43]=Wr++;var Wr;Wf.encode=function(e,t,i){for(var n=null,s=[],o=0,a=0,u;t>2],u=(h&3)<<4,a=1;break;case 1:s[o++]=Ca[u|h>>4],u=(h&15)<<2,a=2;break;case 2:s[o++]=Ca[u|h>>6],s[o++]=Ca[h&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Ca[u],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var t_="invalid encoding";Wf.decode=function(e,t,i){for(var n=i,s=0,o,a=0;a1)break;if((u=r_[u])===void 0)throw Error(t_);switch(s){case 0:o=u,s=1;break;case 1:t[i++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[i++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[i++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(t_);return i-n};Wf.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var o_=B((jW,s_)=>{"use strict";f();s_.exports=$f;function $f(){this._listeners={}}$f.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this};$f.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";f();h_.exports=a_(a_);function a_(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),i=t[3]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3]}function s(u,h,p){e[0]=u,h[p]=t[3],h[p+1]=t[2],h[p+2]=t[1],h[p+3]=t[0]}r.writeFloatLE=i?n:s,r.writeFloatBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],e[0]}function a(u,h){return t[3]=u[h],t[2]=u[h+1],t[1]=u[h+2],t[0]=u[h+3],e[0]}r.readFloatLE=i?o:a,r.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(n)/Math.LN2),h=Math.round(n*Math.pow(2,-u)*8388608)&8388607;i((a<<31|u+127<<23|h)>>>0,s,o)}}r.writeFloatLE=e.bind(null,u_),r.writeFloatBE=e.bind(null,c_);function t(i,n,s){var o=i(n,s),a=(o>>31)*2+1,u=o>>>23&255,h=o&8388607;return u===255?h?NaN:a*(1/0):u===0?a*1401298464324817e-60*h:a*Math.pow(2,u-150)*(h+8388608)}r.readFloatLE=t.bind(null,l_),r.readFloatBE=t.bind(null,f_)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),i=t[7]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3],h[p+4]=t[4],h[p+5]=t[5],h[p+6]=t[6],h[p+7]=t[7]}function s(u,h,p){e[0]=u,h[p]=t[7],h[p+1]=t[6],h[p+2]=t[5],h[p+3]=t[4],h[p+4]=t[3],h[p+5]=t[2],h[p+6]=t[1],h[p+7]=t[0]}r.writeDoubleLE=i?n:s,r.writeDoubleBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],t[4]=u[h+4],t[5]=u[h+5],t[6]=u[h+6],t[7]=u[h+7],e[0]}function a(u,h){return t[7]=u[h],t[6]=u[h+1],t[5]=u[h+2],t[4]=u[h+3],t[3]=u[h+4],t[2]=u[h+5],t[1]=u[h+6],t[0]=u[h+7],e[0]}r.readDoubleLE=i?o:a,r.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,u){var h=o<0?1:0;if(h&&(o=-o),o===0)i(0,a,u+n),i(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))i(0,a,u+n),i(2146959360,a,u+s);else if(o>17976931348623157e292)i(0,a,u+n),i((h<<31|2146435072)>>>0,a,u+s);else{var p;if(o<22250738585072014e-324)p=o/5e-324,i(p>>>0,a,u+n),i((h<<31|p/4294967296)>>>0,a,u+s);else{var w=Math.floor(Math.log(o)/Math.LN2);w===1024&&(w=1023),p=o*Math.pow(2,-w),i(p*4503599627370496>>>0,a,u+n),i((h<<31|w+1023<<20|p*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,u_,0,4),r.writeDoubleBE=e.bind(null,c_,4,0);function t(i,n,s,o,a){var u=i(o,a+n),h=i(o,a+s),p=(h>>31)*2+1,w=h>>>20&2047,N=4294967296*(h&1048575)+u;return w===2047?N?NaN:p*(1/0):w===0?p*5e-324*N:p*Math.pow(2,w-1075)*(N+4503599627370496)}r.readDoubleLE=t.bind(null,l_,0,4),r.readDoubleBE=t.bind(null,f_,4,0)}(),r}function u_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function c_(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function l_(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function f_(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var p_=B((exports,module)=>{"use strict";f();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(r){}return null}});var y_=B(g_=>{"use strict";f();var my=g_;my.length=function(e){for(var t=0,i=0,n=0;n191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&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))};my.write=function(e,t,i){for(var n=i,s,o,a=0;a>6|192,t[i++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128);return i-n}});var w_=B((YW,m_)=>{"use strict";f();m_.exports=fR;function fR(r,e,t){var i=t||8192,n=i>>>1,s=null,o=i;return function(u){if(u<1||u>n)return r(u);o+u>i&&(s=r(i),o=0);var h=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),h}}});var E_=B((XW,v_)=>{"use strict";f();v_.exports=zt;var ac=Tn();function zt(r,e){this.lo=r>>>0,this.hi=e>>>0}var Qs=zt.zero=new zt(0,0);Qs.toNumber=function(){return 0};Qs.zzEncode=Qs.zzDecode=function(){return this};Qs.length=function(){return 1};var hR=zt.zeroHash="\0\0\0\0\0\0\0\0";zt.fromNumber=function(e){if(e===0)return Qs;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new zt(i,n)};zt.from=function(e){if(typeof e=="number")return zt.fromNumber(e);if(ac.isString(e))if(ac.Long)e=ac.Long.fromString(e);else return zt.fromNumber(parseInt(e,10));return e.low||e.high?new zt(e.low>>>0,e.high>>>0):Qs};zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+i*4294967296)}return this.lo+this.hi*4294967296};zt.prototype.toLong=function(e){return ac.Long?new ac.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var xn=String.prototype.charCodeAt;zt.fromHash=function(e){return e===hR?Qs:new zt((xn.call(e,0)|xn.call(e,1)<<8|xn.call(e,2)<<16|xn.call(e,3)<<24)>>>0,(xn.call(e,4)|xn.call(e,5)<<8|xn.call(e,6)<<16|xn.call(e,7)<<24)>>>0)};zt.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)};zt.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};zt.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};zt.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}});var Tn=B(wy=>{"use strict";f();var we=wy;we.asPromise=e_();we.base64=n_();we.EventEmitter=o_();we.float=d_();we.inquire=p_();we.utf8=y_();we.pool=w_();we.LongBits=E_();we.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);we.global=we.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||wy;we.emptyArray=Object.freeze?Object.freeze([]):[];we.emptyObject=Object.freeze?Object.freeze({}):{};we.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};we.isString=function(e){return typeof e=="string"||e instanceof String};we.isObject=function(e){return e&&typeof e=="object"};we.isset=we.isSet=function(e,t){var i=e[t];return i!=null&&e.hasOwnProperty(t)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};we.Buffer=function(){try{var r=we.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();we._Buffer_from=null;we._Buffer_allocUnsafe=null;we.newBuffer=function(e){return typeof e=="number"?we.Buffer?we._Buffer_allocUnsafe(e):new we.Array(e):we.Buffer?we._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};we.Array=typeof Uint8Array<"u"?Uint8Array:Array;we.Long=we.global.dcodeIO&&we.global.dcodeIO.Long||we.global.Long||we.inquire("long");we.key2Re=/^true|false|0|1$/;we.key32Re=/^-?(?:0|[1-9][0-9]*)$/;we.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;we.longToHash=function(e){return e?we.LongBits.from(e).toHash():we.LongBits.zeroHash};we.longFromHash=function(e,t){var i=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))};function A_(r,e,t){for(var i=Object.keys(e),n=0;n-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};we.oneOfSetter=function(e){return function(t){for(var i=0;i{"use strict";f();S_.exports=qe;var Mr=Tn(),vy,Yf=Mr.LongBits,__=Mr.base64,b_=Mr.utf8;function uc(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Ay(){}function dR(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function qe(){this.len=0,this.head=new uc(Ay,0,0),this.tail=this.head,this.states=null}var C_=function(){return Mr.Buffer?function(){return(qe.create=function(){return new vy})()}:function(){return new qe}};qe.create=C_();qe.alloc=function(e){return new Mr.Array(e)};Mr.Array!==Array&&(qe.alloc=Mr.pool(qe.alloc,Mr.Array.prototype.subarray));qe.prototype._push=function(e,t,i){return this.tail=this.tail.next=new uc(e,t,i),this.len+=t,this};function Iy(r,e,t){e[t]=r&255}function pR(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function _y(r,e){this.len=r,this.next=void 0,this.val=e}_y.prototype=Object.create(uc.prototype);_y.prototype.fn=pR;qe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new _y((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};qe.prototype.int32=function(e){return e<0?this._push(by,10,Yf.fromNumber(e)):this.uint32(e)};qe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function by(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}qe.prototype.uint64=function(e){var t=Yf.from(e);return this._push(by,t.length(),t)};qe.prototype.int64=qe.prototype.uint64;qe.prototype.sint64=function(e){var t=Yf.from(e).zzEncode();return this._push(by,t.length(),t)};qe.prototype.bool=function(e){return this._push(Iy,1,e?1:0)};function Ey(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}qe.prototype.fixed32=function(e){return this._push(Ey,4,e>>>0)};qe.prototype.sfixed32=qe.prototype.fixed32;qe.prototype.fixed64=function(e){var t=Yf.from(e);return this._push(Ey,4,t.lo)._push(Ey,4,t.hi)};qe.prototype.sfixed64=qe.prototype.fixed64;qe.prototype.float=function(e){return this._push(Mr.float.writeFloatLE,4,e)};qe.prototype.double=function(e){return this._push(Mr.float.writeDoubleLE,8,e)};var gR=Mr.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(Iy,1,0);if(Mr.isString(e)){var i=qe.alloc(t=__.length(e));__.decode(e,i,0),e=i}return this.uint32(t)._push(gR,t,e)};qe.prototype.string=function(e){var t=b_.length(e);return t?this.uint32(t)._push(b_.write,t,e):this._push(Iy,1,0)};qe.prototype.fork=function(){return this.states=new dR(this),this.head=this.tail=new uc(Ay,0,0),this.len=0,this};qe.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 uc(Ay,0,0),this.len=0),this};qe.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this};qe.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t};qe._configure=function(r){vy=r,qe.create=C_(),vy._configure()}});var N_=B((n$,T_)=>{"use strict";f();T_.exports=mi;var x_=Cy();(mi.prototype=Object.create(x_.prototype)).constructor=mi;var Nn=Tn();function mi(){x_.call(this)}mi._configure=function(){mi.alloc=Nn._Buffer_allocUnsafe,mi.writeBytesBuffer=Nn.Buffer&&Nn.Buffer.prototype instanceof Uint8Array&&Nn.Buffer.prototype.set.name==="set"?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(mi.writeBytesBuffer,t,e),this};function yR(r,e,t){r.length<40?Nn.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}mi.prototype.string=function(e){var t=Nn.Buffer.byteLength(e);return this.uint32(t),t&&this._push(yR,t,e),this};mi._configure()});var Ty=B((o$,M_)=>{"use strict";f();M_.exports=gt;var wi=Tn(),xy,P_=wi.LongBits,mR=wi.utf8;function $r(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function gt(r){this.buf=r,this.pos=0,this.len=r.length}var D_=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new gt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new gt(e);throw Error("illegal buffer")},B_=function(){return wi.Buffer?function(t){return(gt.create=function(n){return wi.Buffer.isBuffer(n)?new xy(n):D_(n)})(t)}:D_};gt.create=B_();gt.prototype._slice=wi.Array.prototype.subarray||wi.Array.prototype.slice;gt.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}}();gt.prototype.int32=function(){return this.uint32()|0};gt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Sy(){var r=new P_(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}gt.prototype.bool=function(){return this.uint32()!==0};function Jf(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}gt.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)};gt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)|0};function O_(){if(this.pos+8>this.len)throw $r(this,8);return new P_(Jf(this.buf,this.pos+=4),Jf(this.buf,this.pos+=4))}gt.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=wi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};gt.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=wi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};gt.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)};gt.prototype.string=function(){var e=this.bytes();return mR.read(e,0,e.length)};gt.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};gt.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};gt._configure=function(r){xy=r,gt.create=B_(),xy._configure();var e=wi.Long?"toLong":"toNumber";wi.merge(gt.prototype,{int64:function(){return Sy.call(this)[e](!1)},uint64:function(){return Sy.call(this)[e](!0)},sint64:function(){return Sy.call(this).zzDecode()[e](!1)},fixed64:function(){return O_.call(this)[e](!0)},sfixed64:function(){return O_.call(this)[e](!1)}})}});var U_=B((u$,F_)=>{"use strict";f();F_.exports=js;var L_=Ty();(js.prototype=Object.create(L_.prototype)).constructor=js;var R_=Tn();function js(r){L_.call(this,r)}js._configure=function(){R_.Buffer&&(js.prototype._slice=R_.Buffer.prototype.slice)};js.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))};js._configure()});var V_=B((l$,q_)=>{"use strict";f();q_.exports=cc;var Ny=Tn();(cc.prototype=Object.create(Ny.EventEmitter.prototype)).constructor=cc;function cc(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Ny.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}cc.prototype.rpcCall=function r(e,t,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Ny.asPromise(r,o,e,t,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(u,h){if(u)return o.emit("error",u,e),s(u);if(h===null){o.end(!0);return}if(!(h instanceof i))try{h=i[o.responseDelimited?"decodeDelimited":"decode"](h)}catch(p){return o.emit("error",p,e),s(p)}return o.emit("data",h,e),s(null,h)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};cc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Q_=B(H_=>{"use strict";f();var wR=H_;wR.Service=V_()});var G_=B((p$,j_)=>{"use strict";f();j_.exports={}});var k_=B(z_=>{"use strict";f();var yr=z_;yr.build="minimal";yr.Writer=Cy();yr.BufferWriter=N_();yr.Reader=Ty();yr.BufferReader=U_();yr.util=Tn();yr.rpc=Q_();yr.roots=G_();yr.configure=K_;function K_(){yr.util._configure(),yr.Writer._configure(yr.BufferWriter),yr.Reader._configure(yr.BufferReader)}K_()});var $_=B((w$,W_)=>{"use strict";f();W_.exports=k_()});var J_=B((E$,Y_)=>{"use strict";f();var Sa=$_(),Xf=Sa.Reader,vR=Sa.Writer,le=Sa.util,lc=Sa.roots.default||(Sa.roots.default={});lc.proto=function(){var r={};return r.Transaction=function(){function e(t){if(t)for(var i=Object.keys(t),n=0;n>>3){case 1:o.Nonce=i.uint64();break;case 2:o.Value=i.bytes();break;case 3:o.RcvAddr=i.bytes();break;case 4:o.RcvUserName=i.bytes();break;case 5:o.SndAddr=i.bytes();break;case 6:o.SndUserName=i.bytes();break;case 7:o.GasPrice=i.uint64();break;case 8:o.GasLimit=i.uint64();break;case 9:o.Data=i.bytes();break;case 10:o.ChainID=i.bytes();break;case 11:o.Version=i.uint32();break;case 12:o.Signature=i.bytes();break;case 13:o.Options=i.uint32();break;default:i.skipType(a&7);break}}return o},e.decodeDelimited=function(i){return i instanceof Xf||(i=new Xf(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.Nonce!=null&&i.hasOwnProperty("Nonce")&&!le.isInteger(i.Nonce)&&!(i.Nonce&&le.isInteger(i.Nonce.low)&&le.isInteger(i.Nonce.high))?"Nonce: integer|Long expected":i.Value!=null&&i.hasOwnProperty("Value")&&!(i.Value&&typeof i.Value.length=="number"||le.isString(i.Value))?"Value: buffer expected":i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&!(i.RcvAddr&&typeof i.RcvAddr.length=="number"||le.isString(i.RcvAddr))?"RcvAddr: buffer expected":i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&!(i.RcvUserName&&typeof i.RcvUserName.length=="number"||le.isString(i.RcvUserName))?"RcvUserName: buffer expected":i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&!(i.SndAddr&&typeof i.SndAddr.length=="number"||le.isString(i.SndAddr))?"SndAddr: buffer expected":i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&!(i.SndUserName&&typeof i.SndUserName.length=="number"||le.isString(i.SndUserName))?"SndUserName: buffer expected":i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&!le.isInteger(i.GasPrice)&&!(i.GasPrice&&le.isInteger(i.GasPrice.low)&&le.isInteger(i.GasPrice.high))?"GasPrice: integer|Long expected":i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&!le.isInteger(i.GasLimit)&&!(i.GasLimit&&le.isInteger(i.GasLimit.low)&&le.isInteger(i.GasLimit.high))?"GasLimit: integer|Long expected":i.Data!=null&&i.hasOwnProperty("Data")&&!(i.Data&&typeof i.Data.length=="number"||le.isString(i.Data))?"Data: buffer expected":i.ChainID!=null&&i.hasOwnProperty("ChainID")&&!(i.ChainID&&typeof i.ChainID.length=="number"||le.isString(i.ChainID))?"ChainID: buffer expected":i.Version!=null&&i.hasOwnProperty("Version")&&!le.isInteger(i.Version)?"Version: integer expected":i.Signature!=null&&i.hasOwnProperty("Signature")&&!(i.Signature&&typeof i.Signature.length=="number"||le.isString(i.Signature))?"Signature: buffer expected":i.Options!=null&&i.hasOwnProperty("Options")&&!le.isInteger(i.Options)?"Options: integer expected":null},e.fromObject=function(i){if(i instanceof lc.proto.Transaction)return i;var n=new lc.proto.Transaction;return i.Nonce!=null&&(le.Long?(n.Nonce=le.Long.fromValue(i.Nonce)).unsigned=!0:typeof i.Nonce=="string"?n.Nonce=parseInt(i.Nonce,10):typeof i.Nonce=="number"?n.Nonce=i.Nonce:typeof i.Nonce=="object"&&(n.Nonce=new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0))),i.Value!=null&&(typeof i.Value=="string"?le.base64.decode(i.Value,n.Value=le.newBuffer(le.base64.length(i.Value)),0):i.Value.length&&(n.Value=i.Value)),i.RcvAddr!=null&&(typeof i.RcvAddr=="string"?le.base64.decode(i.RcvAddr,n.RcvAddr=le.newBuffer(le.base64.length(i.RcvAddr)),0):i.RcvAddr.length&&(n.RcvAddr=i.RcvAddr)),i.RcvUserName!=null&&(typeof i.RcvUserName=="string"?le.base64.decode(i.RcvUserName,n.RcvUserName=le.newBuffer(le.base64.length(i.RcvUserName)),0):i.RcvUserName.length&&(n.RcvUserName=i.RcvUserName)),i.SndAddr!=null&&(typeof i.SndAddr=="string"?le.base64.decode(i.SndAddr,n.SndAddr=le.newBuffer(le.base64.length(i.SndAddr)),0):i.SndAddr.length&&(n.SndAddr=i.SndAddr)),i.SndUserName!=null&&(typeof i.SndUserName=="string"?le.base64.decode(i.SndUserName,n.SndUserName=le.newBuffer(le.base64.length(i.SndUserName)),0):i.SndUserName.length&&(n.SndUserName=i.SndUserName)),i.GasPrice!=null&&(le.Long?(n.GasPrice=le.Long.fromValue(i.GasPrice)).unsigned=!0:typeof i.GasPrice=="string"?n.GasPrice=parseInt(i.GasPrice,10):typeof i.GasPrice=="number"?n.GasPrice=i.GasPrice:typeof i.GasPrice=="object"&&(n.GasPrice=new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0))),i.GasLimit!=null&&(le.Long?(n.GasLimit=le.Long.fromValue(i.GasLimit)).unsigned=!0:typeof i.GasLimit=="string"?n.GasLimit=parseInt(i.GasLimit,10):typeof i.GasLimit=="number"?n.GasLimit=i.GasLimit:typeof i.GasLimit=="object"&&(n.GasLimit=new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0))),i.Data!=null&&(typeof i.Data=="string"?le.base64.decode(i.Data,n.Data=le.newBuffer(le.base64.length(i.Data)),0):i.Data.length&&(n.Data=i.Data)),i.ChainID!=null&&(typeof i.ChainID=="string"?le.base64.decode(i.ChainID,n.ChainID=le.newBuffer(le.base64.length(i.ChainID)),0):i.ChainID.length&&(n.ChainID=i.ChainID)),i.Version!=null&&(n.Version=i.Version>>>0),i.Signature!=null&&(typeof i.Signature=="string"?le.base64.decode(i.Signature,n.Signature=le.newBuffer(le.base64.length(i.Signature)),0):i.Signature.length&&(n.Signature=i.Signature)),i.Options!=null&&(n.Options=i.Options>>>0),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(le.Long){var o=new le.Long(0,0,!0);s.Nonce=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.Nonce=n.longs===String?"0":0;if(n.bytes===String?s.Value="":(s.Value=[],n.bytes!==Array&&(s.Value=le.newBuffer(s.Value))),n.bytes===String?s.RcvAddr="":(s.RcvAddr=[],n.bytes!==Array&&(s.RcvAddr=le.newBuffer(s.RcvAddr))),n.bytes===String?s.RcvUserName="":(s.RcvUserName=[],n.bytes!==Array&&(s.RcvUserName=le.newBuffer(s.RcvUserName))),n.bytes===String?s.SndAddr="":(s.SndAddr=[],n.bytes!==Array&&(s.SndAddr=le.newBuffer(s.SndAddr))),n.bytes===String?s.SndUserName="":(s.SndUserName=[],n.bytes!==Array&&(s.SndUserName=le.newBuffer(s.SndUserName))),le.Long){var o=new le.Long(0,0,!0);s.GasPrice=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasPrice=n.longs===String?"0":0;if(le.Long){var o=new le.Long(0,0,!0);s.GasLimit=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasLimit=n.longs===String?"0":0;n.bytes===String?s.Data="":(s.Data=[],n.bytes!==Array&&(s.Data=le.newBuffer(s.Data))),n.bytes===String?s.ChainID="":(s.ChainID=[],n.bytes!==Array&&(s.ChainID=le.newBuffer(s.ChainID))),s.Version=0,n.bytes===String?s.Signature="":(s.Signature=[],n.bytes!==Array&&(s.Signature=le.newBuffer(s.Signature))),s.Options=0}return i.Nonce!=null&&i.hasOwnProperty("Nonce")&&(typeof i.Nonce=="number"?s.Nonce=n.longs===String?String(i.Nonce):i.Nonce:s.Nonce=n.longs===String?le.Long.prototype.toString.call(i.Nonce):n.longs===Number?new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0):i.Nonce),i.Value!=null&&i.hasOwnProperty("Value")&&(s.Value=n.bytes===String?le.base64.encode(i.Value,0,i.Value.length):n.bytes===Array?Array.prototype.slice.call(i.Value):i.Value),i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&(s.RcvAddr=n.bytes===String?le.base64.encode(i.RcvAddr,0,i.RcvAddr.length):n.bytes===Array?Array.prototype.slice.call(i.RcvAddr):i.RcvAddr),i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&(s.RcvUserName=n.bytes===String?le.base64.encode(i.RcvUserName,0,i.RcvUserName.length):n.bytes===Array?Array.prototype.slice.call(i.RcvUserName):i.RcvUserName),i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&(s.SndAddr=n.bytes===String?le.base64.encode(i.SndAddr,0,i.SndAddr.length):n.bytes===Array?Array.prototype.slice.call(i.SndAddr):i.SndAddr),i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&(s.SndUserName=n.bytes===String?le.base64.encode(i.SndUserName,0,i.SndUserName.length):n.bytes===Array?Array.prototype.slice.call(i.SndUserName):i.SndUserName),i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&(typeof i.GasPrice=="number"?s.GasPrice=n.longs===String?String(i.GasPrice):i.GasPrice:s.GasPrice=n.longs===String?le.Long.prototype.toString.call(i.GasPrice):n.longs===Number?new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0):i.GasPrice),i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&(typeof i.GasLimit=="number"?s.GasLimit=n.longs===String?String(i.GasLimit):i.GasLimit:s.GasLimit=n.longs===String?le.Long.prototype.toString.call(i.GasLimit):n.longs===Number?new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0):i.GasLimit),i.Data!=null&&i.hasOwnProperty("Data")&&(s.Data=n.bytes===String?le.base64.encode(i.Data,0,i.Data.length):n.bytes===Array?Array.prototype.slice.call(i.Data):i.Data),i.ChainID!=null&&i.hasOwnProperty("ChainID")&&(s.ChainID=n.bytes===String?le.base64.encode(i.ChainID,0,i.ChainID.length):n.bytes===Array?Array.prototype.slice.call(i.ChainID):i.ChainID),i.Version!=null&&i.hasOwnProperty("Version")&&(s.Version=i.Version),i.Signature!=null&&i.hasOwnProperty("Signature")&&(s.Signature=n.bytes===String?le.base64.encode(i.Signature,0,i.Signature.length):n.bytes===Array?Array.prototype.slice.call(i.Signature):i.Signature),i.Options!=null&&i.hasOwnProperty("Options")&&(s.Options=i.Options),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Sa.util.toJSONOptions)},e}(),r}();Y_.exports=lc});var eb=B(Rr=>{"use strict";f();var ER=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),AR=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),IR=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ER(e,r,t);return AR(e,r),e},_R=Rr&&Rr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var bR=_R(jr()),X_=Gr(),CR=Wu(),SR=IR(Ye()),xR=Mg(),Z_=J_(),Dy=class{serializeTransaction(e){let t=new X_.Address(e.getReceiver().bech32()).pubkey(),i=new X_.Address(e.getSender().bech32()).pubkey(),n=new Z_.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:t,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:y.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:y.Buffer.from(e.getSignature().hex(),"hex")});e.getOptions().valueOf()!==CR.TRANSACTION_OPTIONS_DEFAULT&&(n.Options=e.getOptions().valueOf());let s=Z_.proto.Transaction.encode(n).finish();return y.Buffer.from(s)}serializeTransactionValue(e){let t=new bR.default(e.toString());if(t.isZero())return y.Buffer.from([0,0]);let i=xR.bigIntToBuffer(t);return i=y.Buffer.concat([y.Buffer.from([0]),i]),i}deserializeTransaction(e){throw new SR.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=Dy});var tb=B(Gs=>{"use strict";f();var TR=Gs&&Gs.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),NR=Gs&&Gs.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&TR(e,r,t)};Object.defineProperty(Gs,"__esModule",{value:!0});NR(eb(),Gs)});var nb=B(vi=>{"use strict";f();var DR=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),OR=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),PR=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&DR(e,r,t);return OR(e,r),e};Object.defineProperty(vi,"__esModule",{value:!0});vi.Signature=void 0;var rb=PR(Ye()),ib=64,Yr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Yr.fromHex(e);if(e instanceof y.Buffer)return Yr.fromBuffer(e)}}static empty(){return new Yr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Yr.isValidHex(e))throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==ib}static fromValidHex(e){let t=new Yr;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=ib)throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};vi.Signature=Yr});var Oy=B((T$,sb)=>{f();Yi.notEqual=MR;Yi.notOk=RR;Yi.equal=BR;Yi.ok=Yi;sb.exports=Yi;function BR(r,e,t){Yi(r==e,t)}function MR(r,e,t){Yi(r!=e,t)}function RR(r,e){Yi(!r,e)}function Yi(r,e){if(!r)throw new Error(e||"AssertionError")}});var Ib=B(Da=>{"use strict";f();var Py=y0(),Ta=w0(),ob=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Da.Buffer=ne;Da.SlowBuffer=HR;Da.INSPECT_MAX_BYTES=50;var Zf=2147483647;Da.kMaxLength=Zf;ne.TYPED_ARRAY_SUPPORT=LR();!ne.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 LR(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(ne.prototype,"parent",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.buffer}});Object.defineProperty(ne.prototype,"offset",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.byteOffset}});function Ji(r){if(r>Zf)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,ne.prototype),e}function ne(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ly(r)}return lb(r,e,t)}ne.poolSize=8192;function lb(r,e,t){if(typeof r=="string")return UR(r,e);if(ArrayBuffer.isView(r))return qR(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Ei(r,ArrayBuffer)||r&&Ei(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ei(r,SharedArrayBuffer)||r&&Ei(r.buffer,SharedArrayBuffer)))return My(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return ne.from(i,e,t);let n=VR(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return ne.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}ne.from=function(r,e,t){return lb(r,e,t)};Object.setPrototypeOf(ne.prototype,Uint8Array.prototype);Object.setPrototypeOf(ne,Uint8Array);function fb(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function FR(r,e,t){return fb(r),r<=0?Ji(r):e!==void 0?typeof t=="string"?Ji(r).fill(e,t):Ji(r).fill(e):Ji(r)}ne.alloc=function(r,e,t){return FR(r,e,t)};function Ly(r){return fb(r),Ji(r<0?0:Fy(r)|0)}ne.allocUnsafe=function(r){return Ly(r)};ne.allocUnsafeSlow=function(r){return Ly(r)};function UR(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ne.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=hb(r,e)|0,i=Ji(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function By(r){let e=r.length<0?0:Fy(r.length)|0,t=Ji(e);for(let i=0;i=Zf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zf.toString(16)+" bytes");return r|0}function HR(r){return+r!=r&&(r=0),ne.alloc(+r)}ne.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ne.prototype};ne.compare=function(e,t){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),Ei(t,Uint8Array)&&(t=ne.from(t,t.offset,t.byteLength)),!ne.isBuffer(e)||!ne.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let s=0,o=Math.min(i,n);sn.length?(ne.isBuffer(o)||(o=ne.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(ne.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function hb(r,e){if(ne.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Ei(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Ry(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ab(r).length;default:if(n)return i?-1:Ry(r).length;e=(""+e).toLowerCase(),n=!0}}ne.byteLength=hb;function QR(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return XR(this,e,t);case"utf8":case"utf-8":return pb(this,e,t);case"ascii":return YR(this,e,t);case"latin1":case"binary":return JR(this,e,t);case"base64":return WR(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZR(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}ne.prototype._isBuffer=!0;function Ks(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}ne.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 t=0;tt&&(e+=" ... "),""};ob&&(ne.prototype[ob]=ne.prototype.inspect);ne.prototype.compare=function(e,t,i,n,s){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),!ne.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i);for(let w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,qy(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=ne.from(e,i)),ne.isBuffer(e))return e.length===0?-1:ab(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):ab(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function ab(r,e,t,i,n){let s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(p,w){return s===1?p[w]:p.readUInt16BE(w*s)}let h;if(n){let p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){let p=!0;for(let w=0;wn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return jR(this,e,t,i);case"utf8":case"utf-8":return GR(this,e,t,i);case"ascii":case"latin1":case"binary":return KR(this,e,t,i);case"base64":return zR(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kR(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function WR(r,e,t){return e===0&&t===r.length?Py.fromByteArray(r):Py.fromByteArray(r.slice(e,t))}function pb(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+a<=t){let u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return $R(i)}var ub=4096;function $R(r){let e=r.length;if(e<=ub)return String.fromCharCode.apply(String,r);let t="",i=0;for(;ii)&&(t=i);let n="";for(let s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}ne.prototype.readUintLE=ne.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};ne.prototype.readUint8=ne.prototype.readUInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]};ne.prototype.readUint16LE=ne.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]|this[e+1]<<8};ne.prototype.readUint16BE=ne.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]<<8|this[e+1]};ne.prototype.readUint32LE=ne.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ne.prototype.readUint32BE=ne.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ne.prototype.readBigUInt64LE=Dn(function(e){e=e>>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t*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+i;return(BigInt(n)<>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*t)),n};ne.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};ne.prototype.readInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ne.prototype.readInt16LE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt16BE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ne.prototype.readInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ne.prototype.readBigInt64LE=Dn(function(e){e=e>>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,t||kt(e,4,this.length),Ta.read(this,e,!0,23,4)};ne.prototype.readFloatBE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),Ta.read(this,e,!1,23,4)};ne.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),Ta.read(this,e,!0,52,8)};ne.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),Ta.read(this,e,!1,52,8)};function mr(r,e,t,i,n,s){if(!ne.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}ne.prototype.writeUintLE=ne.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=i-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+i};ne.prototype.writeUint8=ne.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,255,0),this[t]=e&255,t+1};ne.prototype.writeUint16LE=ne.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeUint16BE=ne.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeUint32LE=ne.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};ne.prototype.writeUint32BE=ne.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function gb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function yb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}ne.prototype.writeBigUInt64LE=Dn(function(e,t=0){return gb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeBigUInt64BE=Dn(function(e,t=0){return yb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=0,o=1,a=0;for(this[t]=e&255;++s>0)-a&255;return t+i};ne.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=i-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i};ne.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};ne.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};ne.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};ne.prototype.writeBigInt64LE=Dn(function(e,t=0){return gb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ne.prototype.writeBigInt64BE=Dn(function(e,t=0){return yb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mb(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function wb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ta.write(r,e,t,i,23,4),t+4}ne.prototype.writeFloatLE=function(e,t,i){return wb(this,e,t,!0,i)};ne.prototype.writeFloatBE=function(e,t,i){return wb(this,e,t,!1,i)};function vb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ta.write(r,e,t,i,52,8),t+8}ne.prototype.writeDoubleLE=function(e,t,i){return vb(this,e,t,!0,i)};ne.prototype.writeDoubleBE=function(e,t,i){return vb(this,e,t,!1,i)};ne.prototype.copy=function(e,t,i,n){if(!ne.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s2**32?n=cb(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=cb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function cb(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function eL(r,e,t){Na(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&fc(e,r.length-(t+1))}function Eb(r,e,t,i,n,s){if(r>t||r3?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 <= ${t}${o}`,new xa.ERR_OUT_OF_RANGE("value",a,r)}eL(i,n,s)}function Na(r,e){if(typeof r!="number")throw new xa.ERR_INVALID_ARG_TYPE(e,"number",r)}function fc(r,e,t){throw Math.floor(r)!==r?(Na(r,t),new xa.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new xa.ERR_BUFFER_OUT_OF_BOUNDS:new xa.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var tL=/[^+/0-9A-Za-z-_]/g;function rL(r){if(r=r.split("=")[0],r=r.trim().replace(tL,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Ry(r,e){e=e||1/0;let t,i=r.length,n=null,s=[];for(let o=0;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function iL(r){let e=[];for(let t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function Ab(r){return Py.toByteArray(rL(r))}function eh(r,e,t,i){let n;for(n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function Ei(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function qy(r){return r!==r}var sL=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function Dn(r){return typeof BigInt>"u"?oL:r}function oL(){throw new Error("BigInt not supported")}});var bb=B((B$,_b)=>{f();_b.exports=Vy;Vy.supported=typeof WebAssembly<"u";function Vy(r){if(!Vy.supported)return null;var e=r&&r.imports,t=aL("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"),i=null,n={buffer:t,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),n;function s(u){n.exports.memory.grow(Math.ceil(Math.abs(u-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function o(u){if(n.exports)return u();if(i){i.then(u.bind(null,null)).catch(u);return}try{if(r&&r.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{i=WebAssembly.instantiate(t,e).then(a)}o(u)}function a(u){n.exports=u.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function aL(r){return typeof atob=="function"?new Uint8Array(atob(r).split("").map(uL)):new(Ib()).Buffer(r,"base64")}function uL(r){return r.charCodeAt(0)}});var Ob=B((F$,Ii)=>{f();var Ai=Oy(),ke=bb()(),Xi=64,th=[];Ii.exports=Lr;var Cb=Ii.exports.BYTES_MIN=16,Sb=Ii.exports.BYTES_MAX=64,R$=Ii.exports.BYTES=32,xb=Ii.exports.KEYBYTES_MIN=16,Tb=Ii.exports.KEYBYTES_MAX=64,L$=Ii.exports.KEYBYTES=32,Nb=Ii.exports.SALTBYTES=16,Db=Ii.exports.PERSONALBYTES=16;function Lr(r,e,t,i,n){if(!(this instanceof Lr))return new Lr(r,e,t,i,n);if(!(ke&&ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");r||(r=32),n!==!0&&(Ai(r>=Cb,"digestLength must be at least "+Cb+", was given "+r),Ai(r<=Sb,"digestLength must be at most "+Sb+", was given "+r),e!=null&&Ai(e.length>=xb,"key must be at least "+xb+", was given "+e.length),e!=null&&Ai(e.length<=Tb,"key must be at least "+Tb+", was given "+e.length),t!=null&&Ai(t.length===Nb,"salt must be exactly "+Nb+", was given "+t.length),i!=null&&Ai(i.length===Db,"personal must be exactly "+Db+", was given "+i.length)),th.length||(th.push(Xi),Xi+=216),this.digestLength=r,this.finalized=!1,this.pointer=th.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,t&&ke.memory.set(t,32),i&&ke.memory.set(i,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,Xi,Xi+e.length),ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(r){return Ai(this.finalized===!1,"Hash instance finalized"),Ai(r,"input must be TypedArray or Buffer"),Xi+r.length>ke.memory.length&&ke.realloc(Xi+r.length),ke.memory.set(r,Xi),ke.exports.blake2b_update(this.pointer,Xi,Xi+r.length),this};Lr.prototype.digest=function(r){if(Ai(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,th.push(this.pointer),ke.exports.blake2b_final(this.pointer),!r||r==="binary")return ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(r==="hex")return lL(ke.memory,this.pointer+128,this.digestLength);Ai(r.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{f();var Bn=Oy(),dc=Ob();function rh(r,e,t){var i=r[e]+r[t],n=r[e+1]+r[t+1];i>=4294967296&&n++,r[e]=i,r[e+1]=n}function Pb(r,e,t,i){var n=r[e]+t;t<0&&(n+=4294967296);var s=r[e+1]+i;n>=4294967296&&s++,r[e]=n,r[e+1]=s}function qb(r,e){return r[e]^r[e+1]<<8^r[e+2]<<16^r[e+3]<<24}function On(r,e,t,i,n,s){var o=hc[n],a=hc[n+1],u=hc[s],h=hc[s+1];rh(Se,r,e),Pb(Se,r,o,a);var p=Se[i]^Se[r],w=Se[i+1]^Se[r+1];Se[i]=w,Se[i+1]=p,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=p>>>24^w<<8,Se[e+1]=w>>>24^p<<8,rh(Se,r,e),Pb(Se,r,u,h),p=Se[i]^Se[r],w=Se[i+1]^Se[r+1],Se[i]=p>>>16^w<<16,Se[i+1]=w>>>16^p<<16,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=w>>>31^p<<1,Se[e+1]=p>>>31^w<<1}var Vb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),hL=[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],ar=new Uint8Array(hL.map(function(r){return r*2})),Se=new Uint32Array(32),hc=new Uint32Array(32);function Hb(r,e){var t=0;for(t=0;t<16;t++)Se[t]=r.h[t],Se[t+16]=Vb[t];for(Se[24]=Se[24]^r.t,Se[25]=Se[25]^r.t/4294967296,e&&(Se[28]=~Se[28],Se[29]=~Se[29]),t=0;t<32;t++)hc[t]=qb(r.b,4*t);for(t=0;t<12;t++)On(0,8,16,24,ar[t*16+0],ar[t*16+1]),On(2,10,18,26,ar[t*16+2],ar[t*16+3]),On(4,12,20,28,ar[t*16+4],ar[t*16+5]),On(6,14,22,30,ar[t*16+6],ar[t*16+7]),On(0,10,20,30,ar[t*16+8],ar[t*16+9]),On(2,12,22,24,ar[t*16+10],ar[t*16+11]),On(4,14,16,26,ar[t*16+12],ar[t*16+13]),On(6,8,18,28,ar[t*16+14],ar[t*16+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^Se[t]^Se[t+16]}var Pn=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 Oa(r,e,t,i){Pn.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=r,Pn[0]=r,e&&(Pn[1]=e.length),Pn[2]=1,Pn[3]=1,t&&Pn.set(t,32),i&&Pn.set(i,48);for(var n=0;n<16;n++)this.h[n]=Vb[n]^qb(Pn,n*4);e&&(Qb(this,e),this.c=128)}Oa.prototype.update=function(r){return Bn(r!=null,"input must be Uint8Array or Buffer"),Qb(this,r),this};Oa.prototype.digest=function(r){var e=!r||r==="binary"||r==="hex"?new Uint8Array(this.outlen):r;return Bn(e.length>=this.outlen,"out must have at least outlen bytes of space"),dL(this,e),r==="hex"?pL(e):e};Oa.prototype.final=Oa.prototype.digest;Oa.ready=function(r){dc.ready(function(){r()})};function Qb(r,e){for(var t=0;t>2]>>8*(t&3);return e}function pL(r){for(var e="",t=0;t=Bb,"outlen must be at least "+Bb+", was given "+e),Bn(e<=Mb,"outlen must be at most "+Mb+", was given "+e),t!=null&&Bn(t.length>=Rb,"key must be at least "+Rb+", was given "+t.length),t!=null&&Bn(t.length<=Lb,"key must be at most "+Lb+", was given "+t.length),i!=null&&Bn(i.length===Fb,"salt must be exactly "+Fb+", was given "+i.length),n!=null&&Bn(n.length===Ub,"personal must be exactly "+Ub+", was given "+n.length)),new jb(e,t,i,n)};wr.exports.ready=function(r){dc.ready(function(){r()})};wr.exports.WASM_SUPPORTED=dc.SUPPORTED;wr.exports.WASM_LOADED=!1;var Bb=wr.exports.BYTES_MIN=16,Mb=wr.exports.BYTES_MAX=64,q$=wr.exports.BYTES=32,Rb=wr.exports.KEYBYTES_MIN=16,Lb=wr.exports.KEYBYTES_MAX=64,V$=wr.exports.KEYBYTES=32,Fb=wr.exports.SALTBYTES=16,Ub=wr.exports.PERSONALBYTES=16;dc.ready(function(r){r||(wr.exports.WASM_LOADED=!0,jb=dc)})});var jy=B(Fr=>{"use strict";f();var yL=Fr&&Fr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),mL=Fr&&Fr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),wL=Fr&&Fr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yL(e,r,t);return mL(e,r),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var Pa=jr(),Hy=Gr(),vL=Wu(),EL=wL(Ye()),AL=YI(),Qy=XI(),IL=tb(),Kb=nb(),zb=sc(),_L=Tr(),bL=Gb(),CL=32,pc=class{constructor({nonce:e,value:t,receiver:i,sender:n,gasPrice:s,gasLimit:o,data:a,chainID:u,version:h,options:p}){this.nonce=e||0,this.value=t?new Pa.BigNumber(t.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.gasPrice=s||vL.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new zb.TransactionPayload,this.chainID=u,this.version=h||Qy.TransactionVersion.withDefaultVersion(),this.options=p||Qy.TransactionOptions.withDefaultOptions(),this.signature=Kb.Signature.empty(),this.hash=zs.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}getReceiver(){return this.receiver}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}getOptions(){return this.options}getSignature(){return this.signature}getHash(){return _L.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(e){let t=this.toPlainObject(e);t.signature&&delete t.signature;let i=JSON.stringify(t);return y.Buffer.from(i)}toPlainObject(e){return{nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:e?e.bech32():this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),signature:this.signature.hex()?this.signature.hex():void 0}}static fromPlainObject(e){let t=new pc({nonce:Number(e.nonce),value:new Pa.BigNumber(e.value).toFixed(0),receiver:Hy.Address.fromString(e.receiver),sender:Hy.Address.fromString(e.sender),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new zb.TransactionPayload(y.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Qy.TransactionVersion(e.version)});return e.signature&&t.applySignature(new Kb.Signature(e.signature),Hy.Address.fromString(e.sender)),t}applySignature(e,t){this.signature=e,this.sender=t,this.hash=zs.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let t=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(t>this.gasLimit.valueOf())throw new EL.ErrNotEnoughGas(this.gasLimit.valueOf());let i=new Pa.BigNumber(this.gasPrice.valueOf()),n=new Pa.BigNumber(t).multipliedBy(i);if(t===this.gasLimit.valueOf())return n;let s=new Pa.BigNumber(this.gasLimit.valueOf()-t),o=i.multipliedBy(new Pa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return n.plus(a)}};Fr.Transaction=pc;var zs=class extends AL.Hash{constructor(e){super(e)}static compute(e){let i=new IL.ProtoSerializer().serializeTransaction(e),n=bL(CL).update(i).digest("hex");return new zs(n)}};Fr.TransactionHash=zs});var Gy=B(Ws=>{"use strict";f();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Logger=Ws.LogLevel=void 0;var ks;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warn=3]="Warn",r[r.Error=4]="Error",r[r.None=5]="None"})(ks=Ws.LogLevel||(Ws.LogLevel={}));var Jr=class{static setLevel(e){Jr.logLevel=e}static trace(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static debug(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static info(e,...t){Jr.logLevel>=ks.Info||console.log(e,t)}static warn(e,...t){Jr.logLevel>=ks.Warn||console.warn(e,t)}static error(e,...t){Jr.logLevel>=ks.Error||console.error(e,t)}};Ws.Logger=Jr;Jr.logLevel=ks.Debug});var kb=B(_i=>{"use strict";f();var SL=_i&&_i.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),xL=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),TL=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&SL(e,r,t);return xL(e,r),e};Object.defineProperty(_i,"__esModule",{value:!0});_i.AsyncTimer=void 0;var NL=TL(Ye()),DL=Ye(),Ky=Gy(),zy=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new NL.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((t,i)=>{this.rejectionFunc=i;let n=()=>{this.rejectionFunc=null,this.stop(),t()};this.timeoutHandle=setTimeout(n,e)})}abort(){Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new DL.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_i.AsyncTimer=zy});var Wy=B(Ma=>{"use strict";f();var Ur=Ma&&Ma.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.TransactionWatcher=void 0;var Wb=kb(),$b=Gy(),Ba=Ye(),bi=class{constructor(e,t=bi.DefaultPollingInterval,i=bi.DefaultTimeout){this.fetcher=new ky(e),this.pollingInterval=t,this.timeout=i}awaitPending(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.status.isPending(),i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ba.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitCompleted(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.isCompleted,i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ba.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitAllEvents(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.every(h=>a.includes(h))},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ba.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitAnyEvent(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.find(h=>a.includes(h))!=null},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ba.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitOnCondition(e,t){return Ur(this,void 0,void 0,function*(){let i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ba.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitConditionally(e,t,i){return Ur(this,void 0,void 0,function*(){let n=new Wb.AsyncTimer("watcher:periodic"),s=new Wb.AsyncTimer("watcher:timeout"),o=!1,a,u=!1;for(s.start(this.timeout).finally(()=>{s.stop(),o=!0});!o;){yield n.start(this.pollingInterval);try{if(a=yield t(),u=e(a),u||o)break}catch(h){if($b.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(h instanceof Ba.Err))throw h}}if(s.isStopped()||s.stop(),!a||!u)throw i();return a})}getAllTransactionEvents(e){let t=[...e.logs.events];for(let i of e.contractResults.items)t.push(...i.logs.events);return t}};Ma.TransactionWatcher=bi;bi.DefaultPollingInterval=6e3;bi.DefaultTimeout=bi.DefaultPollingInterval*15;bi.NoopOnStatusReceived=r=>{};var ky=class{constructor(e){this.fetcher=e}getTransaction(e){return Ur(this,void 0,void 0,function*(){return $b.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var Yb=B(Ci=>{"use strict";f();var OL=Ci&&Ci.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),PL=Ci&&Ci.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),BL=Ci&&Ci.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&OL(e,r,t);return PL(e,r),e};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ContractFunction=void 0;var ML=BL(Ye()),gc=class{constructor(e){if(this.name=e,e==null)throw new ML.ErrInvalidFunctionName}static none(){return new gc("untitled")}toString(){return this.name}valueOf(){return this.name}equals(e){return e?this.name==e.name:!1}};Ci.ContractFunction=gc});var Jb=B(Ra=>{"use strict";f();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Signature=Ra.Address=void 0;var $y=class{constructor(e){this.value=e}bech32(){return this.value}};Ra.Address=$y;var Yy=class{constructor(e){this.value=e}hex(){return this.value}};Ra.Signature=Yy});var Xb=B(yc=>{"use strict";f();Object.defineProperty(yc,"__esModule",{value:!0});yc.Operation=void 0;var RL;(function(r){r.Connect="connect",r.Logout="logout",r.SignTransactions="signTransactions",r.SignMessage="signMessage",r.CancelAction="cancelAction"})(RL=yc.Operation||(yc.Operation={}))});var Zb=B(Mn=>{"use strict";f();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.ErrAccountNotConnected=Mn.ErrCannotSignSingleTransaction=Mn.Err=void 0;var mc=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Mn.Err=mc;var Jy=class extends mc{constructor(){super("Cannot sign single transaction.")}};Mn.ErrCannotSignSingleTransaction=Jy;var Xy=class extends mc{constructor(){super("Account is not connected.")}};Mn.ErrAccountNotConnected=Xy});var Zy=B(La=>{"use strict";f();var Rn=La&&La.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(La,"__esModule",{value:!0});La.ExtensionProvider=void 0;var ih=Jb(),wc=Xb(),eC=Zb(),Si=class{constructor(){if(this.account={address:""},this.initialized=!1,Si._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");Si._instance=this}static getInstance(){return Si._instance}setAddress(e){return this.account.address=e,Si._instance}init(){return Rn(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:t}=e,i=t||"";return yield this.startBgrMsgChannel(wc.Operation.Connect,i),this.account.address})}logout(){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(wc.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 Rn(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 Rn(this,void 0,void 0,function*(){return Boolean(this.account.address)})}signTransaction(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.signTransactions([e]);if(t.length!=1)throw new eC.ErrCannotSignSingleTransaction;return t[0]})}ensureConnected(){if(!this.account.address)throw new eC.ErrAccountNotConnected}signTransactions(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.startBgrMsgChannel(wc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(i=>i.toPlainObject())});try{for(let i=0;i{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);let n=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&Boolean(s.data.data.address)&&(this.account=s.data.data),window.removeEventListener("message",n),i(s.data.data)):(window.removeEventListener("message",n),i(s.data.data)))};window.addEventListener("message",n,!1)})}};La.ExtensionProvider=Si;Si._instance=new Si});var oC=B((yY,sC)=>{"use strict";f();function LL(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}sC.exports=FL;function FL(r,e,t){var i=t&&t.stringify||LL,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var a=1;a-1?w:0,r.charCodeAt(O+1)){case 100:case 102:if(p>=u||e[p]==null)break;w=u||e[p]==null)break;w=u||e[p]===void 0)break;w",w=O+2,O++;break}h+=i(e[p]),w=O+2,O++;break;case 115:if(p>=u)break;w{"use strict";f();var aC=oC();lC.exports=Ti;var vc=kL().console||{},UL={mapHttpRequest:uh,mapHttpResponse:uh,wrapRequestSerializer:em,wrapResponseSerializer:em,wrapErrorSerializer:em,req:uh,res:uh,err:jL};function qL(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Ti(r){r=r||{},r.browser=r.browser||{};let e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let t=r.browser.write||vc;r.browser.write&&(r.browser.asObject=!0);let i=r.serializers||{},n=qL(r.browser.serialize,i),s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");let a=r.level||"info",u=Object.create(t);u.log||(u.log=Ec),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:w,set:N});let h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:GL(r)};u.levels=Ti.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=Ec,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=O,e&&(u._logEvent=tm());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function N(T){if(T!=="silent"&&!this.levels.values[T])throw Error("unknown level "+T);this._level=T,Fa(h,u,"error","log"),Fa(h,u,"fatal","error"),Fa(h,u,"warn","error"),Fa(h,u,"info","log"),Fa(h,u,"debug","log"),Fa(h,u,"trace","log")}function O(T,V){if(!T)throw new Error("missing bindings for child Pino");V=V||{},n&&T.serializers&&(V.serializers=T.serializers);let z=V.serializers;if(n&&z){var $=Object.assign({},i,z),se=r.browser.serialize===!0?Object.keys($):n;delete T.serializers,ch([T],se,$,this._stdErrSerialize)}function Y(j){this._childLevel=(j._childLevel|0)+1,this.error=Ua(j,T,"error"),this.fatal=Ua(j,T,"fatal"),this.warn=Ua(j,T,"warn"),this.info=Ua(j,T,"info"),this.debug=Ua(j,T,"debug"),this.trace=Ua(j,T,"trace"),$&&(this.serializers=$,this._serialize=se),e&&(this._logEvent=tm([].concat(j._logEvent.bindings,T)))}return Y.prototype=this,new Y(this)}return u}Ti.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"}};Ti.stdSerializers=UL;Ti.stdTimeFunctions=Object.assign({},{nullTime:uC,epochTime:cC,unixTime:KL,isoTime:zL});function Fa(r,e,t,i){let n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Ec:n[t]?n[t]:vc[t]||vc[i]||Ec,VL(r,e,t)}function VL(r,e,t){!r.transmit&&e[t]===Ec||(e[t]=function(i){return function(){let s=r.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vc?vc:this;for(var u=0;u-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Ua(r,e,t){return function(){let i=new Array(1+arguments.length);i[0]=e;for(var n=1;n{"use strict";f();var qa=typeof Reflect=="object"?Reflect:null,fC=qa&&typeof qa.apply=="function"?qa.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},fh;qa&&typeof qa.ownKeys=="function"?fh=qa.ownKeys:Object.getOwnPropertySymbols?fh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:fh=function(e){return Object.getOwnPropertyNames(e)};function WL(r){console&&console.warn&&console.warn(r)}var dC=Number.isNaN||function(e){return e!==e};function je(){je.init.call(this)}rm.exports=je;rm.exports.once=XL;je.EventEmitter=je;je.prototype._events=void 0;je.prototype._eventsCount=0;je.prototype._maxListeners=void 0;var hC=10;function hh(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return hC},set:function(r){if(typeof r!="number"||r<0||dC(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");hC=r}});je.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};je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dC(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 pC(r){return r._maxListeners===void 0?je.defaultMaxListeners:r._maxListeners}je.prototype.getMaxListeners=function(){return pC(this)};je.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[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")fC(u,this,t);else for(var h=u.length,p=vC(u,h),i=0;i0&&o.length>n&&!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=r,a.type=e,a.count=o.length,WL(a)}return r}je.prototype.addListener=function(e,t){return gC(this,e,t,!1)};je.prototype.on=je.prototype.addListener;je.prototype.prependListener=function(e,t){return gC(this,e,t,!0)};function $L(){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 yC(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=$L.bind(i);return n.listener=t,i.wrapFn=n,n}je.prototype.once=function(e,t){return hh(t),this.on(e,yC(this,e,t)),this};je.prototype.prependOnceListener=function(e,t){return hh(t),this.prependListener(e,yC(this,e,t)),this};je.prototype.removeListener=function(e,t){var i,n,s,o,a;if(hh(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():YL(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};je.prototype.off=je.prototype.removeListener;je.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function mC(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?JL(n):vC(n,n.length)}je.prototype.listeners=function(e){return mC(this,e,!0)};je.prototype.rawListeners=function(e){return mC(this,e,!1)};je.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):wC.call(r,e)};je.prototype.listenerCount=wC;function wC(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}je.prototype.eventNames=function(){return this._eventsCount>0?fh(this._events):[]};function vC(r,e){for(var t=new Array(e),i=0;inm,__asyncDelegator:()=>h5,__asyncGenerator:()=>f5,__asyncValues:()=>d5,__await:()=>Ac,__awaiter:()=>s5,__classPrivateFieldGet:()=>m5,__classPrivateFieldSet:()=>w5,__createBinding:()=>a5,__decorate:()=>r5,__exportStar:()=>u5,__extends:()=>e5,__generator:()=>o5,__importDefault:()=>y5,__importStar:()=>g5,__makeTemplateObject:()=>p5,__metadata:()=>n5,__param:()=>i5,__read:()=>AC,__rest:()=>t5,__spread:()=>c5,__spreadArrays:()=>l5,__values:()=>sm});function e5(r,e){im(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function t5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n=0;a--)(o=r[a])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function i5(r,e){return function(t,i){e(t,i,r)}}function n5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function s5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})}function o5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,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(h){return function(p){return u([h,p])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=h[0]&2?n.return:h[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,h[1])).done)return s;switch(n=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,n=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function AC(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function c5(){for(var r=[],e=0;e1||a(N,O)})})}function a(N,O){try{u(i[N](O))}catch(T){w(s[0][3],T)}}function u(N){N.value instanceof Ac?Promise.resolve(N.value.v).then(h,p):w(s[0][2],N)}function h(N){a("next",N)}function p(N){a("throw",N)}function w(N,O){N(O),s.shift(),s.length&&a(s[0][0],s[0][1])}}function h5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(o){return(t=!t)?{value:Ac(r[n](o)),done:n==="return"}:s?s(o):o}:s}}function d5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof sm=="function"?sm(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(o){return new Promise(function(a,u){o=r[s](o),n(a,u,o.done,o.value)})}}function n(s,o,a,u){Promise.resolve(u).then(function(h){s({value:h,done:a})},o)}}function p5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function g5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function y5(r){return r&&r.__esModule?r:{default:r}}function m5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function w5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var im,nm,br=me(()=>{f();im=function(r,e){return im=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},im(r,e)};nm=function(){return nm=Object.assign||function(e){for(var t,i=1,n=arguments.length;i{"use strict";f();Object.defineProperty(dh,"__esModule",{value:!0});function v5(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}dh.safeJsonParse=v5;function E5(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}dh.safeJsonStringify=E5});var IC=B((CY,ph)=>{"use strict";f();(function(){"use strict";let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){let t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?ph.exports=global.localStorage:typeof window<"u"&&window.localStorage?ph.exports=window.localStorage:ph.exports=new e})()});var _C=B(gh=>{"use strict";f();Object.defineProperty(gh,"__esModule",{value:!0});gh.IKeyValueStorage=void 0;var am=class{};gh.IKeyValueStorage=am});var bC=B(yh=>{"use strict";f();Object.defineProperty(yh,"__esModule",{value:!0});yh.parseEntry=void 0;var A5=om();function I5(r){var e;return[r[0],A5.safeJsonParse((e=r[1])!==null&&e!==void 0?e:"")]}yh.parseEntry=I5});var SC=B(mh=>{"use strict";f();Object.defineProperty(mh,"__esModule",{value:!0});var CC=(br(),at(_r));CC.__exportStar(_C(),mh);CC.__exportStar(bC(),mh)});var TC=B(Ic=>{"use strict";f();Object.defineProperty(Ic,"__esModule",{value:!0});Ic.KeyValueStorage=void 0;var Va=(br(),at(_r)),xC=om(),_5=Va.__importDefault(IC()),b5=SC(),wh=class{constructor(){this.localStorage=_5.default}getKeys(){return Va.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return Va.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(b5.parseEntry)})}getItem(e){return Va.__awaiter(this,void 0,void 0,function*(){let t=this.localStorage.getItem(e);if(t!==null)return xC.safeJsonParse(t)})}setItem(e,t){return Va.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,xC.safeJsonStringify(t))})}removeItem(e){return Va.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Ic.KeyValueStorage=wh;Ic.default=wh});var NC=B(vh=>{"use strict";f();Object.defineProperty(vh,"__esModule",{value:!0});vh.delay=void 0;function C5(r){return new Promise(e=>{setTimeout(()=>{e(!0)},r)})}vh.delay=C5});var DC=B(Ha=>{"use strict";f();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.ONE_THOUSAND=Ha.ONE_HUNDRED=void 0;Ha.ONE_HUNDRED=100;Ha.ONE_THOUSAND=1e3});var OC=B(ye=>{"use strict";f();Object.defineProperty(ye,"__esModule",{value:!0});ye.ONE_YEAR=ye.FOUR_WEEKS=ye.THREE_WEEKS=ye.TWO_WEEKS=ye.ONE_WEEK=ye.THIRTY_DAYS=ye.SEVEN_DAYS=ye.FIVE_DAYS=ye.THREE_DAYS=ye.ONE_DAY=ye.TWENTY_FOUR_HOURS=ye.TWELVE_HOURS=ye.SIX_HOURS=ye.THREE_HOURS=ye.ONE_HOUR=ye.SIXTY_MINUTES=ye.THIRTY_MINUTES=ye.TEN_MINUTES=ye.FIVE_MINUTES=ye.ONE_MINUTE=ye.SIXTY_SECONDS=ye.THIRTY_SECONDS=ye.TEN_SECONDS=ye.FIVE_SECONDS=ye.ONE_SECOND=void 0;ye.ONE_SECOND=1;ye.FIVE_SECONDS=5;ye.TEN_SECONDS=10;ye.THIRTY_SECONDS=30;ye.SIXTY_SECONDS=60;ye.ONE_MINUTE=ye.SIXTY_SECONDS;ye.FIVE_MINUTES=ye.ONE_MINUTE*5;ye.TEN_MINUTES=ye.ONE_MINUTE*10;ye.THIRTY_MINUTES=ye.ONE_MINUTE*30;ye.SIXTY_MINUTES=ye.ONE_MINUTE*60;ye.ONE_HOUR=ye.SIXTY_MINUTES;ye.THREE_HOURS=ye.ONE_HOUR*3;ye.SIX_HOURS=ye.ONE_HOUR*6;ye.TWELVE_HOURS=ye.ONE_HOUR*12;ye.TWENTY_FOUR_HOURS=ye.ONE_HOUR*24;ye.ONE_DAY=ye.TWENTY_FOUR_HOURS;ye.THREE_DAYS=ye.ONE_DAY*3;ye.FIVE_DAYS=ye.ONE_DAY*5;ye.SEVEN_DAYS=ye.ONE_DAY*7;ye.THIRTY_DAYS=ye.ONE_DAY*30;ye.ONE_WEEK=ye.SEVEN_DAYS;ye.TWO_WEEKS=ye.ONE_WEEK*2;ye.THREE_WEEKS=ye.ONE_WEEK*3;ye.FOUR_WEEKS=ye.ONE_WEEK*4;ye.ONE_YEAR=ye.ONE_DAY*365});var um=B(Eh=>{"use strict";f();Object.defineProperty(Eh,"__esModule",{value:!0});var PC=(br(),at(_r));PC.__exportStar(DC(),Eh);PC.__exportStar(OC(),Eh)});var MC=B(Qa=>{"use strict";f();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.fromMiliseconds=Qa.toMiliseconds=void 0;var BC=um();function S5(r){return r*BC.ONE_THOUSAND}Qa.toMiliseconds=S5;function x5(r){return Math.floor(r/BC.ONE_THOUSAND)}Qa.fromMiliseconds=x5});var LC=B(Ah=>{"use strict";f();Object.defineProperty(Ah,"__esModule",{value:!0});var RC=(br(),at(_r));RC.__exportStar(NC(),Ah);RC.__exportStar(MC(),Ah)});var FC=B(_c=>{"use strict";f();Object.defineProperty(_c,"__esModule",{value:!0});_c.Watch=void 0;var Ih=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 t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let i=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:i})}get(e){let t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};_c.Watch=Ih;_c.default=Ih});var UC=B(_h=>{"use strict";f();Object.defineProperty(_h,"__esModule",{value:!0});_h.IWatch=void 0;var cm=class{};_h.IWatch=cm});var qC=B(lm=>{"use strict";f();Object.defineProperty(lm,"__esModule",{value:!0});var T5=(br(),at(_r));T5.__exportStar(UC(),lm)});var Ys=B(ja=>{"use strict";f();Object.defineProperty(ja,"__esModule",{value:!0});var bh=(br(),at(_r));bh.__exportStar(LC(),ja);bh.__exportStar(FC(),ja);bh.__exportStar(qC(),ja);bh.__exportStar(um(),ja)});var fm,VC=me(()=>{f();fm=class{}});var hm={};ot(hm,{IEvents:()=>fm});var dm=me(()=>{f();VC()});var HC=B(Ch=>{"use strict";f();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.IHeartBeat=void 0;var N5=(dm(),at(hm)),pm=class extends N5.IEvents{constructor(e){super()}};Ch.IHeartBeat=pm});var ym=B(gm=>{"use strict";f();Object.defineProperty(gm,"__esModule",{value:!0});var D5=(br(),at(_r));D5.__exportStar(HC(),gm)});var QC=B(Ga=>{"use strict";f();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.HEARTBEAT_EVENTS=Ga.HEARTBEAT_INTERVAL=void 0;var O5=Ys();Ga.HEARTBEAT_INTERVAL=O5.FIVE_SECONDS;Ga.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var wm=B(mm=>{"use strict";f();Object.defineProperty(mm,"__esModule",{value:!0});var P5=(br(),at(_r));P5.__exportStar(QC(),mm)});var jC=B(Sh=>{"use strict";f();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.HeartBeat=void 0;var vm=(br(),at(_r)),B5=$s(),M5=Ys(),R5=ym(),Em=wm(),bc=class extends R5.IHeartBeat{constructor(e){super(e),this.events=new B5.EventEmitter,this.interval=Em.HEARTBEAT_INTERVAL,this.interval=e?.interval||Em.HEARTBEAT_INTERVAL}static init(e){return vm.__awaiter(this,void 0,void 0,function*(){let t=new bc(e);return yield t.init(),t})}init(){return vm.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return vm.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),M5.toMiliseconds(this.interval))})}pulse(){this.events.emit(Em.HEARTBEAT_EVENTS.pulse)}};Sh.HeartBeat=bc});var GC=B(Cc=>{"use strict";f();Object.defineProperty(Cc,"__esModule",{value:!0});var Am=(br(),at(_r));Am.__exportStar(jC(),Cc);Am.__exportStar(ym(),Cc);Am.__exportStar(wm(),Cc)});var Im=B(Ka=>{"use strict";f();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.PINO_CUSTOM_CONTEXT_KEY=Ka.PINO_LOGGER_DEFAULTS=void 0;Ka.PINO_LOGGER_DEFAULTS={level:"info"};Ka.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var $C=B(vr=>{"use strict";f();Object.defineProperty(vr,"__esModule",{value:!0});vr.generateChildLogger=vr.formatChildLoggerContext=vr.getLoggerContext=vr.setBrowserLoggerContext=vr.getBrowserLoggerContext=vr.getDefaultLoggerOptions=void 0;var za=Im();function L5(r){return Object.assign(Object.assign({},r),{level:r?.level||za.PINO_LOGGER_DEFAULTS.level})}vr.getDefaultLoggerOptions=L5;function KC(r,e=za.PINO_CUSTOM_CONTEXT_KEY){return r[e]||""}vr.getBrowserLoggerContext=KC;function zC(r,e,t=za.PINO_CUSTOM_CONTEXT_KEY){return r[t]=e,r}vr.setBrowserLoggerContext=zC;function kC(r,e=za.PINO_CUSTOM_CONTEXT_KEY){let t="";return typeof r.bindings>"u"?t=KC(r,e):t=r.bindings().context||"",t}vr.getLoggerContext=kC;function WC(r,e,t=za.PINO_CUSTOM_CONTEXT_KEY){let i=kC(r,t);return i.trim()?`${i}/${e}`:e}vr.formatChildLoggerContext=WC;function F5(r,e,t=za.PINO_CUSTOM_CONTEXT_KEY){let i=WC(r,e,t),n=r.child({context:i});return zC(n,i,t)}vr.generateChildLogger=F5});var bm=B(ka=>{"use strict";f();Object.defineProperty(ka,"__esModule",{value:!0});ka.pino=void 0;var _m=(br(),at(_r)),U5=_m.__importDefault(lh());Object.defineProperty(ka,"pino",{enumerable:!0,get:function(){return U5.default}});_m.__exportStar(Im(),ka);_m.__exportStar($C(),ka)});var Hm=B(Wt=>{"use strict";f();Object.defineProperty(Wt,"__esModule",{value:!0});var Wa=(dm(),at(hm)),YC=$s();function q5(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var V5=q5(YC),Cm=class extends Wa.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Sm=class{constructor(e,t,i){this.core=e,this.logger=t}},xm=class extends Wa.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Tm=class{constructor(e,t){this.logger=e,this.core=t}},Nm=class extends Wa.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Dm=class extends Wa.IEvents{constructor(e){super()}},Om=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},Pm=class{constructor(){this.map=new Map}},Bm=class extends Wa.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Mm=class{constructor(e,t){this.core=e,this.logger=t}},Rm=class extends Wa.IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},Lm=class{constructor(e,t){this.logger=e,this.core=t}},Fm=class extends V5.default{constructor(){super()}},Um=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qm=class extends YC.EventEmitter{constructor(){super()}},Vm=class{constructor(e){this.client=e}};Wt.ICore=Cm,Wt.ICrypto=Sm,Wt.IEngine=Vm,Wt.IEngineEvents=qm,Wt.IExpirer=Rm,Wt.IJsonRpcHistory=xm,Wt.IKeyChain=Mm,Wt.IMessageTracker=Tm,Wt.IPairing=Lm,Wt.IPublisher=Nm,Wt.IRelayer=Dm,Wt.ISignClient=Um,Wt.ISignClientEvents=Fm,Wt.IStore=Om,Wt.ISubscriber=Bm,Wt.ISubscriberTopicMap=Pm});var JC={};ot(JC,{safeJsonParse:()=>Sc,safeJsonStringify:()=>xc});function Sc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}function xc(r){return typeof r=="string"?r:JSON.stringify(r)}var xh=me(()=>{f()});var ZC=B(Th=>{"use strict";f();Object.defineProperty(Th,"__esModule",{value:!0});Th.BrowserRandomSource=void 0;var XC=65536,Qm=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 t=new Uint8Array(e);for(let i=0;i{"use strict";f();Object.defineProperty(jm,"__esModule",{value:!0});function H5(r){for(var e=0;e{f()});var tS=B(Nh=>{"use strict";f();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.NodeRandomSource=void 0;var Q5=qr(),Gm=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof PE<"u"){let e=eS();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 t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let i=new Uint8Array(e);for(let n=0;n{"use strict";f();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.SystemRandomSource=void 0;var j5=ZC(),G5=tS(),Km=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new j5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new G5.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)}};Dh.SystemRandomSource=Km});var iS=B(Cr=>{"use strict";f();Object.defineProperty(Cr,"__esModule",{value:!0});function K5(r,e){var t=r>>>16&65535,i=r&65535,n=e>>>16&65535,s=e&65535;return i*s+(t*s+i*n<<16>>>0)|0}Cr.mul=Math.imul||K5;function z5(r,e){return r+e|0}Cr.add=z5;function k5(r,e){return r-e|0}Cr.sub=k5;function W5(r,e){return r<>>32-e}Cr.rotl=W5;function $5(r,e){return r<<32-e|r>>>e}Cr.rotr=$5;function Y5(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}Cr.isInteger=Number.isInteger||Y5;Cr.MAX_SAFE_INTEGER=9007199254740991;Cr.isSafeInteger=function(r){return Cr.isInteger(r)&&r>=-Cr.MAX_SAFE_INTEGER&&r<=Cr.MAX_SAFE_INTEGER}});var $a=B(Oe=>{"use strict";f();Object.defineProperty(Oe,"__esModule",{value:!0});var nS=iS();function J5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Oe.readInt16BE=J5;function X5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Oe.readUint16BE=X5;function Z5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Oe.readInt16LE=Z5;function eF(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Oe.readUint16LE=eF;function sS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Oe.writeUint16BE=sS;Oe.writeInt16BE=sS;function oS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Oe.writeUint16LE=oS;Oe.writeInt16LE=oS;function zm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Oe.readInt32BE=zm;function km(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Oe.readUint32BE=km;function Wm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Oe.readInt32LE=Wm;function $m(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Oe.readUint32LE=$m;function Oh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Oe.writeUint32BE=Oh;Oe.writeInt32BE=Oh;function Ph(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Oe.writeUint32LE=Ph;Oe.writeInt32LE=Ph;function tF(r,e){e===void 0&&(e=0);var t=zm(r,e),i=zm(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Oe.readInt64BE=tF;function rF(r,e){e===void 0&&(e=0);var t=km(r,e),i=km(r,e+4);return t*4294967296+i}Oe.readUint64BE=rF;function iF(r,e){e===void 0&&(e=0);var t=Wm(r,e),i=Wm(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Oe.readInt64LE=iF;function nF(r,e){e===void 0&&(e=0);var t=$m(r,e),i=$m(r,e+4);return i*4294967296+t}Oe.readUint64LE=nF;function aS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Oh(r/4294967296>>>0,e,t),Oh(r>>>0,e,t+4),e}Oe.writeUint64BE=aS;Oe.writeInt64BE=aS;function uS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Ph(r>>>0,e,t),Ph(r/4294967296>>>0,e,t+4),e}Oe.writeUint64LE=uS;Oe.writeInt64LE=uS;function sF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Oe.readUintBE=sF;function oF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s=i;s--)t[s]=e/n&255,n*=256;return t}Oe.writeUintBE=aF;function uF(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nS.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s{"use strict";f();Object.defineProperty(ur,"__esModule",{value:!0});ur.randomStringForEntropy=ur.randomString=ur.randomUint32=ur.randomBytes=ur.defaultRandomSource=void 0;var mF=rS(),wF=$a(),cS=qr();ur.defaultRandomSource=new mF.SystemRandomSource;function Ym(r,e=ur.defaultRandomSource){return e.randomBytes(r)}ur.randomBytes=Ym;function vF(r=ur.defaultRandomSource){let e=Ym(4,r),t=(0,wF.readUint32LE)(e);return(0,cS.wipe)(e),t}ur.randomUint32=vF;var lS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function fS(r,e=lS,t=ur.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 i="",n=e.length,s=256-256%n;for(;r>0;){let o=Ym(Math.ceil(r*256/s),t);for(let a=0;a0;a++){let u=o[a];u{"use strict";f();Object.defineProperty(Zi,"__esModule",{value:!0});var Ja=$a(),Ya=qr();Zi.DIGEST_LENGTH=64;Zi.BLOCK_SIZE=128;var dS=function(){function r(){this.digestLength=Zi.DIGEST_LENGTH,this.blockSize=Zi.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Ya.wipe(this._buffer),Ya.wipe(this._tempHi),Ya.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Ya.wipe(e.stateHi),Ya.wipe(e.stateLo),e.buffer&&Ya.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Zi.SHA512=dS;var hS=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 Jm(r,e,t,i,n,s,o){for(var a=t[0],u=t[1],h=t[2],p=t[3],w=t[4],N=t[5],O=t[6],T=t[7],V=i[0],z=i[1],$=i[2],se=i[3],Y=i[4],j=i[5],W=i[6],k=i[7],R,F,G,ce,J,X,A,c;o>=128;){for(var d=0;d<16;d++){var g=8*d+s;r[d]=Ja.readUint32BE(n,g),e[d]=Ja.readUint32BE(n,g+4)}for(var d=0;d<80;d++){var m=a,v=u,S=h,D=p,I=w,l=N,C=O,Z=T,ie=V,ee=z,ae=$,E=se,b=Y,x=j,L=W,P=k;if(R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(w>>>14|Y<<32-14)^(w>>>18|Y<<32-18)^(Y>>>41-32|w<<32-(41-32)),F=(Y>>>14|w<<32-14)^(Y>>>18|w<<32-18)^(w>>>41-32|Y<<32-(41-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=w&N^~w&O,F=Y&j^~Y&W,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=hS[d*2],F=hS[d*2+1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=r[d%16],F=e[d%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,G=A&65535|c<<16,ce=J&65535|X<<16,R=G,F=ce,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(a>>>28|V<<32-28)^(V>>>34-32|a<<32-(34-32))^(V>>>39-32|a<<32-(39-32)),F=(V>>>28|a<<32-28)^(a>>>34-32|V<<32-(34-32))^(a>>>39-32|V<<32-(39-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=a&u^a&h^u&h,F=V&z^V&$^z&$,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,Z=A&65535|c<<16,P=J&65535|X<<16,R=D,F=E,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=G,F=ce,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,D=A&65535|c<<16,E=J&65535|X<<16,u=m,h=v,p=S,w=D,N=I,O=l,T=C,a=Z,z=ie,$=ee,se=ae,Y=E,j=b,W=x,k=L,V=P,d%16===15)for(var g=0;g<16;g++)R=r[g],F=e[g],J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=r[(g+9)%16],F=e[(g+9)%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+1)%16],ce=e[(g+1)%16],R=(G>>>1|ce<<32-1)^(G>>>8|ce<<32-8)^G>>>7,F=(ce>>>1|G<<32-1)^(ce>>>8|G<<32-8)^(ce>>>7|G<<32-7),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+14)%16],ce=e[(g+14)%16],R=(G>>>19|ce<<32-19)^(ce>>>61-32|G<<32-(61-32))^G>>>6,F=(ce>>>19|G<<32-19)^(G>>>61-32|ce<<32-(61-32))^(ce>>>6|G<<32-6),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,r[g]=A&65535|c<<16,e[g]=J&65535|X<<16}R=a,F=V,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[0],F=i[0],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[0]=a=A&65535|c<<16,i[0]=V=J&65535|X<<16,R=u,F=z,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[1],F=i[1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[1]=u=A&65535|c<<16,i[1]=z=J&65535|X<<16,R=h,F=$,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[2],F=i[2],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[2]=h=A&65535|c<<16,i[2]=$=J&65535|X<<16,R=p,F=se,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[3],F=i[3],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[3]=p=A&65535|c<<16,i[3]=se=J&65535|X<<16,R=w,F=Y,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[4],F=i[4],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[4]=w=A&65535|c<<16,i[4]=Y=J&65535|X<<16,R=N,F=j,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[5],F=i[5],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[5]=N=A&65535|c<<16,i[5]=j=J&65535|X<<16,R=O,F=W,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[6],F=i[6],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[6]=O=A&65535|c<<16,i[6]=W=J&65535|X<<16,R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[7],F=i[7],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[7]=T=A&65535|c<<16,i[7]=k=J&65535|X<<16,s+=128,o-=128}return s}function AF(r){var e=new dS;e.update(r);var t=e.digest();return e.clean(),t}Zi.hash=AF});var TS=B(He=>{"use strict";f();Object.defineProperty(He,"__esModule",{value:!0});He.convertSecretKeyToX25519=He.convertPublicKeyToX25519=He.verify=He.sign=He.extractPublicKeyFromSecretKey=He.generateKeyPair=He.generateKeyPairFromSeed=He.SEED_LENGTH=He.SECRET_KEY_LENGTH=He.PUBLIC_KEY_LENGTH=He.SIGNATURE_LENGTH=void 0;var IF=Tc(),Nc=pS(),vS=qr();He.SIGNATURE_LENGTH=64;He.PUBLIC_KEY_LENGTH=32;He.SECRET_KEY_LENGTH=64;He.SEED_LENGTH=32;function ve(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,ES(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function AS(r,e){let t=0;for(let i=0;i<32;i++)t|=r[i]^e[i];return(1&t-1>>>8)-1}function mS(r,e){let t=new Uint8Array(32),i=new Uint8Array(32);return Dc(t,r),Dc(i,e),AS(t,i)}function IS(r){let e=new Uint8Array(32);return Dc(e,r),e[0]&1}function xF(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function Js(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function Zs(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function Ge(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Xs(r,e){Ge(r,e,e)}function _S(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=253;i>=0;i--)Xs(t,t),i!==2&&i!==4&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function TF(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=250;i>=0;i--)Xs(t,t),i!==1&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function tw(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve(),h=ve(),p=ve();Zs(t,r[1],r[0]),Zs(p,e[1],e[0]),Ge(t,t,p),Js(i,r[0],r[1]),Js(p,e[0],e[1]),Ge(i,i,p),Ge(n,r[3],e[3]),Ge(n,n,CF),Ge(s,r[2],e[2]),Js(s,s,s),Zs(o,i,t),Zs(a,s,n),Js(u,s,n),Js(h,i,t),Ge(r[0],o,a),Ge(r[1],h,u),Ge(r[2],u,a),Ge(r[3],o,h)}function wS(r,e,t){for(let i=0;i<4;i++)ES(r[i],e[i],t)}function iw(r,e){let t=ve(),i=ve(),n=ve();_S(n,e[2]),Ge(t,e[0],n),Ge(i,e[1],n),Dc(r,i),r[31]^=IS(t)<<7}function bS(r,e,t){Ln(r[0],ew),Ln(r[1],Xa),Ln(r[2],Xa),Ln(r[3],ew);for(let i=255;i>=0;--i){let n=t[i/8|0]>>(i&7)&1;wS(r,e,n),tw(e,r),tw(r,r),wS(r,e,n)}}function nw(r,e){let t=[ve(),ve(),ve(),ve()];Ln(t[0],gS),Ln(t[1],yS),Ln(t[2],Xa),Ge(t[3],gS,yS),bS(r,t,e)}function CS(r){if(r.length!==He.SEED_LENGTH)throw new Error(`ed25519: seed must be ${He.SEED_LENGTH} bytes`);let e=(0,Nc.hash)(r);e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(32),i=[ve(),ve(),ve(),ve()];nw(i,e),iw(t,i);let n=new Uint8Array(64);return n.set(r),n.set(t,32),{publicKey:t,secretKey:n}}He.generateKeyPairFromSeed=CS;function NF(r){let e=(0,IF.randomBytes)(32,r),t=CS(e);return(0,vS.wipe)(e),t}He.generateKeyPair=NF;function DF(r){if(r.length!==He.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${He.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))}He.extractPublicKeyFromSecretKey=DF;var Zm=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 SS(r,e){let t,i,n,s;for(i=63;i>=32;--i){for(t=0,n=i-32,s=i-12;n>4)*Zm[n],t=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=t*Zm[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,r[i]=e[i]&255}function rw(r){let e=new Float64Array(64);for(let t=0;t<64;t++)e[t]=r[t];for(let t=0;t<64;t++)r[t]=0;SS(r,e)}function OF(r,e){let t=new Float64Array(64),i=[ve(),ve(),ve(),ve()],n=(0,Nc.hash)(r.subarray(0,32));n[0]&=248,n[31]&=127,n[31]|=64;let s=new Uint8Array(64);s.set(n.subarray(32),32);let o=new Nc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),rw(a),nw(i,a),iw(s,i),o.reset(),o.update(s.subarray(0,32)),o.update(r.subarray(32)),o.update(e);let u=o.digest();rw(u);for(let h=0;h<32;h++)t[h]=a[h];for(let h=0;h<32;h++)for(let p=0;p<32;p++)t[h+p]+=u[h]*n[p];return SS(s.subarray(32),t),s}He.sign=OF;function xS(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve();return Ln(r[2],Xa),xF(r[1],e),Xs(n,r[1]),Ge(s,n,bF),Zs(n,n,r[2]),Js(s,r[2],s),Xs(o,s),Xs(a,o),Ge(u,a,o),Ge(t,u,n),Ge(t,t,s),TF(t,t),Ge(t,t,n),Ge(t,t,s),Ge(t,t,s),Ge(r[0],t,s),Xs(i,r[0]),Ge(i,i,s),mS(i,n)&&Ge(r[0],r[0],SF),Xs(i,r[0]),Ge(i,i,s),mS(i,n)?-1:(IS(r[0])===e[31]>>7&&Zs(r[0],ew,r[0]),Ge(r[3],r[0],r[1]),0)}function PF(r,e,t){let i=new Uint8Array(32),n=[ve(),ve(),ve(),ve()],s=[ve(),ve(),ve(),ve()];if(t.length!==He.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${He.SIGNATURE_LENGTH} bytes`);if(xS(s,r))return!1;let o=new Nc.SHA512;o.update(t.subarray(0,32)),o.update(r),o.update(e);let a=o.digest();return rw(a),bS(n,s,a),nw(s,t.subarray(32)),tw(n,s),iw(i,n),!AS(t,i)}He.verify=PF;function BF(r){let e=[ve(),ve(),ve(),ve()];if(xS(e,r))throw new Error("Ed25519: invalid public key");let t=ve(),i=ve(),n=e[1];Js(t,Xa,n),Zs(i,Xa,n),_S(i,i),Ge(t,t,i);let s=new Uint8Array(32);return Dc(s,t),s}He.convertPublicKeyToX25519=BF;function MF(r){let e=(0,Nc.hash)(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(e.subarray(0,32));return(0,vS.wipe)(e),t}He.convertSecretKeyToX25519=MF});var Bh,Mh,eo,Za,Rh,Oc,Lh,Fh,Uh,eu,qh,Vh,NS,DS,Hh=me(()=>{f();Bh="EdDSA",Mh="JWT",eo=".",Za="base64url",Rh="utf8",Oc="utf8",Lh=":",Fh="did",Uh="key",eu="base58btc",qh="z",Vh="K36",NS=32,DS=32});function tu(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Qh=me(()=>{f()});function jh(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));let t=tu(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var sw=me(()=>{f();Qh()});function RF(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var LF,FF,OS,PS=me(()=>{f();LF=RF,FF=LF,OS=FF});var iX,BS,en,MS,RS,Fn=me(()=>{f();iX=new Uint8Array(0),BS=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},MS=r=>new TextEncoder().encode(r),RS=r=>new TextDecoder().decode(r)});var ow,aw,uw,FS,cw,ru,Un,UF,qF,ut,Xr=me(()=>{f();PS();Fn();ow=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},aw=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 FS(this,e)}},uw=class{constructor(e){this.decoders=e}or(e){return FS(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FS=(r,e)=>new uw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),cw=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new ow(e,t,i),this.decoder=new aw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ru=({name:r,prefix:e,encode:t,decode:i})=>new cw(r,e,t,i),Un=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=OS(t,e);return ru({prefix:r,name:e,encode:i,decode:s=>en(n(s))})},UF=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},qF=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<ru({prefix:e,name:r,encode(n){return qF(n,i,t)},decode(n){return UF(n,i,t,r)}})});var lw={};ot(lw,{identity:()=>VF});var VF,US=me(()=>{f();Xr();Fn();VF=ru({prefix:"\0",name:"identity",encode:r=>RS(r),decode:r=>MS(r)})});var fw={};ot(fw,{base2:()=>HF});var HF,qS=me(()=>{f();Xr();HF=ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var hw={};ot(hw,{base8:()=>QF});var QF,VS=me(()=>{f();Xr();QF=ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var dw={};ot(dw,{base10:()=>jF});var jF,HS=me(()=>{f();Xr();jF=Un({prefix:"9",name:"base10",alphabet:"0123456789"})});var pw={};ot(pw,{base16:()=>GF,base16upper:()=>KF});var GF,KF,QS=me(()=>{f();Xr();GF=ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),KF=ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var gw={};ot(gw,{base32:()=>iu,base32hex:()=>$F,base32hexpad:()=>JF,base32hexpadupper:()=>XF,base32hexupper:()=>YF,base32pad:()=>kF,base32padupper:()=>WF,base32upper:()=>zF,base32z:()=>ZF});var iu,zF,kF,WF,$F,YF,JF,XF,ZF,yw=me(()=>{f();Xr();iu=ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),zF=ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kF=ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),WF=ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$F=ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),YF=ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),JF=ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),XF=ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ZF=ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var mw={};ot(mw,{base36:()=>e4,base36upper:()=>t4});var e4,t4,jS=me(()=>{f();Xr();e4=Un({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),t4=Un({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var ww={};ot(ww,{base58btc:()=>Ni,base58flickr:()=>r4});var Ni,r4,vw=me(()=>{f();Xr();Ni=Un({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),r4=Un({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Ew={};ot(Ew,{base64:()=>i4,base64pad:()=>n4,base64url:()=>s4,base64urlpad:()=>o4});var i4,n4,s4,o4,GS=me(()=>{f();Xr();i4=ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),n4=ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s4=ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),o4=ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Aw={};ot(Aw,{base256emoji:()=>f4});function c4(r){return r.reduce((e,t)=>(e+=a4[t],e),"")}function l4(r){let e=[];for(let t of r){let i=u4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var KS,a4,u4,f4,zS=me(()=>{f();Xr();KS=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}"),a4=KS.reduce((r,e,t)=>(r[t]=e,r),[]),u4=KS.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);f4=ru({prefix:"\u{1F680}",name:"base256emoji",encode:c4,decode:l4})});function $S(r,e,t){e=e||[],t=t||0;for(var i=t;r>=g4;)e[t++]=r&255|kS,r/=128;for(;r&p4;)e[t++]=r&255|kS,r>>>=7;return e[t]=r|0,$S.bytes=t-i+1,e}function Iw(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Iw.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WS)<=m4);return Iw.bytes=s-i,t}var h4,kS,d4,p4,g4,y4,m4,WS,w4,v4,E4,A4,I4,_4,b4,C4,S4,x4,T4,N4,Pc,YS=me(()=>{f();h4=$S,kS=128,d4=127,p4=~d4,g4=Math.pow(2,31);y4=Iw,m4=128,WS=127;w4=Math.pow(2,7),v4=Math.pow(2,14),E4=Math.pow(2,21),A4=Math.pow(2,28),I4=Math.pow(2,35),_4=Math.pow(2,42),b4=Math.pow(2,49),C4=Math.pow(2,56),S4=Math.pow(2,63),x4=function(r){return r{f();YS();Bc=(r,e=0)=>[Pc.decode(r,e),Pc.decode.bytes],nu=(r,e,t=0)=>(Pc.encode(r,e,t),e),su=r=>Pc.encodingLength(r)});var to,JS,XS,ou,Rc=me(()=>{f();Fn();Kh();to=(r,e)=>{let t=e.byteLength,i=su(r),n=i+su(t),s=new Uint8Array(n+t);return nu(r,s,0),nu(t,s,i),s.set(e,n),new ou(r,t,e,s)},JS=r=>{let e=en(r),[t,i]=Bc(e),[n,s]=Bc(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new ou(t,n,o,e)},XS=(r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&BS(r.bytes,e.bytes),ou=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}});var bw,_w,Cw=me(()=>{f();Rc();bw=({name:r,code:e,encode:t})=>new _w(r,e,t),_w=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?to(this.code,t):t.then(i=>to(this.code,i))}else throw Error("Unknown type, must be binary type")}}});var Sw={};ot(Sw,{sha256:()=>D4,sha512:()=>O4});var ex,D4,O4,tx=me(()=>{f();Cw();ex=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),D4=bw({name:"sha2-256",code:18,encode:ex("SHA-256")}),O4=bw({name:"sha2-512",code:19,encode:ex("SHA-512")})});var xw={};ot(xw,{identity:()=>M4});var rx,P4,ix,B4,M4,nx=me(()=>{f();Fn();Rc();rx=0,P4="identity",ix=en,B4=r=>to(rx,ix(r)),M4={code:rx,name:P4,encode:ix,digest:B4}});var sx=me(()=>{f();Fn()});var jX,GX,ox=me(()=>{f();jX=new TextEncoder,GX=new TextDecoder});var Vt,F4,U4,q4,Lc,V4,ax,ux,zh,kh,H4,Q4,j4,cx=me(()=>{f();Kh();Rc();vw();yw();Fn();Vt=class{constructor(e,t,i,n){this.code=t,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:kh,byteLength:kh,code:zh,version:zh,multihash:zh,bytes:zh,_baseCache:kh,asCID:kh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Lc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==V4)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Vt.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,i=to(e,t);return Vt.createV1(this.code,i)}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&&XS(this.multihash,e.multihash)}toString(e){let{bytes:t,version:i,_baseCache:n}=this;switch(i){case 0:return U4(t,n,e||Ni.encoder);default:return q4(t,n,e||iu.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 Q4(/^0\.0/,j4),!!(e&&(e[ux]||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 Vt)return e;if(e!=null&&e.asCID===e){let{version:t,code:i,multihash:n,bytes:s}=e;return new Vt(t,i,n,s||ax(t,i,n.bytes))}else if(e!=null&&e[ux]===!0){let{version:t,multihash:i,code:n}=e,s=JS(i);return Vt.create(t,n,s)}else return null}static create(e,t,i){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Lc)throw new Error(`Version 0 CID must use dag-pb (code: ${Lc}) block encoding`);return new Vt(e,t,i,i.bytes)}case 1:{let n=ax(e,t,i.bytes);return new Vt(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return Vt.create(0,Lc,e)}static createV1(e,t){return Vt.create(1,e,t)}static decode(e){let[t,i]=Vt.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Vt.inspectBytes(e),i=t.size-t.multihashSize,n=en(e.subarray(i,i+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),o=new ou(t.multihashCode,t.digestSize,s,n);return[t.version===0?Vt.createV0(o):Vt.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,i=()=>{let[w,N]=Bc(e.subarray(t));return t+=N,w},n=i(),s=Lc;if(n===18?(n=0,t=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=t,a=i(),u=i(),h=t+u,p=h-o;return{version:n,codec:s,multihashCode:a,digestSize:u,multihashSize:p,size:h}}static parse(e,t){let[i,n]=F4(e,t),s=Vt.decode(n);return s._baseCache.set(i,e),s}},F4=(r,e)=>{switch(r[0]){case"Q":{let t=e||Ni;return[Ni.prefix,t.decode(`${Ni.prefix}${r}`)]}case Ni.prefix:{let t=e||Ni;return[Ni.prefix,t.decode(r)]}case iu.prefix:{let t=e||iu;return[iu.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},U4=(r,e,t)=>{let{prefix:i}=t;if(i!==Ni.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(i);if(n==null){let s=t.encode(r).slice(1);return e.set(i,s),s}else return n},q4=(r,e,t)=>{let{prefix:i}=t,n=e.get(i);if(n==null){let s=t.encode(r);return e.set(i,s),s}else return n},Lc=112,V4=18,ax=(r,e,t)=>{let i=su(r),n=i+su(e),s=new Uint8Array(n+t.byteLength);return nu(r,s,0),nu(e,s,i),s.set(t,n),s},ux=Symbol.for("@ipld/js-cid/CID"),zh={writable:!1,configurable:!1,enumerable:!0},kh={writable:!1,enumerable:!1,configurable:!1},H4="0.0.0-dev",Q4=(r,e)=>{if(r.test(H4))console.warn(e);else throw new Error(e)},j4=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -20,20 +20,20 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var lx=me(()=>{f();cx();Kh();Ln();Cw();Rc()});var Tw,eZ,fx=me(()=>{f();US();qS();VS();HS();QS();yw();jS();vw();GS();zS();tx();nx();sx();ox();lx();Tw={...lw,...fw,...hw,...dw,...pw,...gw,...mw,...ww,...Ew,...Aw},eZ={...Sw,...xw}});function dx(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var hx,Nw,j4,Wh,Dw=me(()=>{f();fx();Qh();hx=dx("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Nw=dx("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=eu(r.length);for(let t=0;t{f();Dw()});function Di(r,e="utf8"){let t=Wh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}var Pw=me(()=>{f();Dw()});function Fc(r){return Sc(en(Di(r,Xa),Rh))}function Uc(r){return en(Di(xc(r),Rh),Xa)}function Bw(r){let e=Di(Vh,Za),t=qh+en(jh([e,r]),Za);return[Fh,Uh,t].join(Lh)}function Mw(r){let[e,t,i]=r.split(Lh);if(e!==Fh||t!==Uh)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==qh)throw new Error("Issuer must be a key in mulicodec format");let s=Di(i.slice(1),Za);if(en(s.slice(0,2),Za)!==Vh)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 px(r){return en(r,Xa)}function gx(r){return Di(r,Xa)}function Rw(r){return Di([Uc(r.header),Uc(r.payload)].join(eo),Oc)}function G4(r){let e=en(r,Oc).split(eo),t=Fc(e[0]),i=Fc(e[1]);return{header:t,payload:i}}function Lw(r){return[Uc(r.header),Uc(r.payload),px(r.signature)].join(eo)}function Fw(r){let e=r.split(eo),t=Fc(e[0]),i=Fc(e[1]),n=gx(e[2]),s=Di(e.slice(0,2).join(eo),Oc);return{header:t,payload:i,signature:n,data:s}}var Uw=me(()=>{f();sw();Ow();Pw();xh();Hh()});function K4(r=(0,yx.randomBytes)(32)){return ou.generateKeyPairFromSeed(r)}async function z4(r,e,t,i,n=(0,mx.fromMiliseconds)(Date.now())){let s={alg:Bh,typ:Mh},o=Bw(i.publicKey),a=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:a},h=Rw({header:s,payload:u}),p=ou.sign(i.secretKey,h);return Lw({header:s,payload:u,signature:p})}async function k4(r){let{header:e,payload:t,data:i,signature:n}=Fw(r);if(e.alg!==Bh||e.typ!==Mh)throw new Error("JWT must use EdDSA algorithm");let s=Mw(t.iss);return ou.verify(s,i,n)}var ou,yx,mx,wx=me(()=>{f();ou=_e(TS()),yx=_e(Tc()),mx=_e(Ys());Hh();Uw()});var vx=me(()=>{f()});var Ex={};ot(Ex,{DATA_ENCODING:()=>Oc,DID_DELIMITER:()=>Lh,DID_METHOD:()=>Uh,DID_PREFIX:()=>Fh,JSON_ENCODING:()=>Rh,JWT_DELIMITER:()=>eo,JWT_ENCODING:()=>Xa,JWT_IRIDIUM_ALG:()=>Bh,JWT_IRIDIUM_TYP:()=>Mh,KEY_PAIR_SEED_LENGTH:()=>DS,MULTICODEC_ED25519_BASE:()=>qh,MULTICODEC_ED25519_ENCODING:()=>Za,MULTICODEC_ED25519_HEADER:()=>Vh,MULTICODEC_ED25519_LENGTH:()=>NS,decodeData:()=>G4,decodeIss:()=>Mw,decodeJSON:()=>Fc,decodeJWT:()=>Fw,decodeSig:()=>gx,encodeData:()=>Rw,encodeIss:()=>Bw,encodeJSON:()=>Uc,encodeJWT:()=>Lw,encodeSig:()=>px,generateKeyPair:()=>K4,signJWT:()=>z4,verifyJWT:()=>k4});var Ax=me(()=>{f();wx();Hh();vx();Uw()});var _x=B($h=>{"use strict";f();Object.defineProperty($h,"__esModule",{value:!0});var cr=Wa(),qw=qr(),W4=20;function $4(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],N=t[23]<<24|t[22]<<16|t[21]<<8|t[20],O=t[27]<<24|t[26]<<16|t[25]<<8|t[24],T=t[31]<<24|t[30]<<16|t[29]<<8|t[28],V=e[3]<<24|e[2]<<16|e[1]<<8|e[0],z=e[7]<<24|e[6]<<16|e[5]<<8|e[4],$=e[11]<<24|e[10]<<16|e[9]<<8|e[8],se=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,j=n,W=s,k=o,R=a,F=u,G=h,ce=p,J=w,X=N,A=O,c=T,d=V,g=z,m=$,v=se,S=0;S>>32-16|d<<16,J=J+d|0,R^=J,R=R>>>32-12|R<<12,j=j+F|0,g^=j,g=g>>>32-16|g<<16,X=X+g|0,F^=X,F=F>>>32-12|F<<12,W=W+G|0,m^=W,m=m>>>32-16|m<<16,A=A+m|0,G^=A,G=G>>>32-12|G<<12,k=k+ce|0,v^=k,v=v>>>32-16|v<<16,c=c+v|0,ce^=c,ce=ce>>>32-12|ce<<12,W=W+G|0,m^=W,m=m>>>32-8|m<<8,A=A+m|0,G^=A,G=G>>>32-7|G<<7,k=k+ce|0,v^=k,v=v>>>32-8|v<<8,c=c+v|0,ce^=c,ce=ce>>>32-7|ce<<7,j=j+F|0,g^=j,g=g>>>32-8|g<<8,X=X+g|0,F^=X,F=F>>>32-7|F<<7,Y=Y+R|0,d^=Y,d=d>>>32-8|d<<8,J=J+d|0,R^=J,R=R>>>32-7|R<<7,Y=Y+F|0,v^=Y,v=v>>>32-16|v<<16,A=A+v|0,F^=A,F=F>>>32-12|F<<12,j=j+G|0,d^=j,d=d>>>32-16|d<<16,c=c+d|0,G^=c,G=G>>>32-12|G<<12,W=W+ce|0,g^=W,g=g>>>32-16|g<<16,J=J+g|0,ce^=J,ce=ce>>>32-12|ce<<12,k=k+R|0,m^=k,m=m>>>32-16|m<<16,X=X+m|0,R^=X,R=R>>>32-12|R<<12,W=W+ce|0,g^=W,g=g>>>32-8|g<<8,J=J+g|0,ce^=J,ce=ce>>>32-7|ce<<7,k=k+R|0,m^=k,m=m>>>32-8|m<<8,X=X+m|0,R^=X,R=R>>>32-7|R<<7,j=j+G|0,d^=j,d=d>>>32-8|d<<8,c=c+d|0,G^=c,G=G>>>32-7|G<<7,Y=Y+F|0,v^=Y,v=v>>>32-8|v<<8,A=A+v|0,F^=A,F=F>>>32-7|F<<7;cr.writeUint32LE(Y+i|0,r,0),cr.writeUint32LE(j+n|0,r,4),cr.writeUint32LE(W+s|0,r,8),cr.writeUint32LE(k+o|0,r,12),cr.writeUint32LE(R+a|0,r,16),cr.writeUint32LE(F+u|0,r,20),cr.writeUint32LE(G+h|0,r,24),cr.writeUint32LE(ce+p|0,r,28),cr.writeUint32LE(J+w|0,r,32),cr.writeUint32LE(X+N|0,r,36),cr.writeUint32LE(A+O|0,r,40),cr.writeUint32LE(c+T|0,r,44),cr.writeUint32LE(d+V|0,r,48),cr.writeUint32LE(g+z|0,r,52),cr.writeUint32LE(m+$|0,r,56),cr.writeUint32LE(v+se|0,r,60)}function Ix(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var Yh=B(au=>{"use strict";f();Object.defineProperty(au,"__esModule",{value:!0});function X4(r,e,t){return~(r-1)&e|r-1&t}au.select=X4;function Z4(r,e){return(r|0)-(e|0)-1>>>31&1}au.lessOrEqual=Z4;function bx(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}au.compare=bx;function eU(r,e){return r.length===0||e.length===0?!1:bx(r,e)!==0}au.equal=eU});var Sx=B(tn=>{"use strict";f();Object.defineProperty(tn,"__esModule",{value:!0});var tU=Yh(),Jh=qr();tn.DIGEST_LENGTH=16;var Cx=function(){function r(e){this.digestLength=tn.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 t=e[0]|e[1]<<8;this._r[0]=t&8191;var i=e[2]|e[3]<<8;this._r[1]=(t>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>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 h=e[14]|e[15]<<8;this._r[8]=(u>>>8|h<<8)&8191,this._r[9]=h>>>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 r.prototype._blocks=function(e,t,i){for(var n=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],h=this._h[4],p=this._h[5],w=this._h[6],N=this._h[7],O=this._h[8],T=this._h[9],V=this._r[0],z=this._r[1],$=this._r[2],se=this._r[3],Y=this._r[4],j=this._r[5],W=this._r[6],k=this._r[7],R=this._r[8],F=this._r[9];i>=16;){var G=e[t+0]|e[t+1]<<8;s+=G&8191;var ce=e[t+2]|e[t+3]<<8;o+=(G>>>13|ce<<3)&8191;var J=e[t+4]|e[t+5]<<8;a+=(ce>>>10|J<<6)&8191;var X=e[t+6]|e[t+7]<<8;u+=(J>>>7|X<<9)&8191;var A=e[t+8]|e[t+9]<<8;h+=(X>>>4|A<<12)&8191,p+=A>>>1&8191;var c=e[t+10]|e[t+11]<<8;w+=(A>>>14|c<<2)&8191;var d=e[t+12]|e[t+13]<<8;N+=(c>>>11|d<<5)&8191;var g=e[t+14]|e[t+15]<<8;O+=(d>>>8|g<<8)&8191,T+=g>>>5|n;var m=0,v=m;v+=s*V,v+=o*(5*F),v+=a*(5*R),v+=u*(5*k),v+=h*(5*W),m=v>>>13,v&=8191,v+=p*(5*j),v+=w*(5*Y),v+=N*(5*se),v+=O*(5*$),v+=T*(5*z),m+=v>>>13,v&=8191;var S=m;S+=s*z,S+=o*V,S+=a*(5*F),S+=u*(5*R),S+=h*(5*k),m=S>>>13,S&=8191,S+=p*(5*W),S+=w*(5*j),S+=N*(5*Y),S+=O*(5*se),S+=T*(5*$),m+=S>>>13,S&=8191;var D=m;D+=s*$,D+=o*z,D+=a*V,D+=u*(5*F),D+=h*(5*R),m=D>>>13,D&=8191,D+=p*(5*k),D+=w*(5*W),D+=N*(5*j),D+=O*(5*Y),D+=T*(5*se),m+=D>>>13,D&=8191;var I=m;I+=s*se,I+=o*$,I+=a*z,I+=u*V,I+=h*(5*F),m=I>>>13,I&=8191,I+=p*(5*R),I+=w*(5*k),I+=N*(5*W),I+=O*(5*j),I+=T*(5*Y),m+=I>>>13,I&=8191;var l=m;l+=s*Y,l+=o*se,l+=a*$,l+=u*z,l+=h*V,m=l>>>13,l&=8191,l+=p*(5*F),l+=w*(5*R),l+=N*(5*k),l+=O*(5*W),l+=T*(5*j),m+=l>>>13,l&=8191;var C=m;C+=s*j,C+=o*Y,C+=a*se,C+=u*$,C+=h*z,m=C>>>13,C&=8191,C+=p*V,C+=w*(5*F),C+=N*(5*R),C+=O*(5*k),C+=T*(5*W),m+=C>>>13,C&=8191;var Z=m;Z+=s*W,Z+=o*j,Z+=a*Y,Z+=u*se,Z+=h*$,m=Z>>>13,Z&=8191,Z+=p*z,Z+=w*V,Z+=N*(5*F),Z+=O*(5*R),Z+=T*(5*k),m+=Z>>>13,Z&=8191;var ie=m;ie+=s*k,ie+=o*W,ie+=a*j,ie+=u*Y,ie+=h*se,m=ie>>>13,ie&=8191,ie+=p*$,ie+=w*z,ie+=N*V,ie+=O*(5*F),ie+=T*(5*R),m+=ie>>>13,ie&=8191;var ee=m;ee+=s*R,ee+=o*k,ee+=a*W,ee+=u*j,ee+=h*Y,m=ee>>>13,ee&=8191,ee+=p*se,ee+=w*$,ee+=N*z,ee+=O*V,ee+=T*(5*F),m+=ee>>>13,ee&=8191;var ae=m;ae+=s*F,ae+=o*R,ae+=a*k,ae+=u*W,ae+=h*j,m=ae>>>13,ae&=8191,ae+=p*Y,ae+=w*se,ae+=N*$,ae+=O*z,ae+=T*V,m+=ae>>>13,ae&=8191,m=(m<<2)+m|0,m=m+v|0,v=m&8191,m=m>>>13,S+=m,s=v,o=S,a=D,u=I,h=l,p=C,w=Z,N=ie,O=ee,T=ae,t+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=h,this._h[5]=p,this._h[6]=w,this._h[7]=N,this._h[8]=O,this._h[9]=T},r.prototype.finish=function(e,t){t===void 0&&(t=0);var i=new Uint16Array(10),n,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(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[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[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s=16&&(n=i-i%16,this._blocks(e,t,n),t+=n,i-=n),i){for(var s=0;s{"use strict";f();Object.defineProperty(rn,"__esModule",{value:!0});var Xh=_x(),nU=Sx(),qc=qr(),xx=Wa(),sU=Yh();rn.KEY_LENGTH=32;rn.NONCE_LENGTH=12;rn.TAG_LENGTH=16;var Tx=new Uint8Array(16),oU=function(){function r(e){if(this.nonceLength=rn.NONCE_LENGTH,this.tagLength=rn.TAG_LENGTH,e.length!==rn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return r.prototype.seal=function(e,t,i,n){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);Xh.stream(this._key,s,o,4);var a=t.length+this.tagLength,u;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(a);return Xh.streamXOR(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),i),qc.wipe(s),u},r.prototype.open=function(e,t,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(Tx.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(Tx.subarray(i.length%16));var o=new Uint8Array(8);n&&xx.writeUint64LE(n.length,o),s.update(o),xx.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";f();Object.defineProperty(Vw,"__esModule",{value:!0});function aU(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Vw.isSerializableHash=aU});var Px=B(Vc=>{"use strict";f();Object.defineProperty(Vc,"__esModule",{value:!0});var Oi=Dx(),uU=Yh(),cU=qr(),Ox=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n{"use strict";f();Object.defineProperty(Hw,"__esModule",{value:!0});var Bx=Px(),Mx=qr(),fU=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Bx.hmac(this._hash,i,t);this._hmac=new Bx.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i{"use strict";f();Object.defineProperty(Un,"__esModule",{value:!0});var ed=Wa(),Zh=qr();Un.DIGEST_LENGTH=32;Un.BLOCK_SIZE=64;var Lx=function(){function r(){this.digestLength=Un.DIGEST_LENGTH,this.blockSize=Un.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Zh.wipe(this._buffer),Zh.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Qw(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Qw(this._temp,this._state,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Zh.wipe(e.state),e.buffer&&Zh.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Un.SHA256=Lx;var hU=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 Qw(r,e,t,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],h=e[4],p=e[5],w=e[6],N=e[7],O=0;O<16;O++){var T=i+O*4;r[O]=ed.readUint32BE(t,T)}for(var O=16;O<64;O++){var V=r[O-2],z=(V>>>17|V<<32-17)^(V>>>19|V<<32-19)^V>>>10;V=r[O-15];var $=(V>>>7|V<<32-7)^(V>>>18|V<<32-18)^V>>>3;r[O]=(z+r[O-7]|0)+($+r[O-16]|0)}for(var O=0;O<64;O++){var z=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&p^~h&w)|0)+(N+(hU[O]+r[O]|0)|0)|0,$=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;N=w,w=p,p=h,h=u+z|0,u=a,a=o,o=s,s=z+$|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=h,e[5]+=p,e[6]+=w,e[7]+=N,i+=64,n-=64}return i}function dU(r){var e=new Lx;e.update(r);var t=e.digest();return e.clean(),t}Un.hash=dU});var Hx=B(ct=>{"use strict";f();Object.defineProperty(ct,"__esModule",{value:!0});ct.sharedKey=ct.generateKeyPair=ct.generateKeyPairFromSeed=ct.scalarMultBase=ct.scalarMult=ct.SHARED_KEY_LENGTH=ct.SECRET_KEY_LENGTH=ct.PUBLIC_KEY_LENGTH=void 0;var pU=Tc(),gU=qr();ct.PUBLIC_KEY_LENGTH=32;ct.SECRET_KEY_LENGTH=32;ct.SHARED_KEY_LENGTH=32;function Pi(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,Hc(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function wU(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function td(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function rd(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function nn(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Qc(r,e){nn(r,e,e)}function vU(r,e){let t=Pi();for(let i=0;i<16;i++)t[i]=e[i];for(let i=253;i>=0;i--)Qc(t,t),i!==2&&i!==4&&nn(t,t,e);for(let i=0;i<16;i++)r[i]=t[i]}function Gw(r,e){let t=new Uint8Array(32),i=new Float64Array(80),n=Pi(),s=Pi(),o=Pi(),a=Pi(),u=Pi(),h=Pi();for(let O=0;O<31;O++)t[O]=r[O];t[31]=r[31]&127|64,t[0]&=248,wU(i,e);for(let O=0;O<16;O++)s[O]=i[O];n[0]=a[0]=1;for(let O=254;O>=0;--O){let T=t[O>>>3]>>>(O&7)&1;Hc(n,s,T),Hc(o,a,T),td(u,n,o),rd(n,n,o),td(o,s,a),rd(s,s,a),Qc(a,u),Qc(h,n),nn(n,o,n),nn(o,s,u),td(u,n,o),rd(n,n,o),Qc(s,n),rd(o,a,h),nn(n,o,yU),td(n,n,a),nn(o,o,n),nn(n,a,h),nn(a,s,i),Qc(s,u),Hc(n,s,T),Hc(o,a,T)}for(let O=0;O<16;O++)i[O+16]=n[O],i[O+32]=o[O],i[O+48]=s[O],i[O+64]=a[O];let p=i.subarray(32),w=i.subarray(16);vU(p,p),nn(w,w,p);let N=new Uint8Array(32);return mU(N,w),N}ct.scalarMult=Gw;function qx(r){return Gw(r,Ux)}ct.scalarMultBase=qx;function Vx(r){if(r.length!==ct.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${ct.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(r);return{publicKey:qx(e),secretKey:e}}ct.generateKeyPairFromSeed=Vx;function EU(r){let e=(0,pU.randomBytes)(32,r),t=Vx(e);return(0,gU.wipe)(e),t}ct.generateKeyPair=EU;function AU(r,e,t=!1){if(r.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let i=Gw(r,e);if(t){let n=0;for(let s=0;se[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength{f()});function Gx(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{f()});function zx(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=eu(r.length);for(let i=0;i{f();Qh()});var Wx={};ot(Wx,{compare:()=>Qx,concat:()=>jh,equals:()=>Gx,fromString:()=>Di,toString:()=>en,xor:()=>zx});var $x=me(()=>{f();jx();sw();Kx();Pw();Ow();kx()});var a2=B(it=>{"use strict";f();var Yx=it&&it.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new i2:typeof navigator<"u"?Kw(navigator.userAgent):o2()}it.detect=CU;function n2(r){return r!==""&&bU.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function SU(r){var e=n2(r);return e?e[0]:null}it.browserName=SU;function Kw(r){var e=n2(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new r2;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length{"use strict";f();Object.defineProperty(We,"__esModule",{value:!0});We.getLocalStorage=We.getLocalStorageOrThrow=We.getCrypto=We.getCryptoOrThrow=We.getLocation=We.getLocationOrThrow=We.getNavigator=We.getNavigatorOrThrow=We.getDocument=We.getDocumentOrThrow=We.getFromWindowOrThrow=We.getFromWindow=void 0;function ro(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}We.getFromWindow=ro;function uu(r){let e=ro(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}We.getFromWindowOrThrow=uu;function TU(){return uu("document")}We.getDocumentOrThrow=TU;function NU(){return ro("document")}We.getDocument=NU;function DU(){return uu("navigator")}We.getNavigatorOrThrow=DU;function OU(){return ro("navigator")}We.getNavigator=OU;function PU(){return uu("location")}We.getLocationOrThrow=PU;function BU(){return ro("location")}We.getLocation=BU;function MU(){return uu("crypto")}We.getCryptoOrThrow=MU;function RU(){return ro("crypto")}We.getCrypto=RU;function LU(){return uu("localStorage")}We.getLocalStorageOrThrow=LU;function FU(){return ro("localStorage")}We.getLocalStorage=FU});var c2=B(id=>{"use strict";f();Object.defineProperty(id,"__esModule",{value:!0});id.getWindowMetadata=void 0;var u2=zw();function UU(){let r,e;try{r=u2.getDocumentOrThrow(),e=u2.getLocationOrThrow()}catch{return null}function t(){let w=r.getElementsByTagName("link"),N=[];for(let O=0;O-1){let z=T.getAttribute("href");if(z)if(z.toLowerCase().indexOf("https:")===-1&&z.toLowerCase().indexOf("http:")===-1&&z.indexOf("//")!==0){let $=e.protocol+"//"+e.host;if(z.indexOf("/")===0)$+=z;else{let se=e.pathname.split("/");se.pop();let Y=se.join("/");$+=Y+"/"+z}N.push($)}else if(z.indexOf("//")===0){let $=e.protocol+z;N.push($)}else N.push(z)}}return N}function i(...w){let N=r.getElementsByTagName("meta");for(let O=0;OT.getAttribute(z)).filter(z=>z?w.includes(z):!1);if(V.length&&V){let z=T.getAttribute("content");if(z)return z}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}let o=n(),a=s(),u=e.origin,h=t();return{description:a,url:u,icons:h,name:o}}id.getWindowMetadata=UU});var f2=B((pee,l2)=>{"use strict";f();l2.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var y2=B((yee,g2)=>{"use strict";f();var p2="%[a-f0-9]{2}",h2=new RegExp("("+p2+")|([^%]+?)","gi"),d2=new RegExp("("+p2+")+","gi");function kw(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],kw(t),kw(i))}function qU(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(h2)||[],t=1;t{"use strict";f();m2.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var E2=B((Eee,v2)=>{"use strict";f();v2.exports=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s{"use strict";f();var HU=f2(),QU=y2(),I2=w2(),jU=E2(),GU=r=>r==null,Ww=Symbol("encodeFragmentIdentifier");function KU(r){switch(r.arrayFormat){case"index":return e=>(t,i)=>{let n=t.length;return i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[",n,"]"].join("")]:[...t,[yt(e,r),"[",yt(n,r),"]=",yt(i,r)].join("")]};case"bracket":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[]"].join("")]:[...t,[yt(e,r),"[]=",yt(i,r)].join("")];case"colon-list-separator":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),":list="].join("")]:[...t,[yt(e,r),":list=",yt(i,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(i,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?i:(n=n===null?"":n,i.length===0?[[yt(t,r),e,yt(n,r)].join("")]:[[i,yt(n,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,yt(e,r)]:[...t,[yt(e,r),"=",yt(i,r)].join("")]}}function zU(r){let e;switch(r.arrayFormat){case"index":return(t,i,n)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){n[t]=i;return}n[t]===void 0&&(n[t]={}),n[t][e[1]]=i};case"bracket":return(t,i,n)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"colon-list-separator":return(t,i,n)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"comma":case"separator":return(t,i,n)=>{let s=typeof i=="string"&&i.includes(r.arrayFormatSeparator),o=typeof i=="string"&&!s&&sn(i,r).includes(r.arrayFormatSeparator);i=o?sn(i,r):i;let a=s||o?i.split(r.arrayFormatSeparator).map(u=>sn(u,r)):i===null?i:sn(i,r);n[t]=a};case"bracket-separator":return(t,i,n)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){n[t]=i&&sn(i,r);return}let o=i===null?[]:i.split(r.arrayFormatSeparator).map(a=>sn(a,r));if(n[t]===void 0){n[t]=o;return}n[t]=[].concat(n[t],o)};default:return(t,i,n)=>{if(n[t]===void 0){n[t]=i;return}n[t]=[].concat(n[t],i)}}}function _2(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function yt(r,e){return e.encode?e.strict?HU(r):encodeURIComponent(r):r}function sn(r,e){return e.decode?QU(r):r}function b2(r){return Array.isArray(r)?r.sort():typeof r=="object"?b2(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function C2(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function kU(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function S2(r){r=C2(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function A2(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function x2(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),_2(e.arrayFormatSeparator);let t=zU(e),i=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return i;for(let n of r.split("&")){if(n==="")continue;let[s,o]=I2(e.decode?n.replace(/\+/g," "):n,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:sn(o,e),t(sn(s,e),o,i)}for(let n of Object.keys(i)){let s=i[n];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=A2(s[o],e);else i[n]=A2(s,e)}return e.sort===!1?i:(e.sort===!0?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((n,s)=>{let o=i[s];return Boolean(o)&&typeof o=="object"&&!Array.isArray(o)?n[s]=b2(o):n[s]=o,n},Object.create(null))}Er.extract=S2;Er.parse=x2;Er.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),_2(e.arrayFormatSeparator);let t=o=>e.skipNull&&GU(r[o])||e.skipEmptyString&&r[o]==="",i=KU(e),n={};for(let o of Object.keys(r))t(o)||(n[o]=r[o]);let s=Object.keys(n);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=r[o];return a===void 0?"":a===null?yt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?yt(o,e)+"[]":a.reduce(i(o),[]).join("&"):yt(o,e)+"="+yt(a,e)}).filter(o=>o.length>0).join("&")};Er.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,i]=I2(r,"#");return Object.assign({url:t.split("?")[0]||"",query:x2(S2(r),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:sn(i,e)}:{})};Er.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[Ww]:!0},e);let t=C2(r.url).split("?")[0]||"",i=Er.extract(r.url),n=Er.parse(i,{sort:!1}),s=Object.assign(n,r.query),o=Er.stringify(s,e);o&&(o=`?${o}`);let a=kU(r.url);return r.fragmentIdentifier&&(a=`#${e[Ww]?yt(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${o}${a}`};Er.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[Ww]:!1},t);let{url:i,query:n,fragmentIdentifier:s}=Er.parseUrl(r,t);return Er.stringifyUrl({url:i,query:jU(n,e),fragmentIdentifier:s},t)};Er.exclude=(r,e,t)=>{let i=Array.isArray(e)?n=>!e.includes(n):(n,s)=>!e(n,s);return Er.pick(r,i,t)}});var N2=me(()=>{f()});function qn(r,e,t="string"){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function WU(r,e){let t=!0;return e.forEach(i=>{i in r||(t=!1)}),t}function $U(r,e){return Array.isArray(r)?r.length===e:Object.keys(r).length===e}function YU(r,e){return Array.isArray(r)?r.length>=e:Object.keys(r).length>=e}function jc(r,e,t){return(!t.length?$U(r,e.length):YU(r,e.length))?WU(r,e):!1}function Gc(r,e,t="_"){let i=r.split(t);return i[i.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var $w=me(()=>{f()});function JU(r){return nd(r.method)&&sd(r.params)}function nd(r){return Gc(r,"subscribe")}function sd(r){return jc(r,["topic"],[])}function XU(r){return od(r.method)&&ad(r.params)}function od(r){return Gc(r,"publish")}function ad(r){return jc(r,["message","topic","ttl"],["prompt","tag"])}function ZU(r){return ud(r.method)&&cd(r.params)}function ud(r){return Gc(r,"unsubscribe")}function cd(r){return jc(r,["id","topic"],[])}function eq(r){return ld(r.method)&&fd(r.params)}function ld(r){return Gc(r,"subscription")}function fd(r){return jc(r,["id","data"],[])}var Yw=me(()=>{f();$w()});function tq(r){if(!nd(r.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!sd(r.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=r.params;return qn(e,"topic"),e}function rq(r){if(!od(r.method))throw new Error("JSON-RPC Request has invalid publish method");if(!ad(r.params))throw new Error("JSON-RPC Request has invalid publish params");let e=r.params;return qn(e,"topic"),qn(e,"message"),qn(e,"ttl","number"),e}function iq(r){if(!ud(r.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!cd(r.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=r.params;return qn(e,"id"),e}function nq(r){if(!ld(r.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!fd(r.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=r.params;return qn(e,"id"),qn(e,"data"),e}var D2=me(()=>{f();$w();Yw()});var sq,O2=me(()=>{f();sq={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 P2={};ot(P2,{RELAY_JSONRPC:()=>sq,isPublishMethod:()=>od,isPublishParams:()=>ad,isPublishRequest:()=>XU,isSubscribeMethod:()=>nd,isSubscribeParams:()=>sd,isSubscribeRequest:()=>JU,isSubscriptionMethod:()=>ld,isSubscriptionParams:()=>fd,isSubscriptionRequest:()=>eq,isUnsubscribeMethod:()=>ud,isUnsubscribeParams:()=>cd,isUnsubscribeRequest:()=>ZU,parsePublishRequest:()=>rq,parseSubscribeRequest:()=>tq,parseSubscriptionRequest:()=>nq,parseUnsubscribeRequest:()=>iq});var B2=me(()=>{f();N2();D2();O2();Yw()});var Ed=B(re=>{"use strict";f();Object.defineProperty(re,"__esModule",{value:!0});var V2=Nx(),oq=Rx(),H2=Tc(),Zw=Fx(),aq=Hx(),nt=($x(),at(Wx)),uq=a2(),Kc=Ys(),zc=zw(),cq=c2(),lq=T2(),fq=(B2(),at(P2));function Q2(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var j2=Q2(aq),hd=Q2(lq),gd=":";function G2(r){let[e,t]=r.split(gd);return{namespace:e,reference:t}}function K2(r){let{namespace:e,reference:t}=r;return[e,t].join(gd)}function e1(r){let[e,t,i]=r.split(gd);return{namespace:e,reference:t,address:i}}function z2(r){let{namespace:e,reference:t,address:i}=r;return[e,t,i].join(gd)}function t1(r,e){let t=[];return r.forEach(i=>{let n=e(i);t.includes(n)||t.push(n)}),t}function k2(r){let{address:e}=e1(r);return e}function W2(r){let{namespace:e,reference:t}=e1(r);return K2({namespace:e,reference:t})}function hq(r,e){let{namespace:t,reference:i}=G2(e);return z2({namespace:t,reference:i,address:r})}function dq(r){return t1(r,k2)}function $2(r){return t1(r,W2)}function pq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.accounts)}),t}function gq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...$2(n.accounts))}),t}function yq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...kc(i,n))}),t}function kc(r,e){return r.includes(":")?[r]:e.chains||[]}var yd=r=>r?.split(":"),Y2=r=>{let e=r&&yd(r);if(e)return e[3]},mq=r=>{let e=r&&yd(r);if(e)return e[2]+":"+e[3]},J2=r=>{let e=r&&yd(r);if(e)return e.pop()},wq=(r,e)=>{let t=`${r.domain} wants you to sign in with your Ethereum account:`,i=J2(e),n=r.statement,s=`URI: ${r.aud}`,o=`Version: ${r.version}`,a=`Chain ID: ${Y2(e)}`,u=`Nonce: ${r.nonce}`,h=`Issued At: ${r.iat}`,p=r.resources&&r.resources.length>0?`Resources: +`});var lx=me(()=>{f();cx();Kh();Fn();Cw();Rc()});var Tw,tZ,fx=me(()=>{f();US();qS();VS();HS();QS();yw();jS();vw();GS();zS();tx();nx();sx();ox();lx();Tw={...lw,...fw,...hw,...dw,...pw,...gw,...mw,...ww,...Ew,...Aw},tZ={...Sw,...xw}});function dx(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var hx,Nw,G4,Wh,Dw=me(()=>{f();fx();Qh();hx=dx("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Nw=dx("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=tu(r.length);for(let t=0;t{f();Dw()});function Di(r,e="utf8"){let t=Wh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}var Pw=me(()=>{f();Dw()});function Fc(r){return Sc(tn(Di(r,Za),Rh))}function Uc(r){return tn(Di(xc(r),Rh),Za)}function Bw(r){let e=Di(Vh,eu),t=qh+tn(jh([e,r]),eu);return[Fh,Uh,t].join(Lh)}function Mw(r){let[e,t,i]=r.split(Lh);if(e!==Fh||t!==Uh)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==qh)throw new Error("Issuer must be a key in mulicodec format");let s=Di(i.slice(1),eu);if(tn(s.slice(0,2),eu)!==Vh)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 px(r){return tn(r,Za)}function gx(r){return Di(r,Za)}function Rw(r){return Di([Uc(r.header),Uc(r.payload)].join(eo),Oc)}function K4(r){let e=tn(r,Oc).split(eo),t=Fc(e[0]),i=Fc(e[1]);return{header:t,payload:i}}function Lw(r){return[Uc(r.header),Uc(r.payload),px(r.signature)].join(eo)}function Fw(r){let e=r.split(eo),t=Fc(e[0]),i=Fc(e[1]),n=gx(e[2]),s=Di(e.slice(0,2).join(eo),Oc);return{header:t,payload:i,signature:n,data:s}}var Uw=me(()=>{f();sw();Ow();Pw();xh();Hh()});function z4(r=(0,yx.randomBytes)(32)){return au.generateKeyPairFromSeed(r)}async function k4(r,e,t,i,n=(0,mx.fromMiliseconds)(Date.now())){let s={alg:Bh,typ:Mh},o=Bw(i.publicKey),a=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:a},h=Rw({header:s,payload:u}),p=au.sign(i.secretKey,h);return Lw({header:s,payload:u,signature:p})}async function W4(r){let{header:e,payload:t,data:i,signature:n}=Fw(r);if(e.alg!==Bh||e.typ!==Mh)throw new Error("JWT must use EdDSA algorithm");let s=Mw(t.iss);return au.verify(s,i,n)}var au,yx,mx,wx=me(()=>{f();au=_e(TS()),yx=_e(Tc()),mx=_e(Ys());Hh();Uw()});var vx=me(()=>{f()});var Ex={};ot(Ex,{DATA_ENCODING:()=>Oc,DID_DELIMITER:()=>Lh,DID_METHOD:()=>Uh,DID_PREFIX:()=>Fh,JSON_ENCODING:()=>Rh,JWT_DELIMITER:()=>eo,JWT_ENCODING:()=>Za,JWT_IRIDIUM_ALG:()=>Bh,JWT_IRIDIUM_TYP:()=>Mh,KEY_PAIR_SEED_LENGTH:()=>DS,MULTICODEC_ED25519_BASE:()=>qh,MULTICODEC_ED25519_ENCODING:()=>eu,MULTICODEC_ED25519_HEADER:()=>Vh,MULTICODEC_ED25519_LENGTH:()=>NS,decodeData:()=>K4,decodeIss:()=>Mw,decodeJSON:()=>Fc,decodeJWT:()=>Fw,decodeSig:()=>gx,encodeData:()=>Rw,encodeIss:()=>Bw,encodeJSON:()=>Uc,encodeJWT:()=>Lw,encodeSig:()=>px,generateKeyPair:()=>z4,signJWT:()=>k4,verifyJWT:()=>W4});var Ax=me(()=>{f();wx();Hh();vx();Uw()});var _x=B($h=>{"use strict";f();Object.defineProperty($h,"__esModule",{value:!0});var cr=$a(),qw=qr(),$4=20;function Y4(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],N=t[23]<<24|t[22]<<16|t[21]<<8|t[20],O=t[27]<<24|t[26]<<16|t[25]<<8|t[24],T=t[31]<<24|t[30]<<16|t[29]<<8|t[28],V=e[3]<<24|e[2]<<16|e[1]<<8|e[0],z=e[7]<<24|e[6]<<16|e[5]<<8|e[4],$=e[11]<<24|e[10]<<16|e[9]<<8|e[8],se=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,j=n,W=s,k=o,R=a,F=u,G=h,ce=p,J=w,X=N,A=O,c=T,d=V,g=z,m=$,v=se,S=0;S<$4;S+=2)Y=Y+R|0,d^=Y,d=d>>>32-16|d<<16,J=J+d|0,R^=J,R=R>>>32-12|R<<12,j=j+F|0,g^=j,g=g>>>32-16|g<<16,X=X+g|0,F^=X,F=F>>>32-12|F<<12,W=W+G|0,m^=W,m=m>>>32-16|m<<16,A=A+m|0,G^=A,G=G>>>32-12|G<<12,k=k+ce|0,v^=k,v=v>>>32-16|v<<16,c=c+v|0,ce^=c,ce=ce>>>32-12|ce<<12,W=W+G|0,m^=W,m=m>>>32-8|m<<8,A=A+m|0,G^=A,G=G>>>32-7|G<<7,k=k+ce|0,v^=k,v=v>>>32-8|v<<8,c=c+v|0,ce^=c,ce=ce>>>32-7|ce<<7,j=j+F|0,g^=j,g=g>>>32-8|g<<8,X=X+g|0,F^=X,F=F>>>32-7|F<<7,Y=Y+R|0,d^=Y,d=d>>>32-8|d<<8,J=J+d|0,R^=J,R=R>>>32-7|R<<7,Y=Y+F|0,v^=Y,v=v>>>32-16|v<<16,A=A+v|0,F^=A,F=F>>>32-12|F<<12,j=j+G|0,d^=j,d=d>>>32-16|d<<16,c=c+d|0,G^=c,G=G>>>32-12|G<<12,W=W+ce|0,g^=W,g=g>>>32-16|g<<16,J=J+g|0,ce^=J,ce=ce>>>32-12|ce<<12,k=k+R|0,m^=k,m=m>>>32-16|m<<16,X=X+m|0,R^=X,R=R>>>32-12|R<<12,W=W+ce|0,g^=W,g=g>>>32-8|g<<8,J=J+g|0,ce^=J,ce=ce>>>32-7|ce<<7,k=k+R|0,m^=k,m=m>>>32-8|m<<8,X=X+m|0,R^=X,R=R>>>32-7|R<<7,j=j+G|0,d^=j,d=d>>>32-8|d<<8,c=c+d|0,G^=c,G=G>>>32-7|G<<7,Y=Y+F|0,v^=Y,v=v>>>32-8|v<<8,A=A+v|0,F^=A,F=F>>>32-7|F<<7;cr.writeUint32LE(Y+i|0,r,0),cr.writeUint32LE(j+n|0,r,4),cr.writeUint32LE(W+s|0,r,8),cr.writeUint32LE(k+o|0,r,12),cr.writeUint32LE(R+a|0,r,16),cr.writeUint32LE(F+u|0,r,20),cr.writeUint32LE(G+h|0,r,24),cr.writeUint32LE(ce+p|0,r,28),cr.writeUint32LE(J+w|0,r,32),cr.writeUint32LE(X+N|0,r,36),cr.writeUint32LE(A+O|0,r,40),cr.writeUint32LE(c+T|0,r,44),cr.writeUint32LE(d+V|0,r,48),cr.writeUint32LE(g+z|0,r,52),cr.writeUint32LE(m+$|0,r,56),cr.writeUint32LE(v+se|0,r,60)}function Ix(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var Yh=B(uu=>{"use strict";f();Object.defineProperty(uu,"__esModule",{value:!0});function Z4(r,e,t){return~(r-1)&e|r-1&t}uu.select=Z4;function eU(r,e){return(r|0)-(e|0)-1>>>31&1}uu.lessOrEqual=eU;function bx(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}uu.compare=bx;function tU(r,e){return r.length===0||e.length===0?!1:bx(r,e)!==0}uu.equal=tU});var Sx=B(rn=>{"use strict";f();Object.defineProperty(rn,"__esModule",{value:!0});var rU=Yh(),Jh=qr();rn.DIGEST_LENGTH=16;var Cx=function(){function r(e){this.digestLength=rn.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 t=e[0]|e[1]<<8;this._r[0]=t&8191;var i=e[2]|e[3]<<8;this._r[1]=(t>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>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 h=e[14]|e[15]<<8;this._r[8]=(u>>>8|h<<8)&8191,this._r[9]=h>>>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 r.prototype._blocks=function(e,t,i){for(var n=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],h=this._h[4],p=this._h[5],w=this._h[6],N=this._h[7],O=this._h[8],T=this._h[9],V=this._r[0],z=this._r[1],$=this._r[2],se=this._r[3],Y=this._r[4],j=this._r[5],W=this._r[6],k=this._r[7],R=this._r[8],F=this._r[9];i>=16;){var G=e[t+0]|e[t+1]<<8;s+=G&8191;var ce=e[t+2]|e[t+3]<<8;o+=(G>>>13|ce<<3)&8191;var J=e[t+4]|e[t+5]<<8;a+=(ce>>>10|J<<6)&8191;var X=e[t+6]|e[t+7]<<8;u+=(J>>>7|X<<9)&8191;var A=e[t+8]|e[t+9]<<8;h+=(X>>>4|A<<12)&8191,p+=A>>>1&8191;var c=e[t+10]|e[t+11]<<8;w+=(A>>>14|c<<2)&8191;var d=e[t+12]|e[t+13]<<8;N+=(c>>>11|d<<5)&8191;var g=e[t+14]|e[t+15]<<8;O+=(d>>>8|g<<8)&8191,T+=g>>>5|n;var m=0,v=m;v+=s*V,v+=o*(5*F),v+=a*(5*R),v+=u*(5*k),v+=h*(5*W),m=v>>>13,v&=8191,v+=p*(5*j),v+=w*(5*Y),v+=N*(5*se),v+=O*(5*$),v+=T*(5*z),m+=v>>>13,v&=8191;var S=m;S+=s*z,S+=o*V,S+=a*(5*F),S+=u*(5*R),S+=h*(5*k),m=S>>>13,S&=8191,S+=p*(5*W),S+=w*(5*j),S+=N*(5*Y),S+=O*(5*se),S+=T*(5*$),m+=S>>>13,S&=8191;var D=m;D+=s*$,D+=o*z,D+=a*V,D+=u*(5*F),D+=h*(5*R),m=D>>>13,D&=8191,D+=p*(5*k),D+=w*(5*W),D+=N*(5*j),D+=O*(5*Y),D+=T*(5*se),m+=D>>>13,D&=8191;var I=m;I+=s*se,I+=o*$,I+=a*z,I+=u*V,I+=h*(5*F),m=I>>>13,I&=8191,I+=p*(5*R),I+=w*(5*k),I+=N*(5*W),I+=O*(5*j),I+=T*(5*Y),m+=I>>>13,I&=8191;var l=m;l+=s*Y,l+=o*se,l+=a*$,l+=u*z,l+=h*V,m=l>>>13,l&=8191,l+=p*(5*F),l+=w*(5*R),l+=N*(5*k),l+=O*(5*W),l+=T*(5*j),m+=l>>>13,l&=8191;var C=m;C+=s*j,C+=o*Y,C+=a*se,C+=u*$,C+=h*z,m=C>>>13,C&=8191,C+=p*V,C+=w*(5*F),C+=N*(5*R),C+=O*(5*k),C+=T*(5*W),m+=C>>>13,C&=8191;var Z=m;Z+=s*W,Z+=o*j,Z+=a*Y,Z+=u*se,Z+=h*$,m=Z>>>13,Z&=8191,Z+=p*z,Z+=w*V,Z+=N*(5*F),Z+=O*(5*R),Z+=T*(5*k),m+=Z>>>13,Z&=8191;var ie=m;ie+=s*k,ie+=o*W,ie+=a*j,ie+=u*Y,ie+=h*se,m=ie>>>13,ie&=8191,ie+=p*$,ie+=w*z,ie+=N*V,ie+=O*(5*F),ie+=T*(5*R),m+=ie>>>13,ie&=8191;var ee=m;ee+=s*R,ee+=o*k,ee+=a*W,ee+=u*j,ee+=h*Y,m=ee>>>13,ee&=8191,ee+=p*se,ee+=w*$,ee+=N*z,ee+=O*V,ee+=T*(5*F),m+=ee>>>13,ee&=8191;var ae=m;ae+=s*F,ae+=o*R,ae+=a*k,ae+=u*W,ae+=h*j,m=ae>>>13,ae&=8191,ae+=p*Y,ae+=w*se,ae+=N*$,ae+=O*z,ae+=T*V,m+=ae>>>13,ae&=8191,m=(m<<2)+m|0,m=m+v|0,v=m&8191,m=m>>>13,S+=m,s=v,o=S,a=D,u=I,h=l,p=C,w=Z,N=ie,O=ee,T=ae,t+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=h,this._h[5]=p,this._h[6]=w,this._h[7]=N,this._h[8]=O,this._h[9]=T},r.prototype.finish=function(e,t){t===void 0&&(t=0);var i=new Uint16Array(10),n,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(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[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[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s=16&&(n=i-i%16,this._blocks(e,t,n),t+=n,i-=n),i){for(var s=0;s{"use strict";f();Object.defineProperty(nn,"__esModule",{value:!0});var Xh=_x(),sU=Sx(),qc=qr(),xx=$a(),oU=Yh();nn.KEY_LENGTH=32;nn.NONCE_LENGTH=12;nn.TAG_LENGTH=16;var Tx=new Uint8Array(16),aU=function(){function r(e){if(this.nonceLength=nn.NONCE_LENGTH,this.tagLength=nn.TAG_LENGTH,e.length!==nn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return r.prototype.seal=function(e,t,i,n){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);Xh.stream(this._key,s,o,4);var a=t.length+this.tagLength,u;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(a);return Xh.streamXOR(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),i),qc.wipe(s),u},r.prototype.open=function(e,t,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(Tx.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(Tx.subarray(i.length%16));var o=new Uint8Array(8);n&&xx.writeUint64LE(n.length,o),s.update(o),xx.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";f();Object.defineProperty(Vw,"__esModule",{value:!0});function uU(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Vw.isSerializableHash=uU});var Px=B(Vc=>{"use strict";f();Object.defineProperty(Vc,"__esModule",{value:!0});var Oi=Dx(),cU=Yh(),lU=qr(),Ox=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n{"use strict";f();Object.defineProperty(Hw,"__esModule",{value:!0});var Bx=Px(),Mx=qr(),hU=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Bx.hmac(this._hash,i,t);this._hmac=new Bx.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i{"use strict";f();Object.defineProperty(qn,"__esModule",{value:!0});var ed=$a(),Zh=qr();qn.DIGEST_LENGTH=32;qn.BLOCK_SIZE=64;var Lx=function(){function r(){this.digestLength=qn.DIGEST_LENGTH,this.blockSize=qn.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Zh.wipe(this._buffer),Zh.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Qw(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Qw(this._temp,this._state,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Zh.wipe(e.state),e.buffer&&Zh.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();qn.SHA256=Lx;var dU=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 Qw(r,e,t,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],h=e[4],p=e[5],w=e[6],N=e[7],O=0;O<16;O++){var T=i+O*4;r[O]=ed.readUint32BE(t,T)}for(var O=16;O<64;O++){var V=r[O-2],z=(V>>>17|V<<32-17)^(V>>>19|V<<32-19)^V>>>10;V=r[O-15];var $=(V>>>7|V<<32-7)^(V>>>18|V<<32-18)^V>>>3;r[O]=(z+r[O-7]|0)+($+r[O-16]|0)}for(var O=0;O<64;O++){var z=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&p^~h&w)|0)+(N+(dU[O]+r[O]|0)|0)|0,$=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;N=w,w=p,p=h,h=u+z|0,u=a,a=o,o=s,s=z+$|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=h,e[5]+=p,e[6]+=w,e[7]+=N,i+=64,n-=64}return i}function pU(r){var e=new Lx;e.update(r);var t=e.digest();return e.clean(),t}qn.hash=pU});var Hx=B(ct=>{"use strict";f();Object.defineProperty(ct,"__esModule",{value:!0});ct.sharedKey=ct.generateKeyPair=ct.generateKeyPairFromSeed=ct.scalarMultBase=ct.scalarMult=ct.SHARED_KEY_LENGTH=ct.SECRET_KEY_LENGTH=ct.PUBLIC_KEY_LENGTH=void 0;var gU=Tc(),yU=qr();ct.PUBLIC_KEY_LENGTH=32;ct.SECRET_KEY_LENGTH=32;ct.SHARED_KEY_LENGTH=32;function Pi(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,Hc(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function vU(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function td(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function rd(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function sn(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Qc(r,e){sn(r,e,e)}function EU(r,e){let t=Pi();for(let i=0;i<16;i++)t[i]=e[i];for(let i=253;i>=0;i--)Qc(t,t),i!==2&&i!==4&&sn(t,t,e);for(let i=0;i<16;i++)r[i]=t[i]}function Gw(r,e){let t=new Uint8Array(32),i=new Float64Array(80),n=Pi(),s=Pi(),o=Pi(),a=Pi(),u=Pi(),h=Pi();for(let O=0;O<31;O++)t[O]=r[O];t[31]=r[31]&127|64,t[0]&=248,vU(i,e);for(let O=0;O<16;O++)s[O]=i[O];n[0]=a[0]=1;for(let O=254;O>=0;--O){let T=t[O>>>3]>>>(O&7)&1;Hc(n,s,T),Hc(o,a,T),td(u,n,o),rd(n,n,o),td(o,s,a),rd(s,s,a),Qc(a,u),Qc(h,n),sn(n,o,n),sn(o,s,u),td(u,n,o),rd(n,n,o),Qc(s,n),rd(o,a,h),sn(n,o,mU),td(n,n,a),sn(o,o,n),sn(n,a,h),sn(a,s,i),Qc(s,u),Hc(n,s,T),Hc(o,a,T)}for(let O=0;O<16;O++)i[O+16]=n[O],i[O+32]=o[O],i[O+48]=s[O],i[O+64]=a[O];let p=i.subarray(32),w=i.subarray(16);EU(p,p),sn(w,w,p);let N=new Uint8Array(32);return wU(N,w),N}ct.scalarMult=Gw;function qx(r){return Gw(r,Ux)}ct.scalarMultBase=qx;function Vx(r){if(r.length!==ct.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${ct.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(r);return{publicKey:qx(e),secretKey:e}}ct.generateKeyPairFromSeed=Vx;function AU(r){let e=(0,gU.randomBytes)(32,r),t=Vx(e);return(0,yU.wipe)(e),t}ct.generateKeyPair=AU;function IU(r,e,t=!1){if(r.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let i=Gw(r,e);if(t){let n=0;for(let s=0;se[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength{f()});function Gx(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{f()});function zx(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=tu(r.length);for(let i=0;i{f();Qh()});var Wx={};ot(Wx,{compare:()=>Qx,concat:()=>jh,equals:()=>Gx,fromString:()=>Di,toString:()=>tn,xor:()=>zx});var $x=me(()=>{f();jx();sw();Kx();Pw();Ow();kx()});var a2=B(it=>{"use strict";f();var Yx=it&&it.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new i2:typeof navigator<"u"?Kw(navigator.userAgent):o2()}it.detect=SU;function n2(r){return r!==""&&CU.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function xU(r){var e=n2(r);return e?e[0]:null}it.browserName=xU;function Kw(r){var e=n2(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new r2;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length{"use strict";f();Object.defineProperty(We,"__esModule",{value:!0});We.getLocalStorage=We.getLocalStorageOrThrow=We.getCrypto=We.getCryptoOrThrow=We.getLocation=We.getLocationOrThrow=We.getNavigator=We.getNavigatorOrThrow=We.getDocument=We.getDocumentOrThrow=We.getFromWindowOrThrow=We.getFromWindow=void 0;function ro(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}We.getFromWindow=ro;function cu(r){let e=ro(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}We.getFromWindowOrThrow=cu;function NU(){return cu("document")}We.getDocumentOrThrow=NU;function DU(){return ro("document")}We.getDocument=DU;function OU(){return cu("navigator")}We.getNavigatorOrThrow=OU;function PU(){return ro("navigator")}We.getNavigator=PU;function BU(){return cu("location")}We.getLocationOrThrow=BU;function MU(){return ro("location")}We.getLocation=MU;function RU(){return cu("crypto")}We.getCryptoOrThrow=RU;function LU(){return ro("crypto")}We.getCrypto=LU;function FU(){return cu("localStorage")}We.getLocalStorageOrThrow=FU;function UU(){return ro("localStorage")}We.getLocalStorage=UU});var c2=B(id=>{"use strict";f();Object.defineProperty(id,"__esModule",{value:!0});id.getWindowMetadata=void 0;var u2=zw();function qU(){let r,e;try{r=u2.getDocumentOrThrow(),e=u2.getLocationOrThrow()}catch{return null}function t(){let w=r.getElementsByTagName("link"),N=[];for(let O=0;O-1){let z=T.getAttribute("href");if(z)if(z.toLowerCase().indexOf("https:")===-1&&z.toLowerCase().indexOf("http:")===-1&&z.indexOf("//")!==0){let $=e.protocol+"//"+e.host;if(z.indexOf("/")===0)$+=z;else{let se=e.pathname.split("/");se.pop();let Y=se.join("/");$+=Y+"/"+z}N.push($)}else if(z.indexOf("//")===0){let $=e.protocol+z;N.push($)}else N.push(z)}}return N}function i(...w){let N=r.getElementsByTagName("meta");for(let O=0;OT.getAttribute(z)).filter(z=>z?w.includes(z):!1);if(V.length&&V){let z=T.getAttribute("content");if(z)return z}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}let o=n(),a=s(),u=e.origin,h=t();return{description:a,url:u,icons:h,name:o}}id.getWindowMetadata=qU});var f2=B((gee,l2)=>{"use strict";f();l2.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var y2=B((mee,g2)=>{"use strict";f();var p2="%[a-f0-9]{2}",h2=new RegExp("("+p2+")|([^%]+?)","gi"),d2=new RegExp("("+p2+")+","gi");function kw(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],kw(t),kw(i))}function VU(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(h2)||[],t=1;t{"use strict";f();m2.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var E2=B((Aee,v2)=>{"use strict";f();v2.exports=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s{"use strict";f();var QU=f2(),jU=y2(),I2=w2(),GU=E2(),KU=r=>r==null,Ww=Symbol("encodeFragmentIdentifier");function zU(r){switch(r.arrayFormat){case"index":return e=>(t,i)=>{let n=t.length;return i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[",n,"]"].join("")]:[...t,[yt(e,r),"[",yt(n,r),"]=",yt(i,r)].join("")]};case"bracket":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[]"].join("")]:[...t,[yt(e,r),"[]=",yt(i,r)].join("")];case"colon-list-separator":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),":list="].join("")]:[...t,[yt(e,r),":list=",yt(i,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(i,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?i:(n=n===null?"":n,i.length===0?[[yt(t,r),e,yt(n,r)].join("")]:[[i,yt(n,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,yt(e,r)]:[...t,[yt(e,r),"=",yt(i,r)].join("")]}}function kU(r){let e;switch(r.arrayFormat){case"index":return(t,i,n)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){n[t]=i;return}n[t]===void 0&&(n[t]={}),n[t][e[1]]=i};case"bracket":return(t,i,n)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"colon-list-separator":return(t,i,n)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"comma":case"separator":return(t,i,n)=>{let s=typeof i=="string"&&i.includes(r.arrayFormatSeparator),o=typeof i=="string"&&!s&&on(i,r).includes(r.arrayFormatSeparator);i=o?on(i,r):i;let a=s||o?i.split(r.arrayFormatSeparator).map(u=>on(u,r)):i===null?i:on(i,r);n[t]=a};case"bracket-separator":return(t,i,n)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){n[t]=i&&on(i,r);return}let o=i===null?[]:i.split(r.arrayFormatSeparator).map(a=>on(a,r));if(n[t]===void 0){n[t]=o;return}n[t]=[].concat(n[t],o)};default:return(t,i,n)=>{if(n[t]===void 0){n[t]=i;return}n[t]=[].concat(n[t],i)}}}function _2(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function yt(r,e){return e.encode?e.strict?QU(r):encodeURIComponent(r):r}function on(r,e){return e.decode?jU(r):r}function b2(r){return Array.isArray(r)?r.sort():typeof r=="object"?b2(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function C2(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function WU(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function S2(r){r=C2(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function A2(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function x2(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),_2(e.arrayFormatSeparator);let t=kU(e),i=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return i;for(let n of r.split("&")){if(n==="")continue;let[s,o]=I2(e.decode?n.replace(/\+/g," "):n,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:on(o,e),t(on(s,e),o,i)}for(let n of Object.keys(i)){let s=i[n];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=A2(s[o],e);else i[n]=A2(s,e)}return e.sort===!1?i:(e.sort===!0?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((n,s)=>{let o=i[s];return Boolean(o)&&typeof o=="object"&&!Array.isArray(o)?n[s]=b2(o):n[s]=o,n},Object.create(null))}Er.extract=S2;Er.parse=x2;Er.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),_2(e.arrayFormatSeparator);let t=o=>e.skipNull&&KU(r[o])||e.skipEmptyString&&r[o]==="",i=zU(e),n={};for(let o of Object.keys(r))t(o)||(n[o]=r[o]);let s=Object.keys(n);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=r[o];return a===void 0?"":a===null?yt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?yt(o,e)+"[]":a.reduce(i(o),[]).join("&"):yt(o,e)+"="+yt(a,e)}).filter(o=>o.length>0).join("&")};Er.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,i]=I2(r,"#");return Object.assign({url:t.split("?")[0]||"",query:x2(S2(r),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:on(i,e)}:{})};Er.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[Ww]:!0},e);let t=C2(r.url).split("?")[0]||"",i=Er.extract(r.url),n=Er.parse(i,{sort:!1}),s=Object.assign(n,r.query),o=Er.stringify(s,e);o&&(o=`?${o}`);let a=WU(r.url);return r.fragmentIdentifier&&(a=`#${e[Ww]?yt(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${o}${a}`};Er.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[Ww]:!1},t);let{url:i,query:n,fragmentIdentifier:s}=Er.parseUrl(r,t);return Er.stringifyUrl({url:i,query:GU(n,e),fragmentIdentifier:s},t)};Er.exclude=(r,e,t)=>{let i=Array.isArray(e)?n=>!e.includes(n):(n,s)=>!e(n,s);return Er.pick(r,i,t)}});var N2=me(()=>{f()});function Vn(r,e,t="string"){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function $U(r,e){let t=!0;return e.forEach(i=>{i in r||(t=!1)}),t}function YU(r,e){return Array.isArray(r)?r.length===e:Object.keys(r).length===e}function JU(r,e){return Array.isArray(r)?r.length>=e:Object.keys(r).length>=e}function jc(r,e,t){return(!t.length?YU(r,e.length):JU(r,e.length))?$U(r,e):!1}function Gc(r,e,t="_"){let i=r.split(t);return i[i.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var $w=me(()=>{f()});function XU(r){return nd(r.method)&&sd(r.params)}function nd(r){return Gc(r,"subscribe")}function sd(r){return jc(r,["topic"],[])}function ZU(r){return od(r.method)&&ad(r.params)}function od(r){return Gc(r,"publish")}function ad(r){return jc(r,["message","topic","ttl"],["prompt","tag"])}function eq(r){return ud(r.method)&&cd(r.params)}function ud(r){return Gc(r,"unsubscribe")}function cd(r){return jc(r,["id","topic"],[])}function tq(r){return ld(r.method)&&fd(r.params)}function ld(r){return Gc(r,"subscription")}function fd(r){return jc(r,["id","data"],[])}var Yw=me(()=>{f();$w()});function rq(r){if(!nd(r.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!sd(r.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=r.params;return Vn(e,"topic"),e}function iq(r){if(!od(r.method))throw new Error("JSON-RPC Request has invalid publish method");if(!ad(r.params))throw new Error("JSON-RPC Request has invalid publish params");let e=r.params;return Vn(e,"topic"),Vn(e,"message"),Vn(e,"ttl","number"),e}function nq(r){if(!ud(r.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!cd(r.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=r.params;return Vn(e,"id"),e}function sq(r){if(!ld(r.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!fd(r.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=r.params;return Vn(e,"id"),Vn(e,"data"),e}var D2=me(()=>{f();$w();Yw()});var oq,O2=me(()=>{f();oq={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 P2={};ot(P2,{RELAY_JSONRPC:()=>oq,isPublishMethod:()=>od,isPublishParams:()=>ad,isPublishRequest:()=>ZU,isSubscribeMethod:()=>nd,isSubscribeParams:()=>sd,isSubscribeRequest:()=>XU,isSubscriptionMethod:()=>ld,isSubscriptionParams:()=>fd,isSubscriptionRequest:()=>tq,isUnsubscribeMethod:()=>ud,isUnsubscribeParams:()=>cd,isUnsubscribeRequest:()=>eq,parsePublishRequest:()=>iq,parseSubscribeRequest:()=>rq,parseSubscriptionRequest:()=>sq,parseUnsubscribeRequest:()=>nq});var B2=me(()=>{f();N2();D2();O2();Yw()});var Ed=B(re=>{"use strict";f();Object.defineProperty(re,"__esModule",{value:!0});var V2=Nx(),aq=Rx(),H2=Tc(),Zw=Fx(),uq=Hx(),nt=($x(),at(Wx)),cq=a2(),Kc=Ys(),zc=zw(),lq=c2(),fq=T2(),hq=(B2(),at(P2));function Q2(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var j2=Q2(uq),hd=Q2(fq),gd=":";function G2(r){let[e,t]=r.split(gd);return{namespace:e,reference:t}}function K2(r){let{namespace:e,reference:t}=r;return[e,t].join(gd)}function e1(r){let[e,t,i]=r.split(gd);return{namespace:e,reference:t,address:i}}function z2(r){let{namespace:e,reference:t,address:i}=r;return[e,t,i].join(gd)}function t1(r,e){let t=[];return r.forEach(i=>{let n=e(i);t.includes(n)||t.push(n)}),t}function k2(r){let{address:e}=e1(r);return e}function W2(r){let{namespace:e,reference:t}=e1(r);return K2({namespace:e,reference:t})}function dq(r,e){let{namespace:t,reference:i}=G2(e);return z2({namespace:t,reference:i,address:r})}function pq(r){return t1(r,k2)}function $2(r){return t1(r,W2)}function gq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.accounts)}),t}function yq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...$2(n.accounts))}),t}function mq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...kc(i,n))}),t}function kc(r,e){return r.includes(":")?[r]:e.chains||[]}var yd=r=>r?.split(":"),Y2=r=>{let e=r&&yd(r);if(e)return e[3]},wq=r=>{let e=r&&yd(r);if(e)return e[2]+":"+e[3]},J2=r=>{let e=r&&yd(r);if(e)return e.pop()},vq=(r,e)=>{let t=`${r.domain} wants you to sign in with your Ethereum account:`,i=J2(e),n=r.statement,s=`URI: ${r.aud}`,o=`Version: ${r.version}`,a=`Chain ID: ${Y2(e)}`,u=`Nonce: ${r.nonce}`,h=`Issued At: ${r.iat}`,p=r.resources&&r.resources.length>0?`Resources: ${r.resources.map(w=>`- ${w}`).join(` `)}`:void 0;return[t,i,"",n,"",s,o,a,u,h,p].filter(w=>w!=null).join(` -`)},r1="base10",dr="base16",dd="base64pad",md="utf8",i1=0,lu=1,vq=0,M2=1,Jw=12,n1=32;function Eq(){let r=j2.generateKeyPair();return{privateKey:nt.toString(r.secretKey,dr),publicKey:nt.toString(r.publicKey,dr)}}function Aq(){let r=H2.randomBytes(n1);return nt.toString(r,dr)}function Iq(r,e){let t=j2.sharedKey(nt.fromString(r,dr),nt.fromString(e,dr)),i=new oq.HKDF(Zw.SHA256,t).expand(n1);return nt.toString(i,dr)}function _q(r){let e=Zw.hash(nt.fromString(r,dr));return nt.toString(e,dr)}function bq(r){let e=Zw.hash(nt.fromString(r,md));return nt.toString(e,dr)}function X2(r){return nt.fromString(`${r}`,r1)}function Wc(r){return Number(nt.toString(r,r1))}function Cq(r){let e=X2(typeof r.type<"u"?r.type:i1);if(Wc(e)===lu&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof r.senderPublicKey<"u"?nt.fromString(r.senderPublicKey,dr):void 0,i=typeof r.iv<"u"?nt.fromString(r.iv,dr):H2.randomBytes(Jw),n=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)).seal(i,nt.fromString(r.message,md));return Z2({type:e,sealed:n,iv:i,senderPublicKey:t})}function Sq(r){let e=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)),{sealed:t,iv:i}=s1(r.encoded),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return nt.toString(n,md)}function Z2(r){if(Wc(r.type)===lu){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nt.toString(nt.concat([r.type,r.senderPublicKey,r.iv,r.sealed]),dd)}return nt.toString(nt.concat([r.type,r.iv,r.sealed]),dd)}function s1(r){let e=nt.fromString(r,dd),t=e.slice(vq,M2),i=M2;if(Wc(t)===lu){let a=i+n1,u=a+Jw,h=e.slice(i,a),p=e.slice(a,u),w=e.slice(u);return{type:t,sealed:w,iv:p,senderPublicKey:h}}let n=i+Jw,s=e.slice(i,n),o=e.slice(n);return{type:t,sealed:o,iv:s}}function xq(r,e){let t=s1(r);return eT({type:Wc(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?nt.toString(t.senderPublicKey,dr):void 0,receiverPublicKey:e?.receiverPublicKey})}function eT(r){let e=r?.type||i1;if(e===lu){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function Tq(r){return r.type===lu&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var Nq=Object.defineProperty,R2=Object.getOwnPropertySymbols,Dq=Object.prototype.hasOwnProperty,Oq=Object.prototype.propertyIsEnumerable,L2=(r,e,t)=>e in r?Nq(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F2=(r,e)=>{for(var t in e||(e={}))Dq.call(e,t)&&L2(r,t,e[t]);if(R2)for(var t of R2(e))Oq.call(e,t)&&L2(r,t,e[t]);return r},tT="ReactNative",cu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pd=" ",Pq=":",rT="/",o1=2,Bq=1e3,iT="js";function a1(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}function nT(){return!zc.getDocument()&&!!zc.getNavigator()&&navigator.product===tT}function sT(){return!a1()&&!!zc.getNavigator()}function u1(){return nT()?cu.reactNative:a1()?cu.node:sT()?cu.browser:cu.unknown}function oT(r,e){let t=hd.parse(r);return t=F2(F2({},t),e),r=hd.stringify(t),r}function Mq(){return cq.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Rq(r,e){var t;let i=u1(),n={protocol:r,version:e,env:i};return i==="browser"&&(n.host=((t=zc.getLocation())==null?void 0:t.host)||"unknown"),n}function aT(){let r=uq.detect();if(r===null)return"unknown";let e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function uT(){var r;let e=u1();return e===cu.browser?[e,((r=zc.getLocation())==null?void 0:r.host)||"unknown"].join(":"):e}function cT(r,e,t){let i=aT(),n=uT();return[[r,e].join("-"),[iT,t].join("-"),i,n].join("/")}function Lq({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s}){let o=t.split("?"),a=cT(r,e,i),u={auth:n,ua:a,projectId:s},h=oT(o[1]||"",u);return o[0]+"?"+h}function Fq(r){let e=(r.match(/^[^:]+(?=:\/\/)/gi)||[])[0],t=typeof e<"u"?r.split("://")[1]:r;return e=e==="wss"?"https":"http",[e,t].join("://")}function Uq(r,e,t){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function lT(r,e=o1){return fT(r.split(rT),e)}function qq(r){return lT(r).join(pd)}function on(r,e){return r.filter(t=>e.includes(t)).length===r.length}function fT(r,e=o1){return r.slice(Math.max(r.length-e,0))}function Vq(r){return Object.fromEntries(r.entries())}function Hq(r){return new Map(Object.entries(r))}function Qq(r,e){let t={};return Object.keys(r).forEach(i=>{t[i]=e(r[i])}),t}var jq=r=>r;function hT(r){return r.trim().replace(/^\w/,e=>e.toUpperCase())}function Gq(r){return r.split(pd).map(e=>hT(e)).join(pd)}function Kq(r){let e=Kc.toMiliseconds(r||Kc.FIVE_MINUTES),t,i,n;return{resolve:s=>{n&&t&&(clearTimeout(n),t(s))},reject:s=>{n&&i&&(clearTimeout(n),i(s))},done:()=>new Promise((s,o)=>{n=setTimeout(o,e),t=s,i=o})}}function zq(r,e){return new Promise(async(t,i)=>{let n=setTimeout(()=>i(),e),s=await r;clearTimeout(n),t(s)})}function c1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function kq(r){return c1("topic",r)}function Wq(r){return c1("id",r)}function $q(r){let[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Yq(r,e){return Kc.fromMiliseconds((e||Date.now())+Kc.toMiliseconds(r))}function Jq(r){return Date.now()>=Kc.toMiliseconds(r)}function Xq(r,e){return`${r}${e?`:${e}`:""}`}var dT="irn";function Zq(r){return r?.relay||{protocol:dT}}function eV(r){let e=fq.RELAY_JSONRPC[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var tV=Object.defineProperty,U2=Object.getOwnPropertySymbols,rV=Object.prototype.hasOwnProperty,iV=Object.prototype.propertyIsEnumerable,q2=(r,e,t)=>e in r?tV(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,nV=(r,e)=>{for(var t in e||(e={}))rV.call(e,t)&&q2(r,t,e[t]);if(U2)for(var t of U2(e))iV.call(e,t)&&q2(r,t,e[t]);return r};function pT(r,e="-"){let t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){let s=n.replace(i,""),o=r[n];t[s]=o}}),t}function sV(r){let e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",o=hd.parse(s);return{protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:pT(o)}}function gT(r,e="-"){let t="relay",i={};return Object.keys(r).forEach(n=>{let s=t+e+n;r[n]&&(i[s]=r[n])}),i}function oV(r){return`${r.protocol}:${r.topic}@${r.version}?`+hd.stringify(nV({symKey:r.symKey},gT(r.relay)))}function fu(r){let e=[];return r.forEach(t=>{let[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function yT(r){let e=[];return Object.values(r).forEach(t=>{e.push(...fu(t.accounts))}),e}function mT(r,e){let t=[];return Object.values(r).forEach(i=>{fu(i.accounts).includes(e)&&t.push(...i.methods)}),t}function wT(r,e){let t=[];return Object.values(r).forEach(i=>{fu(i.accounts).includes(e)&&t.push(...i.events)}),t}function aV(r,e){let t=CT(r,e);if(t)throw new Error(t.message);let i={};for(let[n,s]of Object.entries(r))i[n]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return i}var uV={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}},cV={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 Vn(r,e){let{message:t,code:i}=cV[r];return{message:e?`${t} ${e}`:t,code:i}}function io(r,e){let{message:t,code:i}=uV[r];return{message:e?`${t} ${e}`:t,code:i}}function $c(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function l1(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Hn(r){return typeof r>"u"}function Sr(r,e){return e&&Hn(r)?!0:typeof r=="string"&&Boolean(r.trim().length)}function wd(r,e){return e&&Hn(r)?!0:typeof r=="number"&&!isNaN(r)}function lV(r,e){let{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t),s=!0;return on(n,i)?(i.forEach(o=>{let{accounts:a,methods:u,events:h}=r.namespaces[o],p=fu(a),w=t[o];(!on(kc(o,w),p)||!on(w.methods,u)||!on(w.events,h))&&(s=!1)}),s):!1}function vd(r){return Sr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function vT(r){if(Sr(r,!1)&&r.includes(":")){let e=r.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&vd(t)}}return!1}function fV(r){if(Sr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function hV(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function dV(r){return r?.topic}function pV(r,e){let t=null;return Sr(r?.publicKey,!1)||(t=Vn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Xw(r){let e=!0;return $c(r)?r.length&&(e=r.every(t=>Sr(t,!1))):e=!1,e}function ET(r,e,t){let i=null;return $c(e)?e.forEach(n=>{i||(!vd(n)||!n.includes(r))&&(i=io("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):i=io("UNSUPPORTED_CHAINS",`${t}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),i}function AT(r,e){let t=null;return Object.entries(r).forEach(([i,n])=>{if(t)return;let s=ET(i,kc(i,n),`${e} requiredNamespace`);s&&(t=s)}),t}function IT(r,e){let t=null;return $c(r)?r.forEach(i=>{t||vT(i)||(t=io("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=io("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function _T(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=IT(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function bT(r,e){let t=null;return Xw(r?.methods)?Xw(r?.events)||(t=io("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=io("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function f1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=bT(i,`${e}, namespace`);n&&(t=n)}),t}function gV(r,e,t){let i=null;if(r&&l1(r)){let n=f1(r,e);n&&(i=n);let s=AT(r,e);s&&(i=s)}else i=Vn("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function CT(r,e){let t=null;if(r&&l1(r)){let i=f1(r,e);i&&(t=i);let n=_T(r,e);n&&(t=n)}else t=Vn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function ST(r){return Sr(r.protocol,!0)}function yV(r,e){let t=!1;return e&&!r?t=!0:r&&$c(r)&&r.length&&r.forEach(i=>{t=ST(i)}),t}function mV(r){return typeof r=="number"}function wV(r){return typeof r<"u"&&typeof r!==null}function vV(r){return!(!r||typeof r!="object"||!r.code||!wd(r.code,!1)||!r.message||!Sr(r.message,!1))}function EV(r){return!(Hn(r)||!Sr(r.method,!1))}function AV(r){return!(Hn(r)||Hn(r.result)&&Hn(r.error)||!wd(r.id,!1)||!Sr(r.jsonrpc,!1))}function IV(r){return!(Hn(r)||!Sr(r.name,!1))}function _V(r,e){return!(!vd(e)||!yT(r).includes(e))}function bV(r,e,t){return Sr(t,!1)?mT(r,e).includes(t):!1}function CV(r,e,t){return Sr(t,!1)?wT(r,e).includes(t):!1}function SV(r,e,t,i){let n=null,s=Object.keys(r),o=Object.keys(e);return on(s,o)?s.forEach(a=>{if(n)return;let u=fu(e[a].accounts);on(kc(a,r[a]),u)?on(r[a].methods,e[a].methods)?on(r[a].events,e[a].events)||(n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${a}`)):n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${a}`):n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace chains for ${a}`)}):n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy ${i}`),n}function xV(r,e){return wd(r,!1)&&r<=e.max&&r>=e.min}re.BASE10=r1,re.BASE16=dr,re.BASE64=dd,re.COLON=Pq,re.DEFAULT_DEPTH=o1,re.EMPTY_SPACE=pd,re.ENV_MAP=cu,re.ONE_THOUSAND=Bq,re.REACT_NATIVE_PRODUCT=tT,re.RELAYER_DEFAULT_PROTOCOL=dT,re.SDK_TYPE=iT,re.SLASH=rT,re.TYPE_0=i1,re.TYPE_1=lu,re.UTF8=md,re.appendToQueryString=oT,re.assertType=Uq,re.calcExpiry=Yq,re.capitalize=Gq,re.capitalizeWord=hT,re.createDelayedPromise=Kq,re.createExpiringPromise=zq,re.decodeTypeByte=Wc,re.decrypt=Sq,re.deriveSymKey=Iq,re.deserialize=s1,re.encodeTypeByte=X2,re.encrypt=Cq,re.engineEvent=Xq,re.enumify=jq,re.formatAccountId=z2,re.formatAccountWithChain=hq,re.formatChainId=K2,re.formatExpirerTarget=c1,re.formatIdTarget=Wq,re.formatMessage=wq,re.formatMessageContext=qq,re.formatRelayParams=gT,re.formatRelayRpcUrl=Lq,re.formatTopicTarget=kq,re.formatUA=cT,re.formatUri=oV,re.generateKeyPair=Eq,re.generateRandomBytes32=Aq,re.getAccountsChains=fu,re.getAccountsFromNamespaces=pq,re.getAddressFromAccount=k2,re.getAddressesFromAccounts=dq,re.getAppMetadata=Mq,re.getChainFromAccount=W2,re.getChainsFromAccounts=$2,re.getChainsFromNamespace=kc,re.getChainsFromNamespaces=gq,re.getChainsFromRequiredNamespaces=yq,re.getDidAddress=J2,re.getDidAddressSegments=yd,re.getDidChainId=Y2,re.getEnvironment=u1,re.getHttpUrl=Fq,re.getInternalError=Vn,re.getJavascriptID=uT,re.getJavascriptOS=aT,re.getLastItems=fT,re.getNamespacedDidChainId=mq,re.getNamespacesChains=yT,re.getNamespacesEventsForChainId=wT,re.getNamespacesMethodsForChainId=mT,re.getRelayClientMetadata=Rq,re.getRelayProtocolApi=eV,re.getRelayProtocolName=Zq,re.getRequiredNamespacesFromNamespaces=aV,re.getSdkError=io,re.getUniqueValues=t1,re.hasOverlap=on,re.hashKey=_q,re.hashMessage=bq,re.isBrowser=sT,re.isConformingNamespaces=SV,re.isExpired=Jq,re.isNode=a1,re.isProposalStruct=hV,re.isReactNative=nT,re.isSessionCompatible=lV,re.isSessionStruct=dV,re.isTypeOneEnvelope=Tq,re.isUndefined=Hn,re.isValidAccountId=vT,re.isValidAccounts=IT,re.isValidActions=bT,re.isValidArray=$c,re.isValidChainId=vd,re.isValidChains=ET,re.isValidController=pV,re.isValidErrorReason=vV,re.isValidEvent=IV,re.isValidId=mV,re.isValidNamespaceAccounts=_T,re.isValidNamespaceActions=f1,re.isValidNamespaceChains=AT,re.isValidNamespaceMethodsOrEvents=Xw,re.isValidNamespaces=CT,re.isValidNamespacesChainId=_V,re.isValidNamespacesEvent=CV,re.isValidNamespacesRequest=bV,re.isValidNumber=wd,re.isValidObject=l1,re.isValidParams=wV,re.isValidRelay=ST,re.isValidRelays=yV,re.isValidRequest=EV,re.isValidRequestExpiry=xV,re.isValidRequiredNamespaces=gV,re.isValidResponse=AV,re.isValidString=Sr,re.isValidUrl=fV,re.mapEntries=Qq,re.mapToObj=Vq,re.objToMap=Hq,re.parseAccountId=e1,re.parseChainId=G2,re.parseContextNames=lT,re.parseExpirerTarget=$q,re.parseRelayParams=pT,re.parseUri=sV,re.serialize=Z2,re.validateDecoding=xq,re.validateEncoding=eT});var xT,TT,NT,DT,Ad,Yc,h1,Id,Qn,Jc,_d=me(()=>{f();xT="PARSE_ERROR",TT="INVALID_REQUEST",NT="METHOD_NOT_FOUND",DT="INVALID_PARAMS",Ad="INTERNAL_ERROR",Yc="SERVER_ERROR",h1=[-32700,-32600,-32601,-32602,-32603],Id=[-32e3,-32099],Qn={[xT]:{code:-32700,message:"Parse error"},[TT]:{code:-32600,message:"Invalid Request"},[NT]:{code:-32601,message:"Method not found"},[DT]:{code:-32602,message:"Invalid params"},[Ad]:{code:-32603,message:"Internal error"},[Yc]:{code:-32e3,message:"Server error"}},Jc=Yc});function TV(r){return r<=Id[0]&&r>=Id[1]}function bd(r){return h1.includes(r)}function OT(r){return typeof r=="number"}function Cd(r){return Object.keys(Qn).includes(r)?Qn[r]:Qn[Jc]}function Sd(r){let e=Object.values(Qn).find(t=>t.code===r);return e||Qn[Jc]}function NV(r){if(typeof r.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof r.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!OT(r.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${r.error.code}`};if(bd(r.error.code)){let e=Sd(r.error.code);if(e.message!==Qn[Jc].message&&r.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${r.error.code}`}}return{valid:!0}}function d1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var p1=me(()=>{f();_d()});var BT=B(jn=>{"use strict";f();Object.defineProperty(jn,"__esModule",{value:!0});jn.isBrowserCryptoAvailable=jn.getSubtleCrypto=jn.getBrowerCrypto=void 0;function g1(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}jn.getBrowerCrypto=g1;function PT(){let r=g1();return r.subtle||r.webkitSubtle}jn.getSubtleCrypto=PT;function DV(){return!!g1()&&!!PT()}jn.isBrowserCryptoAvailable=DV});var LT=B(Gn=>{"use strict";f();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.isBrowser=Gn.isNode=Gn.isReactNative=void 0;function MT(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Gn.isReactNative=MT;function RT(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}Gn.isNode=RT;function OV(){return!MT()&&!RT()}Gn.isBrowser=OV});var y1=B(xd=>{"use strict";f();Object.defineProperty(xd,"__esModule",{value:!0});var FT=(br(),at(_r));FT.__exportStar(BT(),xd);FT.__exportStar(LT(),xd)});var $t={};ot($t,{isNodeJs:()=>qT});var UT,qT,VT=me(()=>{f();UT=_e(y1());er($t,_e(y1()));qT=UT.isNode});function HT(){let r=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return r+e}function m1(r,e,t){return{id:t||HT(),jsonrpc:"2.0",method:r,params:e}}function PV(r,e){return{id:r,jsonrpc:"2.0",result:e}}function w1(r,e,t){return{id:r,jsonrpc:"2.0",error:QT(e,t)}}function QT(r,e){return typeof r>"u"?Cd(Ad):(typeof r=="string"&&(r=Object.assign(Object.assign({},Cd(Yc)),{message:r})),typeof e<"u"&&(r.data=e),bd(r.code)&&(r=Sd(r.code)),r)}var jT=me(()=>{f();p1();_d()});function BV(r){return r.includes("*")?Nd(r):!/\W/g.test(r)}function Td(r){return r==="*"}function Nd(r){return Td(r)?!0:!(!r.includes("*")||r.split("*").length!==2||r.split("*").filter(e=>e.trim()==="").length!==1)}function MV(r){return!Td(r)&&Nd(r)&&!r.split("*")[0].trim()}function RV(r){return!Td(r)&&Nd(r)&&!r.split("*")[1].trim()}var GT=me(()=>{f()});var KT=me(()=>{f()});var hu,v1=me(()=>{f();hu=class{}});var E1,Dd,Xc,zT=me(()=>{f();v1();E1=class extends hu{constructor(e){super()}},Dd=class extends hu{constructor(){super()}},Xc=class extends Dd{constructor(e){super()}}});var kT=me(()=>{f()});var WT=me(()=>{f();KT();v1();zT();kT()});var $T=me(()=>{f();WT()});function UV(r){let e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function YT(r,e){let t=UV(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function qV(r){return YT(r,LV)}function Od(r){return YT(r,FV)}function A1(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}var LV,FV,JT=me(()=>{f();LV="^https?:",FV="^wss?:"});function I1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function VV(r){return I1(r)&&"method"in r}function _1(r){return I1(r)&&(XT(r)||Pd(r))}function XT(r){return"result"in r}function Pd(r){return"error"in r}function HV(r){return"error"in r&&r.valid===!1}var ZT=me(()=>{f()});var lr={};ot(lr,{DEFAULT_ERROR:()=>Jc,IBaseJsonRpcProvider:()=>Dd,IEvents:()=>hu,IJsonRpcConnection:()=>E1,IJsonRpcProvider:()=>Xc,INTERNAL_ERROR:()=>Ad,INVALID_PARAMS:()=>DT,INVALID_REQUEST:()=>TT,METHOD_NOT_FOUND:()=>NT,PARSE_ERROR:()=>xT,RESERVED_ERROR_CODES:()=>h1,SERVER_ERROR:()=>Yc,SERVER_ERROR_CODE_RANGE:()=>Id,STANDARD_ERROR_MAP:()=>Qn,formatErrorMessage:()=>QT,formatJsonRpcError:()=>w1,formatJsonRpcRequest:()=>m1,formatJsonRpcResult:()=>PV,getError:()=>Cd,getErrorByCode:()=>Sd,isHttpUrl:()=>qV,isJsonRpcError:()=>Pd,isJsonRpcPayload:()=>I1,isJsonRpcRequest:()=>VV,isJsonRpcResponse:()=>_1,isJsonRpcResult:()=>XT,isJsonRpcValidationInvalid:()=>HV,isLocalhostUrl:()=>A1,isNodeJs:()=>qT,isReservedErrorCode:()=>bd,isServerErrorCode:()=>TV,isValidDefaultRoute:()=>Td,isValidErrorCode:()=>OT,isValidLeadingWildcardRoute:()=>MV,isValidRoute:()=>BV,isValidTrailingWildcardRoute:()=>RV,isValidWildcardRoute:()=>Nd,isWsUrl:()=>Od,parseConnectionError:()=>d1,payloadId:()=>HT,validateJsonRpcError:()=>NV});var Zc=me(()=>{f();_d();p1();VT();er(lr,$t);jT();GT();$T();JT();ZT()});var eN,Bd,tN,b1=me(()=>{f();eN=_e($s());Zc();Bd=class extends Xc{constructor(e){super(e),this.events=new eN.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(m1(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Pd(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),_1(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}},tN=Bd});var rN={};ot(rN,{JsonRpcProvider:()=>Bd,default:()=>QV});var QV,iN=me(()=>{f();b1();b1();QV=tN});var sN=B((jte,nN)=>{"use strict";f();nN.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var aN,oN,jV,GV,KV,Md,uN,C1=me(()=>{f();aN=_e($s());xh();Zc();oN=10,jV=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:sN(),GV=()=>typeof window<"u",KV=jV(),Md=class{constructor(e){if(this.url=e,this.events=new aN.EventEmitter,this.registering=!1,!Od(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=()=>{this.onClose(),e()},this.socket.close()})}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(xc(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Od(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,lr.isReactNative)()?void 0:{rejectUnauthorized:!A1(e)},s=new KV(e,[],n);GV()?s.onerror=o=>{let a=o;i(this.emitError(a.error))}:s.on("error",o=>{i(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=()=>this.onClose(),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t=typeof e.data=="string"?Sc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let i=this.parseError(t),n=i.message||i.toString(),s=w1(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return d1(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>oN&&this.events.setMaxListeners(oN)}emitError(e){let t=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",t),t}},uN=Md});var cN={};ot(cN,{WsConnection:()=>Md,default:()=>zV});var zV,lN=me(()=>{f();C1();C1();zV=uN});var KN=B((el,pu)=>{f();var kV=200,L1="__lodash_hash_undefined__",Qd=1,IN=2,_N=9007199254740991,Rd="[object Arguments]",N1="[object Array]",WV="[object AsyncFunction]",bN="[object Boolean]",CN="[object Date]",SN="[object Error]",xN="[object Function]",$V="[object GeneratorFunction]",Ld="[object Map]",TN="[object Number]",YV="[object Null]",du="[object Object]",fN="[object Promise]",JV="[object Proxy]",NN="[object RegExp]",Fd="[object Set]",DN="[object String]",XV="[object Symbol]",ZV="[object Undefined]",D1="[object WeakMap]",ON="[object ArrayBuffer]",Ud="[object DataView]",e7="[object Float32Array]",t7="[object Float64Array]",r7="[object Int8Array]",i7="[object Int16Array]",n7="[object Int32Array]",s7="[object Uint8Array]",o7="[object Uint8ClampedArray]",a7="[object Uint16Array]",u7="[object Uint32Array]",c7=/[\\^$.*+?()[\]{}|]/g,l7=/^\[object .+?Constructor\]$/,f7=/^(?:0|[1-9]\d*)$/,Xe={};Xe[e7]=Xe[t7]=Xe[r7]=Xe[i7]=Xe[n7]=Xe[s7]=Xe[o7]=Xe[a7]=Xe[u7]=!0;Xe[Rd]=Xe[N1]=Xe[ON]=Xe[bN]=Xe[Ud]=Xe[CN]=Xe[SN]=Xe[xN]=Xe[Ld]=Xe[TN]=Xe[du]=Xe[NN]=Xe[Fd]=Xe[DN]=Xe[D1]=!1;var PN=typeof global=="object"&&global&&global.Object===Object&&global,h7=typeof self=="object"&&self&&self.Object===Object&&self,an=PN||h7||Function("return this")(),BN=typeof el=="object"&&el&&!el.nodeType&&el,hN=BN&&typeof pu=="object"&&pu&&!pu.nodeType&&pu,MN=hN&&hN.exports===BN,S1=MN&&PN.process,dN=function(){try{return S1&&S1.binding&&S1.binding("util")}catch{}}(),pN=dN&&dN.isTypedArray;function d7(r,e){for(var t=-1,i=r==null?0:r.length,n=0,s=[];++t-1}function j7(r,e){var t=this.__data__,i=Gd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}un.prototype.clear=q7;un.prototype.delete=V7;un.prototype.get=H7;un.prototype.has=Q7;un.prototype.set=j7;function oo(r){var e=-1,t=r==null?0:r.length;for(this.clear();++ea))return!1;var h=s.get(r);if(h&&s.get(e))return h==e;var p=-1,w=!0,N=t&IN?new Vd:void 0;for(s.set(r,e),s.set(e,r);++p-1&&r%1==0&&r-1&&r%1==0&&r<=_N}function jN(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function il(r){return r!=null&&typeof r=="object"}var GN=pN?m7(pN):oH;function EH(r){return wH(r)?rH(r):aH(r)}function AH(){return[]}function IH(){return!1}pu.exports=vH});var z3=B(Ee=>{"use strict";f();Object.defineProperty(Ee,"__esModule",{value:!0});var uo=$s(),_H=lh(),bH=TC(),ip=GC(),st=bm(),kn=Hm(),zN=(xh(),at(JC)),CH=(Ax(),at(Ex)),fe=Ed(),Ht=Ys(),SH=(iN(),at(rN)),ti=(Zc(),at(lr)),xH=(lN(),at(cN)),TH=KN();function ol(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}function NH(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var DH=ol(uo),c3=ol(_H),OH=ol(bH),zd=NH(CH),PH=ol(xH),BH=ol(TH);function MH(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var RH=MH,LH=RH,l3=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},FH=r=>new TextEncoder().encode(r),UH=r=>new TextDecoder().decode(r),q1=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},V1=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 f3(this,e)}},H1=class{constructor(e){this.decoders=e}or(e){return f3(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},f3=(r,e)=>new H1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Q1=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new q1(e,t,i),this.decoder=new V1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},np=({name:r,prefix:e,encode:t,decode:i})=>new Q1(r,e,t,i),al=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=LH(t,e);return np({prefix:r,name:e,encode:i,decode:s=>l3(n(s))})},qH=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},VH=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<np({prefix:e,name:r,encode(n){return VH(n,i,t)},decode(n){return qH(n,i,t,r)}}),HH=np({prefix:"\0",name:"identity",encode:r=>UH(r),decode:r=>FH(r)}),QH=Object.freeze({__proto__:null,identity:HH}),jH=tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),GH=Object.freeze({__proto__:null,base2:jH}),KH=tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),zH=Object.freeze({__proto__:null,base8:KH}),kH=al({prefix:"9",name:"base10",alphabet:"0123456789"}),WH=Object.freeze({__proto__:null,base10:kH}),$H=tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),YH=tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),JH=Object.freeze({__proto__:null,base16:$H,base16upper:YH}),XH=tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ZH=tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),eQ=tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tQ=tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rQ=tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iQ=tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nQ=tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sQ=tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),oQ=tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),aQ=Object.freeze({__proto__:null,base32:XH,base32upper:ZH,base32pad:eQ,base32padupper:tQ,base32hex:rQ,base32hexupper:iQ,base32hexpad:nQ,base32hexpadupper:sQ,base32z:oQ}),uQ=al({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cQ=al({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),lQ=Object.freeze({__proto__:null,base36:uQ,base36upper:cQ}),fQ=al({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hQ=al({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),dQ=Object.freeze({__proto__:null,base58btc:fQ,base58flickr:hQ}),pQ=tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gQ=tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yQ=tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mQ=tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),wQ=Object.freeze({__proto__:null,base64:pQ,base64pad:gQ,base64url:yQ,base64urlpad:mQ}),h3=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}"),vQ=h3.reduce((r,e,t)=>(r[t]=e,r),[]),EQ=h3.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function AQ(r){return r.reduce((e,t)=>(e+=vQ[t],e),"")}function IQ(r){let e=[];for(let t of r){let i=EQ[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var _Q=np({prefix:"\u{1F680}",name:"base256emoji",encode:AQ,decode:IQ}),bQ=Object.freeze({__proto__:null,base256emoji:_Q}),CQ=d3,kN=128,SQ=127,xQ=~SQ,TQ=Math.pow(2,31);function d3(r,e,t){e=e||[],t=t||0;for(var i=t;r>=TQ;)e[t++]=r&255|kN,r/=128;for(;r&xQ;)e[t++]=r&255|kN,r>>>=7;return e[t]=r|0,d3.bytes=t-i+1,e}var NQ=j1,DQ=128,WN=127;function j1(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw j1.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WN)<=DQ);return j1.bytes=s-i,t}var OQ=Math.pow(2,7),PQ=Math.pow(2,14),BQ=Math.pow(2,21),MQ=Math.pow(2,28),RQ=Math.pow(2,35),LQ=Math.pow(2,42),FQ=Math.pow(2,49),UQ=Math.pow(2,56),qQ=Math.pow(2,63),VQ=function(r){return r(p3.encode(r,e,t),e),YN=r=>p3.encodingLength(r),G1=(r,e)=>{let t=e.byteLength,i=YN(r),n=i+YN(t),s=new Uint8Array(n+t);return $N(r,s,0),$N(t,s,i),s.set(e,n),new K1(r,t,e,s)},K1=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}},g3=({name:r,code:e,encode:t})=>new z1(r,e,t),z1=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?G1(this.code,t):t.then(i=>G1(this.code,i))}else throw Error("Unknown type, must be binary type")}},y3=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),QQ=g3({name:"sha2-256",code:18,encode:y3("SHA-256")}),jQ=g3({name:"sha2-512",code:19,encode:y3("SHA-512")}),GQ=Object.freeze({__proto__:null,sha256:QQ,sha512:jQ}),m3=0,KQ="identity",w3=l3,zQ=r=>G1(m3,w3(r)),kQ={code:m3,name:KQ,encode:w3,digest:zQ},WQ=Object.freeze({__proto__:null,identity:kQ});new TextEncoder,new TextDecoder;var JN={...QH,...GH,...zH,...WH,...JH,...aQ,...lQ,...dQ,...wQ,...bQ};({...GQ,...WQ});function $Q(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function v3(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var XN=v3("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),F1=v3("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=$Q(r.length);for(let t=0;t{if(!this.initialized){let i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();let n=this.keychain.get(i);if(typeof n>"u"){let{message:s}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$d=class{constructor(e,t,i){this.core=e,this.logger=t,this.name=_3,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();let n=await this.getClientSeed(),s=zd.generateKeyPair(n);return zd.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let n=fe.generateKeyPair();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();let s=await this.getClientSeed(),o=zd.generateKeyPair(s),a=fe.generateRandomBytes32(),u=b3;return await zd.signJWT(a,n,u,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();let a=this.getPrivateKey(n),u=fe.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();let o=s||fe.hashKey(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();let a=fe.validateEncoding(o),u=zN.safeJsonStringify(s);if(fe.isTypeOneEnvelope(a)){let N=a.senderPublicKey,O=a.receiverPublicKey;n=await this.generateSharedKey(N,O)}let h=this.getSymKey(n),{type:p,senderPublicKey:w}=a;return fe.encrypt({type:p,symKey:h,message:u,senderPublicKey:w})},this.decode=async(n,s,o)=>{this.isInitialized();let a=fe.validateDecoding(s,o);if(fe.isTypeOneEnvelope(a)){let p=a.receiverPublicKey,w=a.senderPublicKey;n=await this.generateSharedKey(p,w)}let u=this.getSymKey(n),h=fe.decrypt({symKey:u,encoded:s});return zN.safeJsonParse(h)},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.keychain=i||new Wd(this.core,this.logger)}get context(){return st.getLoggerContext(this.logger)}getPayloadType(e){let t=fe.deserialize(e);return fe.decodeTypeByte(t.type)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(k1)}catch{e=fe.generateRandomBytes32(),await this.keychain.set(k1,e)}return JQ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Yd=class extends kn.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=x3,this.version=T3,this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();let s=fe.hashMessage(n),o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();let s=this.get(i),o=fe.hashMessage(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=st.generateChildLogger(e,this.name),this.core=t}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$1=class extends kn.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new uo.EventEmitter,this.name=D3,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(i,n,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});try{let o=s?.ttl||N3,a=fe.getRelayProtocolName(s),u=s?.prompt||!1,h=s?.tag||0,p={topic:i,message:n,opts:{ttl:o,relay:a,prompt:u,tag:h}},w=fe.hashMessage(n);this.queue.set(w,p);try{await await fe.createExpiringPromise(this.rpcPublish(i,n,o,a,u,h),this.publishTimeout),this.relayer.events.emit(fr.publish,p)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(fr.connection_stalled);return}this.onPublish(w,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return st.getLoggerContext(this.logger)}rpcPublish(e,t,i,n,s,o){var a,u,h,p;let w={method:fe.getRelayProtocolApi(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o}};return fe.isUndefined((a=w.params)==null?void 0:a.prompt)&&((u=w.params)==null||delete u.prompt),fe.isUndefined((h=w.params)==null?void 0:h.tag)&&((p=w.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:w}),this.relayer.provider.request(w)}onPublish(e,t){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},Y1=class{constructor(){this.map=new Map,this.set=(e,t)=>{let i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let i=this.get(e);if(!this.exists(e,t))return;let n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,ZN=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,e3=(r,e,t)=>e in r?r9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kd=(r,e)=>{for(var t in e||(e={}))s9.call(e,t)&&e3(r,t,e[t]);if(ZN)for(var t of ZN(e))o9.call(e,t)&&e3(r,t,e[t]);return r},U1=(r,e)=>i9(r,n9(e)),Jd=class extends kn.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Y1,this.events=new uo.EventEmitter,this.name=F3,this.version=U3,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=cn,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{let s=fe.getRelayProtocolName(n),o={topic:i,relay:s};this.pending.set(i,o);let a=await this.rpcSubscribe(i,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((n,s)=>{let o=new Ht.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),n(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=q3&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.clientId=""}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,t){let i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{let n=fe.getRelayProtocolName(i);await this.rpcUnsubscribe(e,t,n);let s=fe.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t){let i={method:fe.getRelayProtocolApi(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await fe.createExpiringPromise(this.relayer.provider.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(fr.connection_stalled)}return fe.hashMessage(e+this.clientId)}rpcUnsubscribe(e,t,i){let n={method:fe.getRelayProtocolApi(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.provider.request(n)}onSubscribe(e,t){this.setSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}onResubscribe(e,t){this.addSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,kd({},t)),this.topicMap.set(t.topic,e),this.events.emit(ei.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ei.deleted,U1(kd({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ei.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(ei.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}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 resubscribe(e){if(!this.ids.includes(e.id)){let{topic:t,relay:i}=e,n={topic:t,relay:i};this.pending.set(n.topic,n);let s=await this.rpcSubscribe(n.topic,n.relay);this.onResubscribe(s,n)}}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{let t=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(fr.connect,async()=>{await this.onConnect()}),this.relayer.on(fr.disconnect,()=>{this.onDisconnect()}),this.events.on(ei.created,async e=>{let t=ei.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(ei.deleted,async e=>{let t=ei.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}},a9=Object.defineProperty,t3=Object.getOwnPropertySymbols,u9=Object.prototype.hasOwnProperty,c9=Object.prototype.propertyIsEnumerable,r3=(r,e,t)=>e in r?a9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l9=(r,e)=>{for(var t in e||(e={}))u9.call(e,t)&&r3(r,t,e[t]);if(t3)for(var t of t3(e))c9.call(e,t)&&r3(r,t,e[t]);return r},Xd=class extends kn.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new uo.EventEmitter,this.name=B3,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?st.generateChildLogger(e.logger,this.name):c3.default(st.getDefaultLoggerOptions({level:e.logger||P3})),this.messages=new Yd(this.logger,e.core),this.subscriber=new Jd(this,this.logger),this.publisher=new $1(this,this.logger),this.relayUrl=e?.relayUrl||X1,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return st.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t})}async subscribe(e,t){this.isInitialized();let i="";return await Promise.all([new Promise(n=>{this.subscriber.once(ei.created,s=>{s.topic===e&&n()})}),new Promise(async n=>{i=await this.subscriber.subscribe(e,t),n()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(fr.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(t=>{this.initialized||t(),this.subscriber.once(ei.resubscribed,()=>{t()})}),await Promise.race([new Promise(async t=>{await this.provider.connect(),this.removeListener(fr.transport_closed,this.rejectTransportOpen),t()}),new Promise(t=>this.once(fr.transport_closed,this.rejectTransportOpen))])])}catch(t){let i=t;if(!/socket hang up/i.test(i.message))throw t;this.logger.error(t),this.events.emit(fr.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(await this.transportClose(),await new Promise(t=>setTimeout(t,W1)),await this.transportOpen(e))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);return new SH.JsonRpcProvider(new PH.default(fe.formatRelayRpcUrl({sdkVersion:R3,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){let{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){let{topic:t,message:i}=e;return await this.subscriber.isSubscribed(t)?this.messages.has(t,i):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ti.isJsonRpcRequest(e)){if(!e.method.endsWith(M3))return;let t=e.params,{topic:i,message:n}=t.data,s={topic:i,message:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(l9({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(fr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=ti.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}registerEventListeners(){this.provider.on(sl.payload,e=>this.onProviderPayload(e)),this.provider.on(sl.connect,()=>{this.events.emit(fr.connect)}),this.provider.on(sl.disconnect,()=>{this.events.emit(fr.disconnect),this.attemptToReconnect()}),this.provider.on(sl.error,e=>this.events.emit(fr.error,e)),this.events.on(fr.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Ht.toMiliseconds(W1))}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},f9=Object.defineProperty,i3=Object.getOwnPropertySymbols,h9=Object.prototype.hasOwnProperty,d9=Object.prototype.propertyIsEnumerable,n3=(r,e,t)=>e in r?f9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,s3=(r,e)=>{for(var t in e||(e={}))h9.call(e,t)&&n3(r,t,e[t]);if(i3)for(var t of i3(e))d9.call(e,t)&&n3(r,t,e[t]);return r},Zd=class extends kn.IStore{constructor(e,t,i,n=cn,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=L3,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{fe.isProposalStruct(o)?this.map.set(o.id,o):fe.isSessionStruct(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!fe.isUndefined(o)&&this.map.set(this.getKey(o),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=>BH.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=s3(s3({},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=st.generateChildLogger(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 t=this.map.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ep=class{constructor(e,t){this.core=e,this.logger=t,this.name=V3,this.version=H3,this.events=new DH.default,this.initialized=!1,this.storagePrefix=cn,this.ignoredPayloadTypes=[fe.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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();let i=fe.generateRandomBytes32(),n=await this.core.crypto.setSymKey(i),s=fe.calcExpiry(Ht.FIVE_MINUTES),o={protocol:O3},a={topic:n,expiry:s,relay:o,active:!1},u=fe.formatUri({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:i,relay:o});return await this.pairings.set(n,a),await this.core.relayer.subscribe(n),this.core.expirer.set(n,s),{topic:n,uri:u}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);let{topic:n,symKey:s,relay:o}=fe.parseUri(i.uri),a=fe.calcExpiry(Ht.FIVE_MINUTES),u={topic:n,relay:o,expiry:a,active:!1};return await this.pairings.set(n,u),await this.core.crypto.setSymKey(s,n),await this.core.relayer.subscribe(n,{relay:o}),this.core.expirer.set(n,a),i.activatePairing&&await this.activate({topic:n}),u},this.activate=async({topic:i})=>{this.isInitialized();let n=fe.calcExpiry(Ht.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:n}),this.core.expirer.set(i,n)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);let{topic:n}=i;if(this.pairings.keys.includes(n)){let s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=fe.createDelayedPromise();this.events.once(fe.engineEvent("pairing_ping",s),({error:h})=>{h?u(h):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);let{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",fe.getSdkError("USER_DISCONNECTED")),await this.deletePairing(n))},this.sendRequest=async(i,n,s)=>{let o=ti.formatJsonRpcRequest(n,s),a=await this.core.crypto.encode(i,o),u=yu[n].req;return this.core.history.set(i,o),await this.core.relayer.publish(i,a,u),o.id},this.sendResult=async(i,n,s)=>{let o=ti.formatJsonRpcResult(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=yu[u.request.method].res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{let o=ti.formatJsonRpcError(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=yu[u.request.method]?yu[u.request.method].res:yu.unregistered_method.res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,fe.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{let i=this.pairings.getAll().filter(n=>fe.isExpired(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{let{topic:n,payload:s}=i,o=s.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{let{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{let{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit("pairing_ping",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{let{id:s}=n;setTimeout(()=>{ti.isJsonRpcResult(n)?this.events.emit(fe.engineEvent("pairing_ping",s),{}):ti.isJsonRpcError(n)&&this.events.emit(fe.engineEvent("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{let{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.sendResult(s,i,!0),await this.deletePairing(i),this.events.emit("pairing_delete",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{let{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;let a=fe.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(fe.getSdkError("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!fe.isValidParams(i)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!fe.isValidUrl(i.uri)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}},this.isValidPing=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!fe.isValidString(i,!1)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){let{message:n}=fe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(fe.isExpired(this.pairings.get(i).expiry)){await this.deletePairing(i);let{message:n}=fe.getInternalError("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.pairings=new Zd(this.core,this.logger,this.name,this.storagePrefix)}get context(){return st.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(fr.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;let n=await this.core.crypto.decode(t,i);ti.isJsonRpcRequest(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):ti.isJsonRpcResponse(n)&&(await this.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:t}=fe.parseExpirerTarget(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}},tp=class extends kn.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new uo.EventEmitter,this.name=Q3,this.version=j3,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;let o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Zr.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;let n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ti.isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.events.emit(Zr.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Zr.deleted,s)}})},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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(t=>{if(typeof t.response<"u")return;let i={topic:t.topic,request:ti.formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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(Zr.created,e=>{let t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{let t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{let t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},rp=class extends kn.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new uo.EventEmitter,this.name=G3,this.version=K3,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{let n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();let s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Vr.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();let n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){let n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Vr.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 fe.formatTopicTarget(e);if(typeof e=="number")return fe.formatIdTarget(e);let{message:t}=fe.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 t=this.expirations.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){let{expiry:i}=t;Ht.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let t=Vr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let t=Vr.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let t=Vr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},p9=Object.defineProperty,o3=Object.getOwnPropertySymbols,g9=Object.prototype.hasOwnProperty,y9=Object.prototype.propertyIsEnumerable,a3=(r,e,t)=>e in r?p9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,u3=(r,e)=>{for(var t in e||(e={}))g9.call(e,t)&&a3(r,t,e[t]);if(o3)for(var t of o3(e))y9.call(e,t)&&a3(r,t,e[t]);return r},mu=class extends kn.ICore{constructor(e){super(e),this.protocol=J1,this.version=E3,this.name=sp,this.events=new uo.EventEmitter,this.initialized=!1,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||X1;let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:c3.default(st.getDefaultLoggerOptions({level:e?.logger||A3.logger}));this.logger=st.generateChildLogger(t,this.name),this.heartbeat=new ip.HeartBeat,this.crypto=new $d(this,this.logger,e?.keychain),this.history=new tp(this,this.logger),this.expirer=new rp(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new OH.default(u3(u3({},I3),e?.storageOptions)),this.relayer=new Xd({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ep(this,this.logger)}static async init(e){let t=new mu(e);return await t.initialize(),t}get context(){return st.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}}},m9=mu;Ee.CORE_CONTEXT=sp,Ee.CORE_DEFAULT=A3,Ee.CORE_PROTOCOL=J1,Ee.CORE_STORAGE_OPTIONS=I3,Ee.CORE_STORAGE_PREFIX=cn,Ee.CORE_VERSION=E3,Ee.CRYPTO_CLIENT_SEED=k1,Ee.CRYPTO_CONTEXT=_3,Ee.CRYPTO_JWT_TTL=b3,Ee.Core=m9,Ee.Crypto=$d,Ee.EXPIRER_CONTEXT=G3,Ee.EXPIRER_DEFAULT_TTL=t9,Ee.EXPIRER_EVENTS=Vr,Ee.EXPIRER_STORAGE_VERSION=K3,Ee.Expirer=rp,Ee.HISTORY_CONTEXT=Q3,Ee.HISTORY_EVENTS=Zr,Ee.HISTORY_STORAGE_VERSION=j3,Ee.JsonRpcHistory=tp,Ee.KEYCHAIN_CONTEXT=C3,Ee.KEYCHAIN_STORAGE_VERSION=S3,Ee.KeyChain=Wd,Ee.MESSAGES_CONTEXT=x3,Ee.MESSAGES_STORAGE_VERSION=T3,Ee.MessageTracker=Yd,Ee.PAIRING_CONTEXT=V3,Ee.PAIRING_DEFAULT_TTL=e9,Ee.PAIRING_RPC_OPTS=yu,Ee.PAIRING_STORAGE_VERSION=H3,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=q3,Ee.PUBLISHER_CONTEXT=D3,Ee.PUBLISHER_DEFAULT_TTL=N3,Ee.Pairing=ep,Ee.RELAYER_CONTEXT=B3,Ee.RELAYER_DEFAULT_LOGGER=P3,Ee.RELAYER_DEFAULT_PROTOCOL=O3,Ee.RELAYER_DEFAULT_RELAY_URL=X1,Ee.RELAYER_EVENTS=fr,Ee.RELAYER_PROVIDER_EVENTS=sl,Ee.RELAYER_RECONNECT_TIMEOUT=W1,Ee.RELAYER_SDK_VERSION=R3,Ee.RELAYER_STORAGE_OPTIONS=XQ,Ee.RELAYER_SUBSCRIBER_SUFFIX=M3,Ee.Relayer=Xd,Ee.STORE_STORAGE_VERSION=L3,Ee.SUBSCRIBER_CONTEXT=F3,Ee.SUBSCRIBER_DEFAULT_TTL=ZQ,Ee.SUBSCRIBER_EVENTS=ei,Ee.SUBSCRIBER_STORAGE_VERSION=U3,Ee.Store=Zd,Ee.Subscriber=Jd,Ee.default=mu});var rD=B(lt=>{"use strict";f();Object.defineProperty(lt,"__esModule",{value:!0});var w9=lh(),Wn=z3(),Z1=bm(),$3=Hm(),te=Ed(),Y3=$s(),ft=Ys(),Qt=(Zc(),at(lr));function J3(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var v9=J3(w9),E9=J3(Y3),sv="wc",ov=2,av="client",up=`${sv}@${ov}:${av}:`,op={name:av,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},A9={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"},I9={database:":memory:"},_9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},b9="history",C9="0.3",X3="proposal",S9=ft.THIRTY_DAYS,Z3="session",ul=ft.SEVEN_DAYS,eD="engine",wu={wc_sessionPropose:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1115}}},ap={min:ft.FIVE_MINUTES,max:ft.SEVEN_DAYS},tD="request",x9=Object.defineProperty,T9=Object.defineProperties,N9=Object.getOwnPropertyDescriptors,k3=Object.getOwnPropertySymbols,D9=Object.prototype.hasOwnProperty,O9=Object.prototype.propertyIsEnumerable,W3=(r,e,t)=>e in r?x9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hr=(r,e)=>{for(var t in e||(e={}))D9.call(e,t)&&W3(r,t,e[t]);if(k3)for(var t of k3(e))O9.call(e,t)&&W3(r,t,e[t]);return r},ev=(r,e)=>T9(r,N9(e)),tv=class extends $3.IEngine{constructor(e){super(e),this.name=eD,this.events=new E9.default,this.initialized=!1,this.ignoredPayloadTypes=[te.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(wu)}),this.initialized=!0)},this.connect=async t=>{this.isInitialized();let i=ev(Hr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);let{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=i,h=n,p,w=!1;if(h&&(w=this.client.core.pairing.pairings.get(h).active),!h||!w){let{topic:Y,uri:j}=await this.client.core.pairing.create();h=Y,p=j}let N=await this.client.core.crypto.generateKeyPair(),O=Hr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Wn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:N,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:T,resolve:V,done:z}=te.createDelayedPromise();if(this.events.once(te.engineEvent("session_connect"),async({error:Y,session:j})=>{if(Y)T(Y);else if(j){j.self.publicKey=N;let W=ev(Hr({},j),{requiredNamespaces:j.requiredNamespaces,optionalNamespaces:j.optionalNamespaces});await this.client.session.set(j.topic,W),await this.setExpiry(j.topic,j.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:j.peer.metadata}),V(W)}}),!h){let{message:Y}=te.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(Y)}let $=await this.sendRequest(h,"wc_sessionPropose",O),se=te.calcExpiry(ft.FIVE_MINUTES);return await this.setProposal($,Hr({id:$,expiry:se},O)),{uri:p,approval:z}},this.pair=async t=>(this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{this.isInitialized(),await this.isValidApprove(t);let{id:i,relayProtocol:n,namespaces:s,sessionProperties:o}=t,a=this.client.proposal.get(i),{pairingTopic:u,proposer:h,requiredNamespaces:p,optionalNamespaces:w}=a;te.isValidObject(p)||(p=te.getRequiredNamespacesFromNamespaces(s,"approve()"));let N=await this.client.core.crypto.generateKeyPair(),O=h.publicKey,T=await this.client.core.crypto.generateSharedKey(N,O);u&&i&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:h.metadata}),await this.sendResult(i,u,{relay:{protocol:n??"irn"},responderPublicKey:N}),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let V=Hr({relay:{protocol:n??"irn"},namespaces:s,requiredNamespaces:p,optionalNamespaces:w,controller:{publicKey:N,metadata:this.client.metadata},expiry:te.calcExpiry(ul)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(T);let z=await this.sendRequest(T,"wc_sessionSettle",V),{done:$,resolve:se,reject:Y}=te.createDelayedPromise();this.events.once(te.engineEvent("session_approve",z),({error:W})=>{W?Y(W):se(this.client.session.get(T))});let j=ev(Hr({},V),{topic:T,acknowledged:!1,self:V.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:N});return await this.client.session.set(T,j),await this.setExpiry(T,te.calcExpiry(ul)),{topic:T,acknowledged:$}},this.reject=async t=>{this.isInitialized(),await this.isValidReject(t);let{id:i,reason:n}=t,{pairingTopic:s}=this.client.proposal.get(i);s&&(await this.sendError(i,s,n),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.isValidUpdate(t);let{topic:i,namespaces:n}=t,s=await this.sendRequest(i,"wc_sessionUpdate",{namespaces:n}),{done:o,resolve:a,reject:u}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_update",s),({error:h})=>{h?u(h):a()}),await this.client.session.update(i,{namespaces:n}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.isValidExtend(t);let{topic:i}=t,n=await this.sendRequest(i,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_extend",n),({error:u})=>{u?a(u):o()}),await this.setExpiry(i,te.calcExpiry(ul)),{acknowledged:s}},this.request=async t=>{this.isInitialized(),await this.isValidRequest(t);let{chainId:i,request:n,topic:s,expiry:o}=t,a=await this.sendRequest(s,"wc_sessionRequest",{request:n,chainId:i},o),{done:u,resolve:h,reject:p}=te.createDelayedPromise(o);return this.events.once(te.engineEvent("session_request",a),({error:w,result:N})=>{w?p(w):h(N)}),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i}),await u()},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);let{topic:i,response:n}=t,{id:s}=n;Qt.isJsonRpcResult(n)?await this.sendResult(s,i,n.result):Qt.isJsonRpcError(n)&&await this.sendError(s,i,n.error),this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0})},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);let{topic:i}=t;if(this.client.session.keys.includes(i)){let n=await this.sendRequest(i,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();this.events.once(te.engineEvent("session_ping",n),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.isValidEmit(t);let{topic:i,event:n,chainId:s}=t;await this.sendRequest(i,"wc_sessionEvent",{event:n,chainId:s})},this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);let{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest(i,"wc_sessionDelete",te.getSdkError("USER_DISCONNECTED")),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>te.isSessionCompatible(i,t))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(t,i)=>{let{self:n}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await Promise.all([this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.deleteSymKey(t),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,te.getSdkError("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.setPendingSessionRequest=async t=>{let i=wu.wc_sessionRequest.req.ttl,{id:n,topic:s,params:o}=t;await this.client.pendingRequest.set(n,{id:n,topic:s,params:o}),i&&this.client.core.expirer.set(n,te.calcExpiry(i))},this.sendRequest=async(t,i,n,s)=>{let o=Qt.formatJsonRpcRequest(i,n),a=await this.client.core.crypto.encode(t,o),u=wu[i].req;return s&&(u.ttl=s),this.client.core.history.set(t,o),this.client.core.relayer.publish(t,a,u),o.id},this.sendResult=async(t,i,n)=>{let s=Qt.formatJsonRpcResult(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=wu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.sendError=async(t,i,n)=>{let s=Qt.formatJsonRpcError(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=wu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let t=[],i=[];this.client.session.getAll().forEach(n=>{te.isExpired(n.expiry)&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{te.isExpired(n.expiry)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession(n)),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=t=>{let{topic:i,payload:n}=t,s=n.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(i,n);case"wc_sessionSettle":return this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return this.onSessionExtendRequest(i,n);case"wc_sessionPing":return this.onSessionPingRequest(i,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return this.onSessionRequest(i,n);case"wc_sessionEvent":return this.onSessionEventRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async t=>{let{topic:i,payload:n}=t,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidConnect(Hr({},i.params));let o=te.calcExpiry(ft.FIVE_MINUTES),a=Hr({id:s,pairingTopic:t,expiry:o},n);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(t,i)=>{let{id:n}=i;if(Qt.isJsonRpcResult(i)){let{result:s}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(n);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 h=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});let p=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:t})}else Qt.isJsonRpcError(i)&&(await this.client.proposal.delete(n,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:h,requiredNamespaces:p,optionalNamespaces:w,sessionProperties:N}=i.params,O=Hr({topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,requiredNamespaces:p,optionalNamespaces:w,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},N&&{sessionProperties:N});await this.sendResult(i.id,t,!0),this.events.emit(te.engineEvent("session_connect"),{session:O})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(te.engineEvent("session_approve",n),{})):Qt.isJsonRpcError(i)&&(await this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidUpdate(Hr({topic:t},n)),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult(s,t,!0),this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_update",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{let{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,te.calcExpiry(ul)),await this.sendResult(n,t,!0),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_extend",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{let{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult(n,t,!0),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{let{id:n}=i;setTimeout(()=>{Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_ping",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{let{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),this.client.core.relayer.once(Wn.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(t)}),await this.sendResult(n,t,!0),this.client.events.emit("session_delete",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidRequest(Hr({topic:t},s)),await this.setPendingSessionRequest({id:n,topic:t,params:s}),this.client.events.emit("session_request",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_request",n),{result:i.result}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidEmit(Hr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.isValidConnect=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(u)}let{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:a}=t;if(te.isUndefined(i)||await this.isValidPairingTopic(i),!te.isValidRelays(a,!0)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!te.isUndefined(n)&&te.isValidObject(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!te.isUndefined(s)&&te.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(t,i)=>{let n=te.isValidRequiredNamespaces(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!te.isValidParams(t))throw new Error(te.getInternalError("MISSING_OR_INVALID",`approve() params: ${t}`).message);let{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=t;await this.isValidProposalId(i);let a=this.client.proposal.get(i),u=te.isValidNamespaces(n,"approve()");if(u)throw new Error(u.message);let h=te.isConformingNamespaces(a.requiredNamespaces,n,"approve()","requiredNamespaces");if(h)throw new Error(h.message);if(!te.isValidString(s,!0)){let{message:p}=te.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(p)}if(Object.keys(n).length>Object.keys(a.requiredNamespaces).length){let p=Object.keys(a.optionalNamespaces).filter(O=>n[O]),w={};for(let O in a.optionalNamespaces)p.includes(O)&&(w[O]=a.optionalNamespaces[O]);let N=te.isConformingNamespaces(w,n,"approve()","optionalNamespaces");if(N)throw new Error(N.message)}te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}let{id:i,reason:n}=t;if(await this.isValidProposalId(i),!te.isValidErrorReason(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!te.isValidParams(t)){let{message:h}=te.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}let{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!te.isValidRelay(i)){let{message:h}=te.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}let a=te.isValidController(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=te.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(te.isExpired(o)){let{message:h}=te.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}let{topic:i,namespaces:n}=t;await this.isValidSessionTopic(i);let s=this.client.session.get(i),o=te.isValidNamespaces(n,"update()");if(o)throw new Error(o.message);let a=te.isConformingNamespaces(s.requiredNamespaces,n,"update()","requiredNamespaces");if(a)throw new Error(a.message)},this.isValidExtend=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(u)}let{topic:i,request:n,chainId:s,expiry:o}=t;await this.isValidSessionTopic(i);let{namespaces:a}=this.client.session.get(i);if(!te.isValidNamespacesChainId(a,s)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!te.isValidRequest(n)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(u)}if(!te.isValidNamespacesRequest(a,s,n.method)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(u)}if(o&&!te.isValidRequestExpiry(o,ap)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ap.min} and ${ap.max}`);throw new Error(u)}},this.isValidRespond=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(s)}let{topic:i,response:n}=t;if(await this.isValidSessionTopic(i),!te.isValidResponse(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidPing=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!te.isValidParams(t)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}let{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!te.isValidNamespacesChainId(o,s)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!te.isValidEvent(n)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!te.isValidNamespacesEvent(o,s,n.name)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!te.isValidString(n,!1)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`${i} must be in Record format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(Wn.RELAYER_EVENTS.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;let n=await this.client.core.crypto.decode(t,i);Qt.isJsonRpcRequest(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):Qt.isJsonRpcResponse(n)&&(await this.client.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.client.core.expirer.on(Wn.EXPIRER_EVENTS.expired,async e=>{let{topic:t,id:i}=te.parseExpirerTarget(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,te.getInternalError("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}isValidPairingTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=te.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=te.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(t)}}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(te.isValidString(e,!1)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!te.isValidId(e)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=te.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},rv=class extends Wn.Store{constructor(e,t){super(e,t,X3,up),this.core=e,this.logger=t}},iv=class extends Wn.Store{constructor(e,t){super(e,t,Z3,up),this.core=e,this.logger=t}},nv=class extends Wn.Store{constructor(e,t){super(e,t,tD,up),this.core=e,this.logger=t}},vu=class extends $3.ISignClient{constructor(e){super(e),this.protocol=sv,this.version=ov,this.name=op.name,this.events=new Y3.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||op.name,this.metadata=e?.metadata||te.getAppMetadata();let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:v9.default(Z1.getDefaultLoggerOptions({level:e?.logger||op.logger}));this.core=e?.core||new Wn.Core(e),this.logger=Z1.generateChildLogger(t,this.name),this.session=new iv(this.core,this.logger),this.proposal=new rv(this.core,this.logger),this.pendingRequest=new nv(this.core,this.logger),this.engine=new tv(this)}static async init(e){let t=new vu(e);return await t.initialize(),t}get context(){return Z1.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.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},P9=vu;lt.ENGINE_CONTEXT=eD,lt.ENGINE_RPC_OPTS=wu,lt.HISTORY_CONTEXT=b9,lt.HISTORY_EVENTS=_9,lt.HISTORY_STORAGE_VERSION=C9,lt.PROPOSAL_CONTEXT=X3,lt.PROPOSAL_EXPIRY=S9,lt.REQUEST_CONTEXT=tD,lt.SESSION_CONTEXT=Z3,lt.SESSION_EXPIRY=ul,lt.SESSION_REQUEST_EXPIRY_BOUNDARIES=ap,lt.SIGN_CLIENT_CONTEXT=av,lt.SIGN_CLIENT_DEFAULT=op,lt.SIGN_CLIENT_EVENTS=A9,lt.SIGN_CLIENT_PROTOCOL=sv,lt.SIGN_CLIENT_STORAGE_OPTIONS=I9,lt.SIGN_CLIENT_STORAGE_PREFIX=up,lt.SIGN_CLIENT_VERSION=ov,lt.SignClient=P9,lt.default=vu});var iD=B(Mi=>{"use strict";f();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.WALLETCONNECT_OLD_METHOD_PREFIX=Mi.WALLETCONNECT_OLD_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE="multiversx";Mi.WALLETCONNECT_OLD_NAMESPACE="elrond";Mi.WALLETCONNECT_OLD_METHOD_PREFIX="erd"});var nD=B($n=>{"use strict";f();Object.defineProperty($n,"__esModule",{value:!0});$n.OldOperation=$n.Operation=void 0;var B9;(function(r){r.SIGN_TRANSACTION="multiversx_signTransaction",r.SIGN_TRANSACTIONS="multiversx_signTransactions",r.SIGN_MESSAGE="multiversx_signMessage",r.SIGN_LOGIN_TOKEN="multiversx_signLoginToken"})(B9=$n.Operation||($n.Operation={}));var M9;(function(r){r.SIGN_TRANSACTION="erd_signTransaction",r.SIGN_TRANSACTIONS="erd_signTransactions",r.SIGN_MESSAGE="erd_signMessage",r.SIGN_LOGIN_TOKEN="erd_signLoginToken"})(M9=$n.OldOperation||($n.OldOperation={}))});var sD=B(cp=>{"use strict";f();Object.defineProperty(cp,"__esModule",{value:!0});cp.Logger=void 0;var uv=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};cp.Logger=uv});var oD=B(Eu=>{"use strict";f();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.Signature=Eu.Address=void 0;var cv=class{constructor(e){this.value=e}bech32(){return this.value}};Eu.Address=cv;var cl=class{constructor(e){this.buffer=e}static fromHex(e){return new cl(y.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Eu.Signature=cl});var hv=B(ri=>{"use strict";f();Object.defineProperty(ri,"__esModule",{value:!0});ri.WalletConnectV2ProviderErrorMessagesEnum=ri.ErrBadAddress=ri.ErrNotImplemented=ri.Err=void 0;var ll=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};ri.Err=ll;var lv=class extends ll{constructor(){super("Method not yet implemented")}};ri.ErrNotImplemented=lv;var fv=class extends ll{constructor(e,t){super(`Bad address: ${e}`,t)}};ri.ErrBadAddress=fv;var R9;(function(r){r.unableToInit="WalletConnect is unable to init",r.notInitialized="WalletConnect is not initialized",r.unableToConnect="WalletConnect is unable to connect",r.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",r.unableToSignLoginToken="WalletConnect could not sign login token",r.unableToLogin="WalletConnect is unable to login",r.unableToHandleTopic="WalletConnect: Unable to handle topic update",r.unableToHandleEvent="WalletConnect: Unable to handle events",r.sessionNotConnected="WalletConnect Session is not connected",r.sessionDeleted="WalletConnect Session Deleted",r.sessionExpired="WalletConnect Session Expired",r.alreadyLoggedOut="WalletConnect: Already logged out",r.pingFailed="WalletConnect Ping Failed",r.invalidAddress="WalletConnect: Invalid address",r.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",r.invalidMessageResponse="WalletConnect could not sign the message",r.invalidMessageSignature="WalletConnect: Invalid message signature",r.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",r.invalidCustomRequestResponse="WalletConnect could not send the custom request",r.transactionError="Transaction canceled",r.connectionError="WalletConnect could not establish a connection"})(R9=ri.WalletConnectV2ProviderErrorMessagesEnum||(ri.WalletConnectV2ProviderErrorMessagesEnum={}))});var uD=B(Ri=>{"use strict";f();var L9=Ri&&Ri.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),F9=Ri&&Ri.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),U9=Ri&&Ri.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&L9(e,r,t);return F9(e,r),e};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.UserAddress=void 0;var q9=U9(kl()),aD=hv(),V9="erd",fl=class{constructor(e){this.value=e}static fromBech32(e){let t;try{t=q9.decode(e)}catch(i){throw new aD.ErrBadAddress(e,i)}if(t.prefix!=V9)throw new aD.ErrBadAddress(e);return new fl(e)}bech32(){return this.value}};Ri.UserAddress=fl});var dl=B(Fi=>{"use strict";f();var Yt=Fi&&Fi.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},H9=Fi&&Fi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.WalletConnectV2Provider=Fi.WalletConnectV2ProviderErrorMessagesEnum=void 0;var Q9=H9(rD()),cD=Ed(),Ke=iD(),Li=nD(),Le=sD(),hl=oD(),pe=hv();Object.defineProperty(Fi,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return pe.WalletConnectV2ProviderErrorMessagesEnum}});var lp=uD(),dv=class{constructor(e,t,i,n,s){this.chainId="",this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.options={},this.onClientConnect=e,this.chainId=t,this.walletConnectV2Relay=i,this.walletConnectV2ProjectId=n,this.options=s}reset(){this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.session=void 0}init(){return Yt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{this.reset();let e=yield Q9.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,t)=>e(Boolean(this.isInitialized()&&typeof this.session<"u")))}connect(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"&&(yield this.init()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=[...Object.values(Li.Operation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)):[]],n=[...Object.values(Li.OldOperation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)):[]],s=[`${Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=[`${Ke.WALLETCONNECT_OLD_NAMESPACE}:${this.chainId}`],a=(t=e?.events)!==null&&t!==void 0?t:[];try{let u=yield this.walletConnector.connect({pairingTopic:e?.topic,requiredNamespaces:{[Ke.WALLETCONNECT_OLD_NAMESPACE]:{methods:n,chains:o,events:a}},optionalNamespaces:{[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:a}}});return this.events=a,this.methods=i,u}catch{throw e?.topic?(yield this.logout({topic:e.topic}),Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting)):(Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect))}})}login(e){var t,i;return Yt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout());try{if(e&&e.approval){let n=yield e.approval();if(!((t=n?.namespaces)===null||t===void 0)&&t[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((i=n?.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE),e.token){let s=this.getAddressFromSession(n),{signature:o}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_LOGIN_TOKEN:Li.OldOperation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:s}}});if(!o)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:o})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let i=(t=e?.topic)!==null&&t!==void 0?t:this.getCurrentTopic(this.walletConnector);if(i){yield this.walletConnector.disconnect({topic:i,reason:cD.getSdkError("USER_DISCONNECTED")});let n=this.walletConnector.core.pairing.pairings.getAll({active:!0}).filter(s=>s.topic!==i);this.pairings=n}}catch{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0}),this.reset()}return!0})}getAddress(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(e=this.pairings)!==null&&e!==void 0?e:this.walletConnector.core.pairing.pairings.getAll({active:!0})})}signMessage(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),{signature:i}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_MESSAGE:Li.OldOperation.SIGN_MESSAGE,params:{address:t,message:e.message.toString()}}});if(!i)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new hl.Signature(i),lp.UserAddress.fromBech32(t))}catch{throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.toPlainObject(i);if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTION:Li.OldOperation.SIGN_TRANSACTION,params:{transaction:n}}});if(!s)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(hl.Signature.fromHex(s),lp.UserAddress.fromBech32(t)),e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(i)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTIONS:Li.OldOperation.SIGN_TRANSACTIONS,params:{transactions:n}}});(!s||!Array.isArray(s))&&Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(hl.Signature.fromHex(s[o].signature),lp.UserAddress.fromBech32(t));return e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((t=e?.request)===null||t===void 0)&&t.method){let i=Object.assign({},e.request),{method:n}=i;i.method.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)&&this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_OLD_METHOD_PREFIX,this.namespace)),i.method.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)&&this.namespace===Ke.WALLETCONNECT_OLD_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE,Ke.WALLETCONNECT_OLD_METHOD_PREFIX));let{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},i),{method:n})});if(!s)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{return yield this.walletConnector.ping({topic:this.getCurrentTopic(this.walletConnector)}),!0}catch{return Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return Yt(this,void 0,void 0,function*(){if(e){if(this.addressIsValid(e.address)){this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin();return}if(Le.Logger.error(`${pe.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector){yield this.walletConnector.disconnect({topic:this.getCurrentTopic(this.walletConnector),reason:cD.getSdkError("USER_DISCONNECTED")});let t=this.walletConnector.core.pairing.pairings.getAll({active:!0});this.pairings=t}}})}onSessionConnected(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session,!((i=(t=e.session)===null||t===void 0?void 0:t.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((s=(n=e.session)===null||n===void 0?void 0:n.namespaces)===null||s===void 0)&&s[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE);let o=this.getAddressFromSession(e.session);return o&&(yield this.loginAccount({address:o,signature:e.signature})),""})}handleTopicUpdateEvent({topic:e}){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.address&&!this.isInitializing&&this.pairings)if(((t=this.pairings)===null||t===void 0?void 0:t.length)===0)this.onClientConnect.onClientLogout();else{let i=this.pairings[this.pairings.length-1];i?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0})}})}handleSessionEvents({topic:e,params:t}){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let{event:i}=t;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let n=i.data;this.onClientConnect.onClientEvent(n)}})}subscribeToEvents(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{let{namespaces:u}=a,h=e.session.get(o),p=Object.assign(Object.assign({},h),{namespaces:u});this.onSessionConnected({session:p})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",()=>{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout()}),e.on("session_expire",()=>{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout()}),(i=(t=e?.core)===null||t===void 0?void 0:t.pairing)===null||i===void 0||i.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(n=e?.core)===null||n===void 0?void 0:n.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=e.pairing.getAll({active:!0}),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let t=this.getCurrentSession(e);if(t)return yield this.onSessionConnected({session:t}),t}})}getCurrentSession(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t])}else throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t]).topic}else throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}addressIsValid(e){try{return!!lp.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){var t;let i=e.namespaces[(t=this.namespace)!==null&&t!==void 0?t:Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(i&&i.accounts){let n=i.accounts[0],[s,o,a]=n.split(":");return a}return""}};Fi.WalletConnectV2Provider=dv});var fD=B((mre,lD)=>{"use strict";f();lD.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var pD=B((vre,dD)=>{"use strict";f();var hD=typeof Symbol<"u"&&Symbol,j9=fD();dD.exports=function(){return typeof hD!="function"||typeof Symbol!="function"||typeof hD("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:j9()}});var yD=B((Are,gD)=>{"use strict";f();var G9="Function.prototype.bind called on incompatible ",pv=Array.prototype.slice,K9=Object.prototype.toString,z9="[object Function]";gD.exports=function(e){var t=this;if(typeof t!="function"||K9.call(t)!==z9)throw new TypeError(G9+t);for(var i=pv.call(arguments,1),n,s=function(){if(this instanceof n){var p=t.apply(this,i.concat(pv.call(arguments)));return Object(p)===p?p:this}else return t.apply(e,i.concat(pv.call(arguments)))},o=Math.max(0,t.length-i.length),a=[],u=0;u{"use strict";f();var k9=yD();mD.exports=Function.prototype.bind||k9});var vD=B((Cre,wD)=>{"use strict";f();var W9=fp();wD.exports=W9.call(Function.call,Object.prototype.hasOwnProperty)});var pp=B((xre,_D)=>{"use strict";f();var Fe,Cu=SyntaxError,ID=Function,_u=TypeError,gv=function(r){try{return ID('"use strict"; return ('+r+").constructor;")()}catch{}},co=Object.getOwnPropertyDescriptor;if(co)try{co({},"")}catch{co=null}var yv=function(){throw new _u},$9=co?function(){try{return arguments.callee,yv}catch{try{return co(arguments,"callee").get}catch{return yv}}}():yv,Au=pD()(),Yn=Object.getPrototypeOf||function(r){return r.__proto__},Iu={},Y9=typeof Uint8Array>"u"?Fe:Yn(Uint8Array),bu={"%AggregateError%":typeof AggregateError>"u"?Fe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Fe:ArrayBuffer,"%ArrayIteratorPrototype%":Au?Yn([][Symbol.iterator]()):Fe,"%AsyncFromSyncIteratorPrototype%":Fe,"%AsyncFunction%":Iu,"%AsyncGenerator%":Iu,"%AsyncGeneratorFunction%":Iu,"%AsyncIteratorPrototype%":Iu,"%Atomics%":typeof Atomics>"u"?Fe:Atomics,"%BigInt%":typeof BigInt>"u"?Fe:BigInt,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Fe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Fe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Fe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Fe:FinalizationRegistry,"%Function%":ID,"%GeneratorFunction%":Iu,"%Int8Array%":typeof Int8Array>"u"?Fe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Fe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Fe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Au?Yn(Yn([][Symbol.iterator]())):Fe,"%JSON%":typeof JSON=="object"?JSON:Fe,"%Map%":typeof Map>"u"?Fe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Au?Fe:Yn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Fe:Promise,"%Proxy%":typeof Proxy>"u"?Fe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Fe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Fe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Au?Fe:Yn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Fe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Au?Yn(""[Symbol.iterator]()):Fe,"%Symbol%":Au?Symbol:Fe,"%SyntaxError%":Cu,"%ThrowTypeError%":$9,"%TypedArray%":Y9,"%TypeError%":_u,"%Uint8Array%":typeof Uint8Array>"u"?Fe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Fe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Fe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Fe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Fe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Fe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Fe:WeakSet},J9=function r(e){var t;if(e==="%AsyncFunction%")t=gv("async function () {}");else if(e==="%GeneratorFunction%")t=gv("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=gv("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&(t=Yn(n.prototype))}return bu[e]=t,t},ED={"%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"]},pl=fp(),hp=vD(),X9=pl.call(Function.call,Array.prototype.concat),Z9=pl.call(Function.apply,Array.prototype.splice),AD=pl.call(Function.call,String.prototype.replace),dp=pl.call(Function.call,String.prototype.slice),ej=pl.call(Function.call,RegExp.prototype.exec),tj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,rj=/\\(\\)?/g,ij=function(e){var t=dp(e,0,1),i=dp(e,-1);if(t==="%"&&i!=="%")throw new Cu("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Cu("invalid intrinsic syntax, expected opening `%`");var n=[];return AD(e,tj,function(s,o,a,u){n[n.length]=a?AD(u,rj,"$1"):o||s}),n},nj=function(e,t){var i=e,n;if(hp(ED,i)&&(n=ED[i],i="%"+n[0]+"%"),hp(bu,i)){var s=bu[i];if(s===Iu&&(s=J9(i)),typeof s>"u"&&!t)throw new _u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Cu("intrinsic "+e+" does not exist!")};_D.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new _u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new _u('"allowMissing" argument must be a boolean');if(ej(/^%?[^%]*%?$/,e)===null)throw new Cu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=ij(e),n=i.length>0?i[0]:"",s=nj("%"+n+"%",t),o=s.name,a=s.value,u=!1,h=s.alias;h&&(n=h[0],Z9(i,X9([0,1],h)));for(var p=1,w=!0;p=i.length){var V=co(a,N);w=!!V,w&&"get"in V&&!("originalValue"in V.get)?a=V.get:a=a[N]}else w=hp(a,N),a=a[N];w&&!u&&(bu[o]=a)}}return a}});var ND=B((Nre,gp)=>{"use strict";f();var mv=fp(),Su=pp(),SD=Su("%Function.prototype.apply%"),xD=Su("%Function.prototype.call%"),TD=Su("%Reflect.apply%",!0)||mv.call(xD,SD),bD=Su("%Object.getOwnPropertyDescriptor%",!0),lo=Su("%Object.defineProperty%",!0),sj=Su("%Math.max%");if(lo)try{lo({},"a",{value:1})}catch{lo=null}gp.exports=function(e){var t=TD(mv,xD,arguments);if(bD&&lo){var i=bD(t,"length");i.configurable&&lo(t,"length",{value:1+sj(0,e.length-(arguments.length-1))})}return t};var CD=function(){return TD(mv,SD,arguments)};lo?lo(gp.exports,"apply",{value:CD}):gp.exports.apply=CD});var BD=B((Ore,PD)=>{"use strict";f();var DD=pp(),OD=ND(),oj=OD(DD("String.prototype.indexOf"));PD.exports=function(e,t){var i=DD(e,!!t);return typeof i=="function"&&oj(e,".prototype.")>-1?OD(i):i}});var MD=B(()=>{f()});var eO=B((Lre,ZD)=>{f();var xv=typeof Map=="function"&&Map.prototype,wv=Object.getOwnPropertyDescriptor&&xv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mp=xv&&wv&&typeof wv.get=="function"?wv.get:null,RD=xv&&Map.prototype.forEach,Tv=typeof Set=="function"&&Set.prototype,vv=Object.getOwnPropertyDescriptor&&Tv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wp=Tv&&vv&&typeof vv.get=="function"?vv.get:null,LD=Tv&&Set.prototype.forEach,aj=typeof WeakMap=="function"&&WeakMap.prototype,yl=aj?WeakMap.prototype.has:null,uj=typeof WeakSet=="function"&&WeakSet.prototype,ml=uj?WeakSet.prototype.has:null,cj=typeof WeakRef=="function"&&WeakRef.prototype,FD=cj?WeakRef.prototype.deref:null,lj=Boolean.prototype.valueOf,fj=Object.prototype.toString,hj=Function.prototype.toString,dj=String.prototype.match,Nv=String.prototype.slice,Xn=String.prototype.replace,pj=String.prototype.toUpperCase,UD=String.prototype.toLowerCase,kD=RegExp.prototype.test,qD=Array.prototype.concat,Ui=Array.prototype.join,gj=Array.prototype.slice,VD=Math.floor,Iv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ev=Object.getOwnPropertySymbols,_v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xu||"symbol")?Symbol.toStringTag:null,WD=Object.prototype.propertyIsEnumerable,HD=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function QD(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||kD.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-VD(-r):VD(r);if(i!==r){var n=String(i),s=Nv.call(e,n.length+1);return Xn.call(n,t,"$&_")+"."+Xn.call(Xn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xn.call(e,t,"$&_")}var bv=MD(),jD=bv.custom,GD=YD(jD)?jD:null;ZD.exports=function r(e,t,i,n){var s=t||{};if(Jn(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Jn(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=Jn(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(Jn(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(Jn(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 XD(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?QD(e,u):u}if(typeof e=="bigint"){var h=String(e)+"n";return a?QD(e,h):h}var p=typeof s.depth>"u"?5:s.depth;if(typeof i>"u"&&(i=0),i>=p&&p>0&&typeof e=="object")return Cv(e)?"[Array]":"[Object]";var w=Bj(s,i);if(typeof n>"u")n=[];else if(JD(n,e)>=0)return"[Circular]";function N(A,c,d){if(c&&(n=gj.call(n),n.push(c)),d){var g={depth:s.depth};return Jn(s,"quoteStyle")&&(g.quoteStyle=s.quoteStyle),r(A,g,i+1,n)}return r(A,s,i+1,n)}if(typeof e=="function"&&!KD(e)){var O=bj(e),T=yp(e,N);return"[Function"+(O?": "+O:" (anonymous)")+"]"+(T.length>0?" { "+Ui.call(T,", ")+" }":"")}if(YD(e)){var V=xu?Xn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_v.call(e);return typeof e=="object"&&!xu?gl(V):V}if(Dj(e)){for(var z="<"+UD.call(String(e.nodeName)),$=e.attributes||[],se=0;se<$.length;se++)z+=" "+$[se].name+"="+$D(yj($[se].value),"double",s);return z+=">",e.childNodes&&e.childNodes.length&&(z+="..."),z+="",z}if(Cv(e)){if(e.length===0)return"[]";var Y=yp(e,N);return w&&!Pj(Y)?"["+Sv(Y,w)+"]":"[ "+Ui.call(Y,", ")+" ]"}if(wj(e)){var j=yp(e,N);return!("cause"in Error.prototype)&&"cause"in e&&!WD.call(e,"cause")?"{ ["+String(e)+"] "+Ui.call(qD.call("[cause]: "+N(e.cause),j),", ")+" }":j.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Ui.call(j,", ")+" }"}if(typeof e=="object"&&o){if(GD&&typeof e[GD]=="function"&&bv)return bv(e,{depth:p-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Cj(e)){var W=[];return RD&&RD.call(e,function(A,c){W.push(N(c,e,!0)+" => "+N(A,e))}),zD("Map",mp.call(e),W,w)}if(Tj(e)){var k=[];return LD&&LD.call(e,function(A){k.push(N(A,e))}),zD("Set",wp.call(e),k,w)}if(Sj(e))return Av("WeakMap");if(Nj(e))return Av("WeakSet");if(xj(e))return Av("WeakRef");if(Ej(e))return gl(N(Number(e)));if(Ij(e))return gl(N(Iv.call(e)));if(Aj(e))return gl(lj.call(e));if(vj(e))return gl(N(String(e)));if(!mj(e)&&!KD(e)){var R=yp(e,N),F=HD?HD(e)===Object.prototype:e instanceof Object||e.constructor===Object,G=e instanceof Object?"":"null prototype",ce=!F&&hr&&Object(e)===e&&hr in e?Nv.call(Zn(e),8,-1):G?"Object":"",J=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=J+(ce||G?"["+Ui.call(qD.call([],ce||[],G||[]),": ")+"] ":"");return R.length===0?X+"{}":w?X+"{"+Sv(R,w)+"}":X+"{ "+Ui.call(R,", ")+" }"}return String(e)};function $D(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function yj(r){return Xn.call(String(r),/"/g,""")}function Cv(r){return Zn(r)==="[object Array]"&&(!hr||!(typeof r=="object"&&hr in r))}function mj(r){return Zn(r)==="[object Date]"&&(!hr||!(typeof r=="object"&&hr in r))}function KD(r){return Zn(r)==="[object RegExp]"&&(!hr||!(typeof r=="object"&&hr in r))}function wj(r){return Zn(r)==="[object Error]"&&(!hr||!(typeof r=="object"&&hr in r))}function vj(r){return Zn(r)==="[object String]"&&(!hr||!(typeof r=="object"&&hr in r))}function Ej(r){return Zn(r)==="[object Number]"&&(!hr||!(typeof r=="object"&&hr in r))}function Aj(r){return Zn(r)==="[object Boolean]"&&(!hr||!(typeof r=="object"&&hr in r))}function YD(r){if(xu)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!_v)return!1;try{return _v.call(r),!0}catch{}return!1}function Ij(r){if(!r||typeof r!="object"||!Iv)return!1;try{return Iv.call(r),!0}catch{}return!1}var _j=Object.prototype.hasOwnProperty||function(r){return r in this};function Jn(r,e){return _j.call(r,e)}function Zn(r){return fj.call(r)}function bj(r){if(r.name)return r.name;var e=dj.call(hj.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function JD(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return XD(Nv.call(r,0,e.maxStringLength),e)+i}var n=Xn.call(Xn.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Oj);return $D(n,"single",e)}function Oj(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+pj.call(e.toString(16))}function gl(r){return"Object("+r+")"}function Av(r){return r+" { ? }"}function zD(r,e,t,i){var n=i?Sv(t,i):Ui.call(t,", ");return r+" ("+e+") {"+n+"}"}function Pj(r){for(var e=0;e=0)return!1;return!0}function Bj(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Ui.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Ui.call(Array(e+1),t)}}function Sv(r,e){if(r.length===0)return"";var t=` -`+e.prev+e.base;return t+Ui.call(r,","+t)+` -`+e.prev}function yp(r,e){var t=Cv(r),i=[];if(t){i.length=r.length;for(var n=0;n{"use strict";f();var Dv=pp(),Tu=BD(),Mj=eO(),Rj=Dv("%TypeError%"),vp=Dv("%WeakMap%",!0),Ep=Dv("%Map%",!0),Lj=Tu("WeakMap.prototype.get",!0),Fj=Tu("WeakMap.prototype.set",!0),Uj=Tu("WeakMap.prototype.has",!0),qj=Tu("Map.prototype.get",!0),Vj=Tu("Map.prototype.set",!0),Hj=Tu("Map.prototype.has",!0),Ov=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},Qj=function(r,e){var t=Ov(r,e);return t&&t.value},jj=function(r,e,t){var i=Ov(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},Gj=function(r,e){return!!Ov(r,e)};tO.exports=function(){var e,t,i,n={assert:function(s){if(!n.has(s))throw new Rj("Side channel does not contain "+Mj(s))},get:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Lj(e,s)}else if(Ep){if(t)return qj(t,s)}else if(i)return Qj(i,s)},has:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Uj(e,s)}else if(Ep){if(t)return Hj(t,s)}else if(i)return Gj(i,s);return!1},set:function(s,o){vp&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new vp),Fj(e,s,o)):Ep?(t||(t=new Ep),Vj(t,s,o)):(i||(i={key:{},next:null}),jj(i,s,o))}};return n}});var Ap=B((Vre,iO)=>{"use strict";f();var Kj=String.prototype.replace,zj=/%20/g,Pv={RFC1738:"RFC1738",RFC3986:"RFC3986"};iO.exports={default:Pv.RFC3986,formatters:{RFC1738:function(r){return Kj.call(r,zj,"+")},RFC3986:function(r){return String(r)}},RFC1738:Pv.RFC1738,RFC3986:Pv.RFC3986}});var Mv=B((Qre,sO)=>{"use strict";f();var kj=Ap(),Bv=Object.prototype.hasOwnProperty,fo=Array.isArray,qi=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Wj=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(fo(i)){for(var n=[],s=0;s=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===kj.RFC1738&&(h===40||h===41)){a+=o.charAt(u);continue}if(h<128){a=a+qi[h];continue}if(h<2048){a=a+(qi[192|h>>6]+qi[128|h&63]);continue}if(h<55296||h>=57344){a=a+(qi[224|h>>12]+qi[128|h>>6&63]+qi[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|o.charCodeAt(u)&1023),a+=qi[240|h>>18]+qi[128|h>>12&63]+qi[128|h>>6&63]+qi[128|h&63]}return a},Zj=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],n=0;n{"use strict";f();var uO=rO(),Lv=Mv(),wl=Ap(),nG=Object.prototype.hasOwnProperty,oO={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ho=Array.isArray,sG=String.prototype.split,oG=Array.prototype.push,cO=function(r,e){oG.apply(r,ho(e)?e:[e])},aG=Date.prototype.toISOString,aO=wl.default,rr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Lv.encode,encodeValuesOnly:!1,format:aO,formatter:wl.formatters[aO],indices:!1,serializeDate:function(e){return aG.call(e)},skipNulls:!1,strictNullHandling:!1},uG=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Rv={},cG=function r(e,t,i,n,s,o,a,u,h,p,w,N,O,T,V){for(var z=e,$=V,se=0,Y=!1;($=$.get(Rv))!==void 0&&!Y;){var j=$.get(e);if(se+=1,typeof j<"u"){if(j===se)throw new RangeError("Cyclic object value");Y=!0}typeof $.get(Rv)>"u"&&(se=0)}if(typeof a=="function"?z=a(t,z):z instanceof Date?z=p(z):i==="comma"&&ho(z)&&(z=Lv.maybeMap(z,function(m){return m instanceof Date?p(m):m})),z===null){if(n)return o&&!O?o(t,rr.encoder,T,"key",w):t;z=""}if(uG(z)||Lv.isBuffer(z)){if(o){var W=O?t:o(t,rr.encoder,T,"key",w);if(i==="comma"&&O){for(var k=sG.call(String(z),","),R="",F=0;F"u")return G;var ce;if(i==="comma"&&ho(z))ce=[{value:z.length>0?z.join(",")||null:void 0}];else if(ho(a))ce=a;else{var J=Object.keys(z);ce=u?J.sort(u):J}for(var X=0;X"u"?rr.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:rr.charsetSentinel,delimiter:typeof e.delimiter>"u"?rr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:rr.encode,encoder:typeof e.encoder=="function"?e.encoder:rr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:rr.encodeValuesOnly,filter:s,format:i,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:rr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:rr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:rr.strictNullHandling}};lO.exports=function(r,e){var t=r,i=lG(e),n,s;typeof i.filter=="function"?(s=i.filter,t=s("",t)):ho(i.filter)&&(s=i.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in oO?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=oO[a];n||(n=Object.keys(t)),i.sort&&n.sort(i.sort);for(var h=uO(),p=0;p0?O+N:""}});var pO=B((zre,dO)=>{"use strict";f();var Nu=Mv(),Fv=Object.prototype.hasOwnProperty,fG=Array.isArray,Jt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Nu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},hG=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},hO=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},dG="utf8=%26%2310003%3B",pG="utf8=%E2%9C%93",gG=function(e,t){var i={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),a=-1,u,h=t.charset;if(t.charsetSentinel)for(u=0;u-1&&(T=fG(T)?[T]:T),Fv.call(i,O)?i[O]=Nu.combine(i[O],T):i[O]=T}return i},yG=function(r,e,t,i){for(var n=i?e:hO(e,t),s=r.length-1;s>=0;--s){var o,a=r[s];if(a==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(u,10);!t.parseArrays&&u===""?o={0:n}:!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=n):u!=="__proto__"&&(o[u]=n)}n=o}return n},mG=function(e,t,i,n){if(e){var s=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=i.depth>0&&o.exec(s),h=u?s.slice(0,u.index):s,p=[];if(h){if(!i.plainObjects&&Fv.call(Object.prototype,h)&&!i.allowPrototypes)return;p.push(h)}for(var w=0;i.depth>0&&(u=a.exec(s))!==null&&w"u"?Jt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Jt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Jt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Jt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Jt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Jt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Jt.comma,decoder:typeof e.decoder=="function"?e.decoder:Jt.decoder,delimiter:typeof e.delimiter=="string"||Nu.isRegExp(e.delimiter)?e.delimiter:Jt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Jt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Jt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Jt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Jt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Jt.strictNullHandling}};dO.exports=function(r,e){var t=wG(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?gG(r,t):r,n=t.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o{"use strict";f();var vG=fO(),EG=pO(),AG=Ap();gO.exports={formats:AG,parse:EG,stringify:vG}});var Uv=B(ht=>{"use strict";f();Object.defineProperty(ht,"__esModule",{value:!0});ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ht.WALLET_PROVIDER_CALLBACK_PARAM=ht.WALLET_PROVIDER_SIGN_MESSAGE_URL=ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ht.WALLET_PROVIDER_SEND_TRANSACTION_URL=ht.WALLET_PROVIDER_DISCONNECT_URL=ht.WALLET_PROVIDER_CONNECT_URL=ht.WALLET_PROVIDER_TESTNET=ht.WALLET_PROVIDER_DEVNET=ht.WALLET_PROVIDER_MAINNET=void 0;ht.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_CONNECT_URL="hook/login";ht.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ht.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ht.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ht.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var mO=B(Du=>{"use strict";f();Object.defineProperty(Du,"__esModule",{value:!0});Du.ErrInvalidTxSignReturnValue=Du.Err=void 0;var Ip=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Du.Err=Ip;var qv=class extends Ip{constructor(){super("Invalid response in transaction sign return url")}};Du.ErrInvalidTxSignReturnValue=qv});var wO=B(_p=>{"use strict";f();Object.defineProperty(_p,"__esModule",{value:!0});_p.PlainSignedTransaction=void 0;var Vv=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.options=void 0,this.signature="",Object.assign(this,e)}};_p.PlainSignedTransaction=Vv});var vl=B(es=>{"use strict";f();var po=es&&es.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},IG=es&&es.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var vO=IG(yO()),go=Uv(),EO=mO(),_G=wO(),Ou=class{constructor(e){this.walletUrl=e}login(e){return po(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(t,e?.redirectDelayMilliseconds),t})}redirect(e,t){return po(this,void 0,void 0,function*(){t?yield this.redirectLater(e,t):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,t){return po(this,void 0,void 0,function*(){yield new Promise(i=>{setTimeout(()=>{window.location.href=e,i(!0)},t)})})}logout(e){return po(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(t,e?.redirectDelayMilliseconds),!0})}signMessage(e,t){return po(this,void 0,void 0,function*(){let i=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:t?.callbackUrl,params:{message:e}});return yield this.redirect(i),i})}signTransactions(e,t){return po(this,void 0,void 0,function*(){let i={};e.map(s=>{let o=Ou.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(o[a])});let n=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:t?.callbackUrl,params:i});window.location.href=n})}signTransaction(e,t){return po(this,void 0,void 0,function*(){yield this.signTransactions([e],t)})}getTransactionsFromWalletUrl(){let e=vO.default.parse(window.location.search.slice(1));return Ou.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(go.WALLET_PROVIDER_CALLBACK_PARAM)&&e[go.WALLET_PROVIDER_CALLBACK_PARAM]===go.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var t;console.info(`Received urlParams: ${e}`);let i=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of i)if(!e[o]||!Array.isArray(e[o]))throw new EO.ErrInvalidTxSignReturnValue;let n=e.nonce.length;for(let o of i)if(e[o].length!==n)throw new EO.ErrInvalidTxSignReturnValue;let s=[];for(let o=0;o{f()});var xO=B((SO,Hv)=>{f();(function(r,e){"use strict";function t(A,c){if(!A)throw new Error(c||"Assertion failed")}function i(A,c){A.super_=c;var d=function(){};d.prototype=c.prototype,A.prototype=new d,A.prototype.constructor=A}function n(A,c,d){if(n.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,A!==null&&((c==="le"||c==="be")&&(d=c,c=10),this._init(A||0,c||10,d||"be"))}typeof r=="object"?r.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=CO().Buffer}catch{}n.isBN=function(c){return c instanceof n?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===n.wordSize&&Array.isArray(c.words)},n.max=function(c,d){return c.cmp(d)>0?c:d},n.min=function(c,d){return c.cmp(d)<0?c:d},n.prototype._init=function(c,d,g){if(typeof c=="number")return this._initNumber(c,d,g);if(typeof c=="object")return this._initArray(c,d,g);d==="hex"&&(d=16),t(d===(d|0)&&d>=2&&d<=36),c=c.toString().replace(/\s+/g,"");var m=0;c[0]==="-"&&(m++,this.negative=1),m=0;m-=3)S=c[m]|c[m-1]<<8|c[m-2]<<16,this.words[v]|=S<>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);else if(g==="le")for(m=0,v=0;m>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);return this._strip()};function o(A,c){var d=A.charCodeAt(c);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;t(!1,"Invalid character in "+A)}function a(A,c,d){var g=o(A,d);return d-1>=c&&(g|=o(A,d-1)<<4),g}n.prototype._parseHex=function(c,d,g){this.length=Math.ceil((c.length-d)/6),this.words=new Array(this.length);for(var m=0;m=d;m-=2)D=a(c,d,m)<=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8;else{var I=c.length-d;for(m=I%2===0?d+1:d;m=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8}this._strip()};function u(A,c,d,g){for(var m=0,v=0,S=Math.min(A.length,d),D=c;D=49?v=I-49+10:I>=17?v=I-17+10:v=I,t(I>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{n.prototype.inspect=p}else n.prototype.inspect=p;function p(){return(this.red?""}var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],N=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(c,d){c=c||10,d=d|0||1;var g;if(c===16||c==="hex"){g="";for(var m=0,v=0,S=0;S>>24-m&16777215,m+=2,m>=26&&(m-=26,S--),v!==0||S!==this.length-1?g=w[6-I.length]+I+g:g=I+g}for(v!==0&&(g=v.toString(16)+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var l=N[c],C=O[c];g="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ie=Z.modrn(C).toString(c);Z=Z.idivn(C),Z.isZero()?g=ie+g:g=w[l-ie.length]+ie+g}for(this.isZero()&&(g="0"+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}t(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(c,d){return this.toArrayLike(s,c,d)}),n.prototype.toArray=function(c,d){return this.toArrayLike(Array,c,d)};var T=function(c,d){return c.allocUnsafe?c.allocUnsafe(d):new c(d)};n.prototype.toArrayLike=function(c,d,g){this._strip();var m=this.byteLength(),v=g||Math.max(1,m);t(m<=v,"byte array longer than desired length"),t(v>0,"Requested array length <= 0");var S=T(c,v),D=d==="le"?"LE":"BE";return this["_toArrayLike"+D](S,m),S},n.prototype._toArrayLikeLE=function(c,d){for(var g=0,m=0,v=0,S=0;v>8&255),g>16&255),S===6?(g>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g=0&&(c[g--]=D>>8&255),g>=0&&(c[g--]=D>>16&255),S===6?(g>=0&&(c[g--]=D>>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g>=0)for(c[g--]=m;g>=0;)c[g--]=0},Math.clz32?n.prototype._countBits=function(c){return 32-Math.clz32(c)}:n.prototype._countBits=function(c){var d=c,g=0;return d>=4096&&(g+=13,d>>>=13),d>=64&&(g+=7,d>>>=7),d>=8&&(g+=4,d>>>=4),d>=2&&(g+=2,d>>>=2),g+d},n.prototype._zeroBits=function(c){if(c===0)return 26;var d=c,g=0;return d&8191||(g+=13,d>>>=13),d&127||(g+=7,d>>>=7),d&15||(g+=4,d>>>=4),d&3||(g+=2,d>>>=2),d&1||g++,g},n.prototype.bitLength=function(){var c=this.words[this.length-1],d=this._countBits(c);return(this.length-1)*26+d};function V(A){for(var c=new Array(A.bitLength()),d=0;d>>m&1}return c}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,d=0;dc.length?this.clone().ior(c):c.clone().ior(this)},n.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},n.prototype.iuand=function(c){var d;this.length>c.length?d=c:d=this;for(var g=0;gc.length?this.clone().iand(c):c.clone().iand(this)},n.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},n.prototype.iuxor=function(c){var d,g;this.length>c.length?(d=this,g=c):(d=c,g=this);for(var m=0;mc.length?this.clone().ixor(c):c.clone().ixor(this)},n.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},n.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var d=Math.ceil(c/26)|0,g=c%26;this._expand(d),g>0&&d--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-g),this._strip()},n.prototype.notn=function(c){return this.clone().inotn(c)},n.prototype.setn=function(c,d){t(typeof c=="number"&&c>=0);var g=c/26|0,m=c%26;return this._expand(g+1),d?this.words[g]=this.words[g]|1<c.length?(g=this,m=c):(g=c,m=this);for(var v=0,S=0;S>>26;for(;v!==0&&S>>26;if(this.length=g.length,v!==0)this.words[this.length]=v,this.length++;else if(g!==this)for(;Sc.length?this.clone().iadd(c):c.clone().iadd(this)},n.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var d=this.iadd(c);return c.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,v;g>0?(m=this,v=c):(m=c,v=this);for(var S=0,D=0;D>26,this.words[D]=d&67108863;for(;S!==0&&D>26,this.words[D]=d&67108863;if(S===0&&D>>26,Z=I&67108863,ie=Math.min(l,c.length-1),ee=Math.max(0,l-A.length+1);ee<=ie;ee++){var ae=l-ee|0;m=A.words[ae]|0,v=c.words[ee]|0,S=m*v+Z,C+=S/67108864|0,Z=S&67108863}d.words[l]=Z|0,I=C|0}return I!==0?d.words[l]=I|0:d.length--,d._strip()}var $=function(c,d,g){var m=c.words,v=d.words,S=g.words,D=0,I,l,C,Z=m[0]|0,ie=Z&8191,ee=Z>>>13,ae=m[1]|0,E=ae&8191,b=ae>>>13,x=m[2]|0,L=x&8191,P=x>>>13,U=m[3]|0,q=U&8191,M=U>>>13,Q=m[4]|0,K=Q&8191,H=Q>>>13,ue=m[5]|0,he=ue&8191,de=ue>>>13,Me=m[6]|0,be=Me&8191,xe=Me>>>13,Be=m[7]|0,Ie=Be&8191,Pe=Be>>>13,us=m[8]|0,Ze=us&8191,et=us>>>13,Ar=m[9]|0,ze=Ar&8191,Ue=Ar>>>13,jt=v[0]|0,Ce=jt&8191,mt=jt>>>13,vE=v[1]|0,wt=vE&8191,vt=vE>>>13,EE=v[2]|0,Et=EE&8191,At=EE>>>13,AE=v[3]|0,It=AE&8191,_t=AE>>>13,IE=v[4]|0,bt=IE&8191,Ct=IE>>>13,_E=v[5]|0,St=_E&8191,xt=_E>>>13,bE=v[6]|0,Tt=bE&8191,Nt=bE>>>13,CE=v[7]|0,Dt=CE&8191,Ot=CE>>>13,SE=v[8]|0,Pt=SE&8191,Bt=SE>>>13,xE=v[9]|0,Mt=xE&8191,Rt=xE>>>13;g.negative=c.negative^d.negative,g.length=19,I=Math.imul(ie,Ce),l=Math.imul(ie,mt),l=l+Math.imul(ee,Ce)|0,C=Math.imul(ee,mt);var Yp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Yp>>>26)|0,Yp&=67108863,I=Math.imul(E,Ce),l=Math.imul(E,mt),l=l+Math.imul(b,Ce)|0,C=Math.imul(b,mt),I=I+Math.imul(ie,wt)|0,l=l+Math.imul(ie,vt)|0,l=l+Math.imul(ee,wt)|0,C=C+Math.imul(ee,vt)|0;var Jp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Jp>>>26)|0,Jp&=67108863,I=Math.imul(L,Ce),l=Math.imul(L,mt),l=l+Math.imul(P,Ce)|0,C=Math.imul(P,mt),I=I+Math.imul(E,wt)|0,l=l+Math.imul(E,vt)|0,l=l+Math.imul(b,wt)|0,C=C+Math.imul(b,vt)|0,I=I+Math.imul(ie,Et)|0,l=l+Math.imul(ie,At)|0,l=l+Math.imul(ee,Et)|0,C=C+Math.imul(ee,At)|0;var Xp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Xp>>>26)|0,Xp&=67108863,I=Math.imul(q,Ce),l=Math.imul(q,mt),l=l+Math.imul(M,Ce)|0,C=Math.imul(M,mt),I=I+Math.imul(L,wt)|0,l=l+Math.imul(L,vt)|0,l=l+Math.imul(P,wt)|0,C=C+Math.imul(P,vt)|0,I=I+Math.imul(E,Et)|0,l=l+Math.imul(E,At)|0,l=l+Math.imul(b,Et)|0,C=C+Math.imul(b,At)|0,I=I+Math.imul(ie,It)|0,l=l+Math.imul(ie,_t)|0,l=l+Math.imul(ee,It)|0,C=C+Math.imul(ee,_t)|0;var Zp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Zp>>>26)|0,Zp&=67108863,I=Math.imul(K,Ce),l=Math.imul(K,mt),l=l+Math.imul(H,Ce)|0,C=Math.imul(H,mt),I=I+Math.imul(q,wt)|0,l=l+Math.imul(q,vt)|0,l=l+Math.imul(M,wt)|0,C=C+Math.imul(M,vt)|0,I=I+Math.imul(L,Et)|0,l=l+Math.imul(L,At)|0,l=l+Math.imul(P,Et)|0,C=C+Math.imul(P,At)|0,I=I+Math.imul(E,It)|0,l=l+Math.imul(E,_t)|0,l=l+Math.imul(b,It)|0,C=C+Math.imul(b,_t)|0,I=I+Math.imul(ie,bt)|0,l=l+Math.imul(ie,Ct)|0,l=l+Math.imul(ee,bt)|0,C=C+Math.imul(ee,Ct)|0;var e0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(e0>>>26)|0,e0&=67108863,I=Math.imul(he,Ce),l=Math.imul(he,mt),l=l+Math.imul(de,Ce)|0,C=Math.imul(de,mt),I=I+Math.imul(K,wt)|0,l=l+Math.imul(K,vt)|0,l=l+Math.imul(H,wt)|0,C=C+Math.imul(H,vt)|0,I=I+Math.imul(q,Et)|0,l=l+Math.imul(q,At)|0,l=l+Math.imul(M,Et)|0,C=C+Math.imul(M,At)|0,I=I+Math.imul(L,It)|0,l=l+Math.imul(L,_t)|0,l=l+Math.imul(P,It)|0,C=C+Math.imul(P,_t)|0,I=I+Math.imul(E,bt)|0,l=l+Math.imul(E,Ct)|0,l=l+Math.imul(b,bt)|0,C=C+Math.imul(b,Ct)|0,I=I+Math.imul(ie,St)|0,l=l+Math.imul(ie,xt)|0,l=l+Math.imul(ee,St)|0,C=C+Math.imul(ee,xt)|0;var t0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(t0>>>26)|0,t0&=67108863,I=Math.imul(be,Ce),l=Math.imul(be,mt),l=l+Math.imul(xe,Ce)|0,C=Math.imul(xe,mt),I=I+Math.imul(he,wt)|0,l=l+Math.imul(he,vt)|0,l=l+Math.imul(de,wt)|0,C=C+Math.imul(de,vt)|0,I=I+Math.imul(K,Et)|0,l=l+Math.imul(K,At)|0,l=l+Math.imul(H,Et)|0,C=C+Math.imul(H,At)|0,I=I+Math.imul(q,It)|0,l=l+Math.imul(q,_t)|0,l=l+Math.imul(M,It)|0,C=C+Math.imul(M,_t)|0,I=I+Math.imul(L,bt)|0,l=l+Math.imul(L,Ct)|0,l=l+Math.imul(P,bt)|0,C=C+Math.imul(P,Ct)|0,I=I+Math.imul(E,St)|0,l=l+Math.imul(E,xt)|0,l=l+Math.imul(b,St)|0,C=C+Math.imul(b,xt)|0,I=I+Math.imul(ie,Tt)|0,l=l+Math.imul(ie,Nt)|0,l=l+Math.imul(ee,Tt)|0,C=C+Math.imul(ee,Nt)|0;var r0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(r0>>>26)|0,r0&=67108863,I=Math.imul(Ie,Ce),l=Math.imul(Ie,mt),l=l+Math.imul(Pe,Ce)|0,C=Math.imul(Pe,mt),I=I+Math.imul(be,wt)|0,l=l+Math.imul(be,vt)|0,l=l+Math.imul(xe,wt)|0,C=C+Math.imul(xe,vt)|0,I=I+Math.imul(he,Et)|0,l=l+Math.imul(he,At)|0,l=l+Math.imul(de,Et)|0,C=C+Math.imul(de,At)|0,I=I+Math.imul(K,It)|0,l=l+Math.imul(K,_t)|0,l=l+Math.imul(H,It)|0,C=C+Math.imul(H,_t)|0,I=I+Math.imul(q,bt)|0,l=l+Math.imul(q,Ct)|0,l=l+Math.imul(M,bt)|0,C=C+Math.imul(M,Ct)|0,I=I+Math.imul(L,St)|0,l=l+Math.imul(L,xt)|0,l=l+Math.imul(P,St)|0,C=C+Math.imul(P,xt)|0,I=I+Math.imul(E,Tt)|0,l=l+Math.imul(E,Nt)|0,l=l+Math.imul(b,Tt)|0,C=C+Math.imul(b,Nt)|0,I=I+Math.imul(ie,Dt)|0,l=l+Math.imul(ie,Ot)|0,l=l+Math.imul(ee,Dt)|0,C=C+Math.imul(ee,Ot)|0;var i0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(i0>>>26)|0,i0&=67108863,I=Math.imul(Ze,Ce),l=Math.imul(Ze,mt),l=l+Math.imul(et,Ce)|0,C=Math.imul(et,mt),I=I+Math.imul(Ie,wt)|0,l=l+Math.imul(Ie,vt)|0,l=l+Math.imul(Pe,wt)|0,C=C+Math.imul(Pe,vt)|0,I=I+Math.imul(be,Et)|0,l=l+Math.imul(be,At)|0,l=l+Math.imul(xe,Et)|0,C=C+Math.imul(xe,At)|0,I=I+Math.imul(he,It)|0,l=l+Math.imul(he,_t)|0,l=l+Math.imul(de,It)|0,C=C+Math.imul(de,_t)|0,I=I+Math.imul(K,bt)|0,l=l+Math.imul(K,Ct)|0,l=l+Math.imul(H,bt)|0,C=C+Math.imul(H,Ct)|0,I=I+Math.imul(q,St)|0,l=l+Math.imul(q,xt)|0,l=l+Math.imul(M,St)|0,C=C+Math.imul(M,xt)|0,I=I+Math.imul(L,Tt)|0,l=l+Math.imul(L,Nt)|0,l=l+Math.imul(P,Tt)|0,C=C+Math.imul(P,Nt)|0,I=I+Math.imul(E,Dt)|0,l=l+Math.imul(E,Ot)|0,l=l+Math.imul(b,Dt)|0,C=C+Math.imul(b,Ot)|0,I=I+Math.imul(ie,Pt)|0,l=l+Math.imul(ie,Bt)|0,l=l+Math.imul(ee,Pt)|0,C=C+Math.imul(ee,Bt)|0;var n0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(n0>>>26)|0,n0&=67108863,I=Math.imul(ze,Ce),l=Math.imul(ze,mt),l=l+Math.imul(Ue,Ce)|0,C=Math.imul(Ue,mt),I=I+Math.imul(Ze,wt)|0,l=l+Math.imul(Ze,vt)|0,l=l+Math.imul(et,wt)|0,C=C+Math.imul(et,vt)|0,I=I+Math.imul(Ie,Et)|0,l=l+Math.imul(Ie,At)|0,l=l+Math.imul(Pe,Et)|0,C=C+Math.imul(Pe,At)|0,I=I+Math.imul(be,It)|0,l=l+Math.imul(be,_t)|0,l=l+Math.imul(xe,It)|0,C=C+Math.imul(xe,_t)|0,I=I+Math.imul(he,bt)|0,l=l+Math.imul(he,Ct)|0,l=l+Math.imul(de,bt)|0,C=C+Math.imul(de,Ct)|0,I=I+Math.imul(K,St)|0,l=l+Math.imul(K,xt)|0,l=l+Math.imul(H,St)|0,C=C+Math.imul(H,xt)|0,I=I+Math.imul(q,Tt)|0,l=l+Math.imul(q,Nt)|0,l=l+Math.imul(M,Tt)|0,C=C+Math.imul(M,Nt)|0,I=I+Math.imul(L,Dt)|0,l=l+Math.imul(L,Ot)|0,l=l+Math.imul(P,Dt)|0,C=C+Math.imul(P,Ot)|0,I=I+Math.imul(E,Pt)|0,l=l+Math.imul(E,Bt)|0,l=l+Math.imul(b,Pt)|0,C=C+Math.imul(b,Bt)|0,I=I+Math.imul(ie,Mt)|0,l=l+Math.imul(ie,Rt)|0,l=l+Math.imul(ee,Mt)|0,C=C+Math.imul(ee,Rt)|0;var s0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(s0>>>26)|0,s0&=67108863,I=Math.imul(ze,wt),l=Math.imul(ze,vt),l=l+Math.imul(Ue,wt)|0,C=Math.imul(Ue,vt),I=I+Math.imul(Ze,Et)|0,l=l+Math.imul(Ze,At)|0,l=l+Math.imul(et,Et)|0,C=C+Math.imul(et,At)|0,I=I+Math.imul(Ie,It)|0,l=l+Math.imul(Ie,_t)|0,l=l+Math.imul(Pe,It)|0,C=C+Math.imul(Pe,_t)|0,I=I+Math.imul(be,bt)|0,l=l+Math.imul(be,Ct)|0,l=l+Math.imul(xe,bt)|0,C=C+Math.imul(xe,Ct)|0,I=I+Math.imul(he,St)|0,l=l+Math.imul(he,xt)|0,l=l+Math.imul(de,St)|0,C=C+Math.imul(de,xt)|0,I=I+Math.imul(K,Tt)|0,l=l+Math.imul(K,Nt)|0,l=l+Math.imul(H,Tt)|0,C=C+Math.imul(H,Nt)|0,I=I+Math.imul(q,Dt)|0,l=l+Math.imul(q,Ot)|0,l=l+Math.imul(M,Dt)|0,C=C+Math.imul(M,Ot)|0,I=I+Math.imul(L,Pt)|0,l=l+Math.imul(L,Bt)|0,l=l+Math.imul(P,Pt)|0,C=C+Math.imul(P,Bt)|0,I=I+Math.imul(E,Mt)|0,l=l+Math.imul(E,Rt)|0,l=l+Math.imul(b,Mt)|0,C=C+Math.imul(b,Rt)|0;var o0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(o0>>>26)|0,o0&=67108863,I=Math.imul(ze,Et),l=Math.imul(ze,At),l=l+Math.imul(Ue,Et)|0,C=Math.imul(Ue,At),I=I+Math.imul(Ze,It)|0,l=l+Math.imul(Ze,_t)|0,l=l+Math.imul(et,It)|0,C=C+Math.imul(et,_t)|0,I=I+Math.imul(Ie,bt)|0,l=l+Math.imul(Ie,Ct)|0,l=l+Math.imul(Pe,bt)|0,C=C+Math.imul(Pe,Ct)|0,I=I+Math.imul(be,St)|0,l=l+Math.imul(be,xt)|0,l=l+Math.imul(xe,St)|0,C=C+Math.imul(xe,xt)|0,I=I+Math.imul(he,Tt)|0,l=l+Math.imul(he,Nt)|0,l=l+Math.imul(de,Tt)|0,C=C+Math.imul(de,Nt)|0,I=I+Math.imul(K,Dt)|0,l=l+Math.imul(K,Ot)|0,l=l+Math.imul(H,Dt)|0,C=C+Math.imul(H,Ot)|0,I=I+Math.imul(q,Pt)|0,l=l+Math.imul(q,Bt)|0,l=l+Math.imul(M,Pt)|0,C=C+Math.imul(M,Bt)|0,I=I+Math.imul(L,Mt)|0,l=l+Math.imul(L,Rt)|0,l=l+Math.imul(P,Mt)|0,C=C+Math.imul(P,Rt)|0;var a0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(a0>>>26)|0,a0&=67108863,I=Math.imul(ze,It),l=Math.imul(ze,_t),l=l+Math.imul(Ue,It)|0,C=Math.imul(Ue,_t),I=I+Math.imul(Ze,bt)|0,l=l+Math.imul(Ze,Ct)|0,l=l+Math.imul(et,bt)|0,C=C+Math.imul(et,Ct)|0,I=I+Math.imul(Ie,St)|0,l=l+Math.imul(Ie,xt)|0,l=l+Math.imul(Pe,St)|0,C=C+Math.imul(Pe,xt)|0,I=I+Math.imul(be,Tt)|0,l=l+Math.imul(be,Nt)|0,l=l+Math.imul(xe,Tt)|0,C=C+Math.imul(xe,Nt)|0,I=I+Math.imul(he,Dt)|0,l=l+Math.imul(he,Ot)|0,l=l+Math.imul(de,Dt)|0,C=C+Math.imul(de,Ot)|0,I=I+Math.imul(K,Pt)|0,l=l+Math.imul(K,Bt)|0,l=l+Math.imul(H,Pt)|0,C=C+Math.imul(H,Bt)|0,I=I+Math.imul(q,Mt)|0,l=l+Math.imul(q,Rt)|0,l=l+Math.imul(M,Mt)|0,C=C+Math.imul(M,Rt)|0;var u0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(u0>>>26)|0,u0&=67108863,I=Math.imul(ze,bt),l=Math.imul(ze,Ct),l=l+Math.imul(Ue,bt)|0,C=Math.imul(Ue,Ct),I=I+Math.imul(Ze,St)|0,l=l+Math.imul(Ze,xt)|0,l=l+Math.imul(et,St)|0,C=C+Math.imul(et,xt)|0,I=I+Math.imul(Ie,Tt)|0,l=l+Math.imul(Ie,Nt)|0,l=l+Math.imul(Pe,Tt)|0,C=C+Math.imul(Pe,Nt)|0,I=I+Math.imul(be,Dt)|0,l=l+Math.imul(be,Ot)|0,l=l+Math.imul(xe,Dt)|0,C=C+Math.imul(xe,Ot)|0,I=I+Math.imul(he,Pt)|0,l=l+Math.imul(he,Bt)|0,l=l+Math.imul(de,Pt)|0,C=C+Math.imul(de,Bt)|0,I=I+Math.imul(K,Mt)|0,l=l+Math.imul(K,Rt)|0,l=l+Math.imul(H,Mt)|0,C=C+Math.imul(H,Rt)|0;var c0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(c0>>>26)|0,c0&=67108863,I=Math.imul(ze,St),l=Math.imul(ze,xt),l=l+Math.imul(Ue,St)|0,C=Math.imul(Ue,xt),I=I+Math.imul(Ze,Tt)|0,l=l+Math.imul(Ze,Nt)|0,l=l+Math.imul(et,Tt)|0,C=C+Math.imul(et,Nt)|0,I=I+Math.imul(Ie,Dt)|0,l=l+Math.imul(Ie,Ot)|0,l=l+Math.imul(Pe,Dt)|0,C=C+Math.imul(Pe,Ot)|0,I=I+Math.imul(be,Pt)|0,l=l+Math.imul(be,Bt)|0,l=l+Math.imul(xe,Pt)|0,C=C+Math.imul(xe,Bt)|0,I=I+Math.imul(he,Mt)|0,l=l+Math.imul(he,Rt)|0,l=l+Math.imul(de,Mt)|0,C=C+Math.imul(de,Rt)|0;var l0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(l0>>>26)|0,l0&=67108863,I=Math.imul(ze,Tt),l=Math.imul(ze,Nt),l=l+Math.imul(Ue,Tt)|0,C=Math.imul(Ue,Nt),I=I+Math.imul(Ze,Dt)|0,l=l+Math.imul(Ze,Ot)|0,l=l+Math.imul(et,Dt)|0,C=C+Math.imul(et,Ot)|0,I=I+Math.imul(Ie,Pt)|0,l=l+Math.imul(Ie,Bt)|0,l=l+Math.imul(Pe,Pt)|0,C=C+Math.imul(Pe,Bt)|0,I=I+Math.imul(be,Mt)|0,l=l+Math.imul(be,Rt)|0,l=l+Math.imul(xe,Mt)|0,C=C+Math.imul(xe,Rt)|0;var f0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(f0>>>26)|0,f0&=67108863,I=Math.imul(ze,Dt),l=Math.imul(ze,Ot),l=l+Math.imul(Ue,Dt)|0,C=Math.imul(Ue,Ot),I=I+Math.imul(Ze,Pt)|0,l=l+Math.imul(Ze,Bt)|0,l=l+Math.imul(et,Pt)|0,C=C+Math.imul(et,Bt)|0,I=I+Math.imul(Ie,Mt)|0,l=l+Math.imul(Ie,Rt)|0,l=l+Math.imul(Pe,Mt)|0,C=C+Math.imul(Pe,Rt)|0;var h0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(h0>>>26)|0,h0&=67108863,I=Math.imul(ze,Pt),l=Math.imul(ze,Bt),l=l+Math.imul(Ue,Pt)|0,C=Math.imul(Ue,Bt),I=I+Math.imul(Ze,Mt)|0,l=l+Math.imul(Ze,Rt)|0,l=l+Math.imul(et,Mt)|0,C=C+Math.imul(et,Rt)|0;var d0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(d0>>>26)|0,d0&=67108863,I=Math.imul(ze,Mt),l=Math.imul(ze,Rt),l=l+Math.imul(Ue,Mt)|0,C=Math.imul(Ue,Rt);var p0=(D+I|0)+((l&8191)<<13)|0;return D=(C+(l>>>13)|0)+(p0>>>26)|0,p0&=67108863,S[0]=Yp,S[1]=Jp,S[2]=Xp,S[3]=Zp,S[4]=e0,S[5]=t0,S[6]=r0,S[7]=i0,S[8]=n0,S[9]=s0,S[10]=o0,S[11]=a0,S[12]=u0,S[13]=c0,S[14]=l0,S[15]=f0,S[16]=h0,S[17]=d0,S[18]=p0,D!==0&&(S[19]=D,g.length++),g};Math.imul||($=z);function se(A,c,d){d.negative=c.negative^A.negative,d.length=A.length+c.length;for(var g=0,m=0,v=0;v>>26)|0,m+=S>>>26,S&=67108863}d.words[v]=D,g=S,S=m}return g!==0?d.words[v]=g:d.length--,d._strip()}function Y(A,c,d){return se(A,c,d)}n.prototype.mulTo=function(c,d){var g,m=this.length+c.length;return this.length===10&&c.length===10?g=$(this,c,d):m<63?g=z(this,c,d):m<1024?g=se(this,c,d):g=Y(this,c,d),g};function j(A,c){this.x=A,this.y=c}j.prototype.makeRBT=function(c){for(var d=new Array(c),g=n.prototype._countBits(c)-1,m=0;m>=1;return m},j.prototype.permute=function(c,d,g,m,v,S){for(var D=0;D>>1)v++;return 1<>>13,g[2*S+1]=v&8191,v=v>>>13;for(S=2*d;S>=26,g+=v/67108864|0,g+=S>>>26,this.words[m]=S&67108863}return g!==0&&(this.words[m]=g,this.length++),d?this.ineg():this},n.prototype.muln=function(c){return this.clone().imuln(c)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(c){var d=V(c);if(d.length===0)return new n(1);for(var g=this,m=0;m=0);var d=c%26,g=(c-d)/26,m=67108863>>>26-d<<26-d,v;if(d!==0){var S=0;for(v=0;v>>26-d}S&&(this.words[v]=S,this.length++)}if(g!==0){for(v=this.length-1;v>=0;v--)this.words[v+g]=this.words[v];for(v=0;v=0);var m;d?m=(d-d%26)/26:m=0;var v=c%26,S=Math.min((c-v)/26,this.length),D=67108863^67108863>>>v<S)for(this.length-=S,l=0;l=0&&(C!==0||l>=m);l--){var Z=this.words[l]|0;this.words[l]=C<<26-v|Z>>>v,C=Z&D}return I&&C!==0&&(I.words[I.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(c,d,g){return t(this.negative===0),this.iushrn(c,d,g)},n.prototype.shln=function(c){return this.clone().ishln(c)},n.prototype.ushln=function(c){return this.clone().iushln(c)},n.prototype.shrn=function(c){return this.clone().ishrn(c)},n.prototype.ushrn=function(c){return this.clone().iushrn(c)},n.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var d=c%26,g=(c-d)/26,m=1<=0);var d=c%26,g=(c-d)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(d!==0&&g++,this.length=Math.min(g,this.length),d!==0){var m=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(I/67108864|0),this.words[v+g]=S&67108863}for(;v>26,this.words[v+g]=S&67108863;if(D===0)return this._strip();for(t(D===-1),D=0,v=0;v>26,this.words[v]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(c,d){var g=this.length-c.length,m=this.clone(),v=c,S=v.words[v.length-1]|0,D=this._countBits(S);g=26-D,g!==0&&(v=v.ushln(g),m.iushln(g),S=v.words[v.length-1]|0);var I=m.length-v.length,l;if(d!=="mod"){l=new n(null),l.length=I+1,l.words=new Array(l.length);for(var C=0;C=0;ie--){var ee=(m.words[v.length+ie]|0)*67108864+(m.words[v.length+ie-1]|0);for(ee=Math.min(ee/S|0,67108863),m._ishlnsubmul(v,ee,ie);m.negative!==0;)ee--,m.negative=0,m._ishlnsubmul(v,1,ie),m.isZero()||(m.negative^=1);l&&(l.words[ie]=ee)}return l&&l._strip(),m._strip(),d!=="div"&&g!==0&&m.iushrn(g),{div:l||null,mod:m}},n.prototype.divmod=function(c,d,g){if(t(!c.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var m,v,S;return this.negative!==0&&c.negative===0?(S=this.neg().divmod(c,d),d!=="mod"&&(m=S.div.neg()),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.iadd(c)),{div:m,mod:v}):this.negative===0&&c.negative!==0?(S=this.divmod(c.neg(),d),d!=="mod"&&(m=S.div.neg()),{div:m,mod:S.mod}):this.negative&c.negative?(S=this.neg().divmod(c.neg(),d),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.isub(c)),{div:S.div,mod:v}):c.length>this.length||this.cmp(c)<0?{div:new n(0),mod:this}:c.length===1?d==="div"?{div:this.divn(c.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new n(this.modrn(c.words[0]))}:this._wordDiv(c,d)},n.prototype.div=function(c){return this.divmod(c,"div",!1).div},n.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},n.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},n.prototype.divRound=function(c){var d=this.divmod(c);if(d.mod.isZero())return d.div;var g=d.div.negative!==0?d.mod.isub(c):d.mod,m=c.ushrn(1),v=c.andln(1),S=g.cmp(m);return S<0||v===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=(1<<26)%c,m=0,v=this.length-1;v>=0;v--)m=(g*m+(this.words[v]|0))%c;return d?-m:m},n.prototype.modn=function(c){return this.modrn(c)},n.prototype.idivn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=0,m=this.length-1;m>=0;m--){var v=(this.words[m]|0)+g*67108864;this.words[m]=v/c|0,g=v%c}return this._strip(),d?this.ineg():this},n.prototype.divn=function(c){return this.clone().idivn(c)},n.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=new n(0),D=new n(1),I=0;d.isEven()&&g.isEven();)d.iushrn(1),g.iushrn(1),++I;for(var l=g.clone(),C=d.clone();!d.isZero();){for(var Z=0,ie=1;!(d.words[0]&ie)&&Z<26;++Z,ie<<=1);if(Z>0)for(d.iushrn(Z);Z-- >0;)(m.isOdd()||v.isOdd())&&(m.iadd(l),v.isub(C)),m.iushrn(1),v.iushrn(1);for(var ee=0,ae=1;!(g.words[0]&ae)&&ee<26;++ee,ae<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(S.isOdd()||D.isOdd())&&(S.iadd(l),D.isub(C)),S.iushrn(1),D.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(S),v.isub(D)):(g.isub(d),S.isub(m),D.isub(v))}return{a:S,b:D,gcd:g.iushln(I)}},n.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=g.clone();d.cmpn(1)>0&&g.cmpn(1)>0;){for(var D=0,I=1;!(d.words[0]&I)&&D<26;++D,I<<=1);if(D>0)for(d.iushrn(D);D-- >0;)m.isOdd()&&m.iadd(S),m.iushrn(1);for(var l=0,C=1;!(g.words[0]&C)&&l<26;++l,C<<=1);if(l>0)for(g.iushrn(l);l-- >0;)v.isOdd()&&v.iadd(S),v.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(v)):(g.isub(d),v.isub(m))}var Z;return d.cmpn(1)===0?Z=m:Z=v,Z.cmpn(0)<0&&Z.iadd(c),Z},n.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var d=this.clone(),g=c.clone();d.negative=0,g.negative=0;for(var m=0;d.isEven()&&g.isEven();m++)d.iushrn(1),g.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;g.isEven();)g.iushrn(1);var v=d.cmp(g);if(v<0){var S=d;d=g,g=S}else if(v===0||g.cmpn(1)===0)break;d.isub(g)}while(!0);return g.iushln(m)},n.prototype.invm=function(c){return this.egcd(c).a.umod(c)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(c){return this.words[0]&c},n.prototype.bincn=function(c){t(typeof c=="number");var d=c%26,g=(c-d)/26,m=1<>>26,D&=67108863,this.words[S]=D}return v!==0&&(this.words[S]=v,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(c){var d=c<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var g;if(this.length>1)g=1;else{d&&(c=-c),t(c<=67108863,"Number is too big");var m=this.words[0]|0;g=m===c?0:mc.length)return 1;if(this.length=0;g--){var m=this.words[g]|0,v=c.words[g]|0;if(m!==v){mv&&(d=1);break}}return d},n.prototype.gtn=function(c){return this.cmpn(c)===1},n.prototype.gt=function(c){return this.cmp(c)===1},n.prototype.gten=function(c){return this.cmpn(c)>=0},n.prototype.gte=function(c){return this.cmp(c)>=0},n.prototype.ltn=function(c){return this.cmpn(c)===-1},n.prototype.lt=function(c){return this.cmp(c)===-1},n.prototype.lten=function(c){return this.cmpn(c)<=0},n.prototype.lte=function(c){return this.cmp(c)<=0},n.prototype.eqn=function(c){return this.cmpn(c)===0},n.prototype.eq=function(c){return this.cmp(c)===0},n.red=function(c){return new J(c)},n.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},n.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(c){return this.red=c,this},n.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},n.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},n.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},n.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},n.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},n.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},n.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},n.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},n.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var W={k256:null,p224:null,p192:null,p25519:null};function k(A,c){this.name=A,this.p=new n(c,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new n(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var d=c,g;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),g=d.bitLength();while(g>this.n);var m=g0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},k.prototype.split=function(c,d){c.iushrn(this.n,0,d)},k.prototype.imulK=function(c){return c.imul(this.k)};function R(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,k),R.prototype.split=function(c,d){for(var g=4194303,m=Math.min(c.length,9),v=0;v>>22,S=D}S>>>=22,c.words[v-10]=S,S===0&&c.length>10?c.length-=10:c.length-=9},R.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var d=0,g=0;g>>=26,c.words[g]=v,d=m}return d!==0&&(c.words[c.length++]=d),c},n._prime=function(c){if(W[c])return W[c];var d;if(c==="k256")d=new R;else if(c==="p224")d=new F;else if(c==="p192")d=new G;else if(c==="p25519")d=new ce;else throw new Error("Unknown prime "+c);return W[c]=d,d};function J(A){if(typeof A=="string"){var c=n._prime(A);this.m=c.p,this.prime=c}else t(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}J.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},J.prototype._verify2=function(c,d){t((c.negative|d.negative)===0,"red works only with positives"),t(c.red&&c.red===d.red,"red works only with red numbers")},J.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(h(c,c.umod(this.m)._forceRed(this)),c)},J.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},J.prototype.add=function(c,d){this._verify2(c,d);var g=c.add(d);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},J.prototype.iadd=function(c,d){this._verify2(c,d);var g=c.iadd(d);return g.cmp(this.m)>=0&&g.isub(this.m),g},J.prototype.sub=function(c,d){this._verify2(c,d);var g=c.sub(d);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},J.prototype.isub=function(c,d){this._verify2(c,d);var g=c.isub(d);return g.cmpn(0)<0&&g.iadd(this.m),g},J.prototype.shl=function(c,d){return this._verify1(c),this.imod(c.ushln(d))},J.prototype.imul=function(c,d){return this._verify2(c,d),this.imod(c.imul(d))},J.prototype.mul=function(c,d){return this._verify2(c,d),this.imod(c.mul(d))},J.prototype.isqr=function(c){return this.imul(c,c.clone())},J.prototype.sqr=function(c){return this.mul(c,c)},J.prototype.sqrt=function(c){if(c.isZero())return c.clone();var d=this.m.andln(3);if(t(d%2===1),d===3){var g=this.m.add(new n(1)).iushrn(2);return this.pow(c,g)}for(var m=this.m.subn(1),v=0;!m.isZero()&&m.andln(1)===0;)v++,m.iushrn(1);t(!m.isZero());var S=new n(1).toRed(this),D=S.redNeg(),I=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);this.pow(l,I).cmp(D)!==0;)l.redIAdd(D);for(var C=this.pow(l,m),Z=this.pow(c,m.addn(1).iushrn(1)),ie=this.pow(c,m),ee=v;ie.cmp(S)!==0;){for(var ae=ie,E=0;ae.cmp(S)!==0;E++)ae=ae.redSqr();t(E=0;v--){for(var C=d.words[v],Z=l-1;Z>=0;Z--){var ie=C>>Z&1;if(S!==m[0]&&(S=this.sqr(S)),ie===0&&D===0){I=0;continue}D<<=1,D|=ie,I++,!(I!==g&&(v!==0||Z!==0))&&(S=this.mul(S,m[D]),I=0,D=0)}l=26}return S},J.prototype.convertTo=function(c){var d=c.umod(this.m);return d===c?d.clone():d},J.prototype.convertFrom=function(c){var d=c.clone();return d.red=null,d},n.mont=function(c){return new X(c)};function X(A){J.call(this,A),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,J),X.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},X.prototype.convertFrom=function(c){var d=this.imod(c.mul(this.rinv));return d.red=null,d},X.prototype.imul=function(c,d){if(c.isZero()||d.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.mul=function(c,d){if(c.isZero()||d.isZero())return new n(0)._forceRed(this);var g=c.mul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.invm=function(c){var d=this.imod(c._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof Hv>"u"||Hv,SO)});var TO=B(Sp=>{"use strict";f();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.TransactionStatus=void 0;var El=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new El("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}};Sp.TransactionStatus=El});var Mu=B(Zt=>{"use strict";f();var bG=Zt&&Zt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),CG=Zt&&Zt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),SG=Zt&&Zt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bG(e,r,t);return CG(e,r),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.zeroPadStringIfOddLength=Zt.isPaddedHex=Zt.numberToPaddedHex=Zt.Nonce=Zt.Address=void 0;var NO=SG(kl()),xG="erd",Al=class{constructor(e){this.value=e}static fromPubkey(e){let t=NO.toWords(e),i=NO.encode(xG,t);return new Al(i)}bech32(){return this.value}toString(){return this.bech32()}};Zt.Address=Al;var Qv=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return DO(this.value)}};Zt.Nonce=Qv;function DO(r){let e=r.toString(16);return OO(e)}Zt.numberToPaddedHex=DO;function TG(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}Zt.isPaddedHex=TG;function OO(r){return r=r||"",r.length%2==1?"0"+r:r}Zt.zeroPadStringIfOddLength=OO});var BO=B(xp=>{"use strict";f();Object.defineProperty(xp,"__esModule",{value:!0});xp.TransactionReceipt=void 0;var PO=Mu(),Il=class{constructor(){this.value="",this.sender=new PO.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new Il;return t.value=(e.value||0).toString(),t.sender=new PO.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}};xp.TransactionReceipt=Il});var MO=B(Vi=>{"use strict";f();Object.defineProperty(Vi,"__esModule",{value:!0});Vi.ErrContractQuery=Vi.ErrNetworkProvider=Vi.ErrUnexpectedCondition=Vi.Err=void 0;var Ru=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Vi.Err=Ru;var jv=class extends Ru{constructor(e){super(`Unexpected condition: [${e}]`)}};Vi.ErrUnexpectedCondition=jv;var Gv=class extends Ru{constructor(e,t,i){let n=`Request error on url [${e}]: [${t}]`;super(n,i)}};Vi.ErrNetworkProvider=Gv;var Kv=class extends Ru{constructor(e){super(e.message.replace("executeQuery:",""))}};Vi.ErrContractQuery=Kv});var LO=B(Lu=>{"use strict";f();Object.defineProperty(Lu,"__esModule",{value:!0});Lu.TransactionEventTopic=Lu.TransactionEvent=void 0;var RO=Mu(),_l=class{constructor(e){this.address=new RO.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let t=new _l;return t.address=new RO.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map(i=>new Tp(i)),t.data=y.Buffer.from(e.data||"","base64").toString(),t}findFirstOrNoneTopic(e){return this.topics.filter(t=>e(t))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Lu.TransactionEvent=_l;var Tp=class{constructor(e){this.raw=y.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Lu.TransactionEventTopic=Tp});var zv=B(Np=>{"use strict";f();Object.defineProperty(Np,"__esModule",{value:!0});Np.TransactionLogs=void 0;var NG=MO(),FO=Mu(),DG=LO(),bl=class{constructor(e){this.address=new FO.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new bl;return t.address=new FO.Address(e.address),t.events=(e.events||[]).map(i=>DG.TransactionEvent.fromHttpResponse(i)),t}findSingleOrNoneEvent(e,t){let i=this.findEvents(e,t);if(i.length>1)throw new NG.ErrUnexpectedCondition(`more than one event of type ${e}`);return i[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let i=this.events.filter(n=>n.identifier==e);return t&&(i=i.filter(n=>t(n))),i}};Np.TransactionLogs=bl});var qO=B(Uu=>{"use strict";f();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ContractResultItem=Uu.ContractResults=void 0;var UO=zv(),Dp=Mu(),Fu=class{constructor(e){this.items=e,this.items.sort(function(t,i){return t.nonce.valueOf()-i.nonce.valueOf()})}static fromProxyHttpResponse(e){let t=e.map(i=>ln.fromProxyHttpResponse(i));return new Fu(t)}static fromApiHttpResponse(e){let t=e.map(i=>ln.fromApiHttpResponse(i));return new Fu(t)}};Uu.ContractResults=Fu;var ln=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Dp.Address(""),this.sender=new Dp.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new UO.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ln.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=ln.fromHttpResponse(e);return t.data=y.Buffer.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new ln;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new Dp.Address(e.receiver),t.sender=new Dp.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=UO.TransactionLogs.fromHttpResponse(e.logs||{}),t}};Uu.ContractResultItem=ln});var VO=B(rs=>{"use strict";f();var OG=rs&&rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rs,"__esModule",{value:!0});rs.EsdtContractAddress=rs.MaxUint64AsBigNumber=void 0;var PG=OG(jr()),BG=Mu();rs.MaxUint64AsBigNumber=new PG.default("18446744073709551615");rs.EsdtContractAddress=new BG.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var HO=B(qu=>{"use strict";f();var MG=qu&&qu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qu,"__esModule",{value:!0});qu.ContractQueryResponse=void 0;var RG=MG(jr()),LG=VO(),Cl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,i=e.returnCode||e.ReturnCode,n=e.returnMessage||e.ReturnMessage,s=new RG.default(e.gasRemaining||e.GasRemaining||0),o=LG.MaxUint64AsBigNumber.minus(s).toNumber();return new Cl({returnData:t,returnCode:i,returnMessage:n,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>y.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};qu.ContractQueryResponse=Cl});var QO=B(Op=>{"use strict";f();Object.defineProperty(Op,"__esModule",{value:!0});Op.ContractQueryRequest=void 0;var kv=class{constructor(e){this.query=e}toHttpRequest(){var e;let t={},i=this.query;return t.scAddress=i.address.bech32(),t.caller=!((e=i.caller)===null||e===void 0)&&e.bech32()?i.caller.bech32():void 0,t.funcName=i.func.toString(),t.value=i.value?i.value.toString():void 0,t.args=i.getEncodedArguments(),t}};Op.ContractQueryRequest=kv});var jO=B(Pp=>{"use strict";f();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.Query=void 0;var FG=Gr(),UG=jf(),Wv=class{constructor(e){this.caller=e.caller||new FG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new UG.ArgSerializer().valuesToStrings(this.args)}};Pp.Query=Wv});var e6=B((_ne,ZO)=>{f();ZO.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var is=B(wo=>{f();var $v,qG=[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 qG[e]};wo.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};wo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');$v=e};wo.isKanjiModeEnabled=function(){return typeof $v<"u"};wo.toSJIS=function(e){return $v(e)}});var Rp=B(Qr=>{f();Qr.L={bit:1};Qr.M={bit:0};Qr.Q={bit:3};Qr.H={bit:2};function VG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.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: "+r)}}Qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Qr.from=function(e,t){if(Qr.isValid(e))return e;try{return VG(e)}catch{return t}}});var i6=B((Nne,r6)=>{f();function t6(){this.buffer=[],this.length=0}t6.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};r6.exports=t6});var s6=B((One,n6)=>{f();function Sl(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sl.prototype.set=function(r,e,t,i){let n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)};Sl.prototype.get=function(r,e){return this.data[r*this.size+e]};Sl.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};Sl.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};n6.exports=Sl});var o6=B(Lp=>{f();var HG=is().getSymbolSize;Lp.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,i=HG(e),n=i===145?26:Math.ceil((i-13)/(2*t-2))*2,s=[i-7];for(let o=1;o{f();var QG=is().getSymbolSize,a6=7;u6.getPositions=function(e){let t=QG(e);return[[0,0],[t-a6,0],[0,t-a6]]}});var l6=B($e=>{f();$e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var vo={N1:3,N2:3,N3:40,N4:10};$e.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};$e.from=function(e){return $e.isValid(e)?parseInt(e,10):void 0};$e.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let u=0;u=5&&(i+=vo.N1+(n-5)),o=p,n=1),p=e.get(h,u),p===a?s++:(s>=5&&(i+=vo.N1+(s-5)),a=p,s=1)}n>=5&&(i+=vo.N1+(n-5)),s>=5&&(i+=vo.N1+(s-5))}return i};$e.getPenaltyN2=function(e){let t=e.size,i=0;for(let n=0;n=10&&(n===1488||n===93)&&i++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&i++}return i*vo.N3};$e.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let s=0;s{f();var ns=Rp(),Fp=[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],Up=[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];Yv.getBlocksCount=function(e,t){switch(t){case ns.L:return Fp[(e-1)*4+0];case ns.M:return Fp[(e-1)*4+1];case ns.Q:return Fp[(e-1)*4+2];case ns.H:return Fp[(e-1)*4+3];default:return}};Yv.getTotalCodewordsCount=function(e,t){switch(t){case ns.L:return Up[(e-1)*4+0];case ns.M:return Up[(e-1)*4+1];case ns.Q:return Up[(e-1)*4+2];case ns.H:return Up[(e-1)*4+3];default:return}}});var f6=B(Vp=>{f();var xl=new Uint8Array(512),qp=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)xl[t]=e,qp[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)xl[t]=xl[t-255]})();Vp.log=function(e){if(e<1)throw new Error("log("+e+")");return qp[e]};Vp.exp=function(e){return xl[e]};Vp.mul=function(e,t){return e===0||t===0?0:xl[qp[e]+qp[t]]}});var h6=B(Tl=>{f();var Xv=f6();Tl.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n=0;){let n=i[0];for(let o=0;o{f();var d6=h6();function Zv(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Zv.prototype.initialize=function(e){this.degree=e,this.genPoly=d6.generateECPolynomial(this.degree)};Zv.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=d6.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let s=new Uint8Array(this.degree);return s.set(i,n),s}return i};p6.exports=Zv});var eE=B(y6=>{f();y6.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var tE=B(fn=>{f();var m6="[0-9]+",GG="[A-Z $%*+\\-./:]+",Nl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Nl=Nl.replace(/u/g,"\\u");var KG="(?:(?![A-Z0-9 $%*+\\-./:]|"+Nl+`)(?:.|[\r -]))+`;fn.KANJI=new RegExp(Nl,"g");fn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");fn.BYTE=new RegExp(KG,"g");fn.NUMERIC=new RegExp(m6,"g");fn.ALPHANUMERIC=new RegExp(GG,"g");var zG=new RegExp("^"+Nl+"$"),kG=new RegExp("^"+m6+"$"),WG=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");fn.testKanji=function(e){return zG.test(e)};fn.testNumeric=function(e){return kG.test(e)};fn.testAlphanumeric=function(e){return WG.test(e)}});var ss=B(qt=>{f();var $G=eE(),rE=tE();qt.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};qt.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};qt.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};qt.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};qt.MIXED={bit:-1};qt.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!$G.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};qt.getBestModeForData=function(e){return rE.testNumeric(e)?qt.NUMERIC:rE.testAlphanumeric(e)?qt.ALPHANUMERIC:rE.testKanji(e)?qt.KANJI:qt.BYTE};qt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};qt.isValid=function(e){return e&&e.bit&&e.ccBits};function YG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return qt.NUMERIC;case"alphanumeric":return qt.ALPHANUMERIC;case"kanji":return qt.KANJI;case"byte":return qt.BYTE;default:throw new Error("Unknown mode: "+r)}}qt.from=function(e,t){if(qt.isValid(e))return e;try{return YG(e)}catch{return t}}});var I6=B(Eo=>{f();var Hp=is(),JG=Jv(),w6=Rp(),os=ss(),iE=eE(),E6=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,v6=Hp.getBCHDigit(E6);function XG(r,e,t){for(let i=1;i<=40;i++)if(e<=Eo.getCapacity(i,t,r))return i}function A6(r,e){return os.getCharCountIndicator(r,e)+4}function ZG(r,e){let t=0;return r.forEach(function(i){let n=A6(i.mode,e);t+=n+i.getBitsLength()}),t}function eK(r,e){for(let t=1;t<=40;t++)if(ZG(r,t)<=Eo.getCapacity(t,e,os.MIXED))return t}Eo.from=function(e,t){return iE.isValid(e)?parseInt(e,10):t};Eo.getCapacity=function(e,t,i){if(!iE.isValid(e))throw new Error("Invalid QR Code version");typeof i>"u"&&(i=os.BYTE);let n=Hp.getSymbolTotalCodewords(e),s=JG.getTotalCodewordsCount(e,t),o=(n-s)*8;if(i===os.MIXED)return o;let a=o-A6(i,e);switch(i){case os.NUMERIC:return Math.floor(a/10*3);case os.ALPHANUMERIC:return Math.floor(a/11*2);case os.KANJI:return Math.floor(a/13);case os.BYTE:default:return Math.floor(a/8)}};Eo.getBestVersionForData=function(e,t){let i,n=w6.from(t,w6.M);if(Array.isArray(e)){if(e.length>1)return eK(e,n);if(e.length===0)return 1;i=e[0]}else i=e;return XG(i.mode,i.getLength(),n)};Eo.getEncodedBits=function(e){if(!iE.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Hp.getBCHDigit(t)-v6>=0;)t^=E6<{f();var nE=is(),b6=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,tK=1<<14|1<<12|1<<10|1<<4|1<<1,_6=nE.getBCHDigit(b6);C6.getEncodedBits=function(e,t){let i=e.bit<<3|t,n=i<<10;for(;nE.getBCHDigit(n)-_6>=0;)n^=b6<{f();var rK=ss();function Vu(r){this.mode=rK.NUMERIC,this.data=r.toString()}Vu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);let s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};x6.exports=Vu});var D6=B((sse,N6)=>{f();var iK=ss(),sE=["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 Hu(r){this.mode=iK.ALPHANUMERIC,this.data=r}Hu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Hu.prototype.getLength=function(){return this.data.length};Hu.prototype.getBitsLength=function(){return Hu.getBitsLength(this.data.length)};Hu.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=sE.indexOf(this.data[t])*45;i+=sE.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(sE.indexOf(this.data[t]),6)};N6.exports=Hu});var P6=B((ase,O6)=>{"use strict";f();O6.exports=function(e){for(var t=[],i=e.length,n=0;n=55296&&s<=56319&&i>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}});var M6=B((cse,B6)=>{f();var nK=P6(),sK=ss();function Qu(r){this.mode=sK.BYTE,typeof r=="string"&&(r=nK(r)),this.data=new Uint8Array(r)}Qu.getBitsLength=function(e){return e*8};Qu.prototype.getLength=function(){return this.data.length};Qu.prototype.getBitsLength=function(){return Qu.getBitsLength(this.data.length)};Qu.prototype.write=function(r){for(let e=0,t=this.data.length;e{f();var oK=ss(),aK=is();function ju(r){this.mode=oK.KANJI,this.data=r}ju.getBitsLength=function(e){return e*13};ju.prototype.getLength=function(){return this.data.length};ju.prototype.getBitsLength=function(){return ju.getBitsLength(this.data.length)};ju.prototype.write=function(r){let e;for(e=0;e=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};R6.exports=ju});var F6=B((dse,oE)=>{"use strict";f();var Dl={single_source_shortest_paths:function(r,e,t){var i={},n={};n[e]=0;var s=Dl.PriorityQueue.make();s.push(e,0);for(var o,a,u,h,p,w,N,O,T;!s.empty();){o=s.pop(),a=o.value,h=o.cost,p=r[a]||{};for(u in p)p.hasOwnProperty(u)&&(w=p[u],N=h+w,O=n[u],T=typeof n[u]>"u",(T||O>N)&&(n[u]=N,s.push(u,N),i[u]=a))}if(typeof t<"u"&&typeof n[t]>"u"){var V=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(V)}return i},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],i=e,n;i;)t.push(i),n=r[i],i=r[i];return t.reverse(),t},find_path:function(r,e,t){var i=Dl.single_source_shortest_paths(r,e,t);return Dl.extract_shortest_path_from_predecessor_list(i,t)},PriorityQueue:{make:function(r){var e=Dl.PriorityQueue,t={},i;r=r||{};for(i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof oE<"u"&&(oE.exports=Dl)});var K6=B(Gu=>{f();var Qe=ss(),V6=T6(),H6=D6(),Q6=M6(),j6=L6(),Ol=tE(),Qp=is(),uK=F6();function U6(r){return unescape(encodeURIComponent(r)).length}function Pl(r,e,t){let i=[],n;for(;(n=r.exec(t))!==null;)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function G6(r){let e=Pl(Ol.NUMERIC,Qe.NUMERIC,r),t=Pl(Ol.ALPHANUMERIC,Qe.ALPHANUMERIC,r),i,n;return Qp.isKanjiModeEnabled()?(i=Pl(Ol.BYTE,Qe.BYTE,r),n=Pl(Ol.KANJI,Qe.KANJI,r)):(i=Pl(Ol.BYTE_KANJI,Qe.BYTE,r),n=[]),e.concat(t,i,n).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function aE(r,e){switch(e){case Qe.NUMERIC:return V6.getBitsLength(r);case Qe.ALPHANUMERIC:return H6.getBitsLength(r);case Qe.KANJI:return j6.getBitsLength(r);case Qe.BYTE:return Q6.getBitsLength(r)}}function cK(r){return r.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function lK(r){let e=[];for(let t=0;t{f();var Gp=is(),uE=Rp(),hK=i6(),dK=s6(),pK=o6(),gK=c6(),fE=l6(),hE=Jv(),yK=g6(),jp=I6(),mK=S6(),wK=ss(),cE=K6();function vK(r,e){let t=r.size,i=gK.getPositions(e);for(let n=0;n=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?r.set(s+a,o+u,!0,!0):r.set(s+a,o+u,!1,!0))}}function EK(r){let e=r.size;for(let t=8;t>a&1)===1,r.set(n,s,o,!0),r.set(s,n,o,!0)}function lE(r,e,t){let i=r.size,n=mK.getEncodedBits(e,t),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?r.set(s,8,o,!0):s<8?r.set(s+1,8,o,!0):r.set(i-15+s,8,o,!0),s<8?r.set(8,i-s-1,o,!0):s<9?r.set(8,15-s-1+1,o,!0):r.set(8,15-s-1,o,!0);r.set(i-8,8,1,!0)}function _K(r,e){let t=r.size,i=-1,n=t-1,s=7,o=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!r.isReserved(n,a-u)){let h=!1;o>>s&1)===1),r.set(n,a-u,h),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function bK(r,e,t){let i=new hK;t.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),wK.getCharCountIndicator(u.mode,r)),u.write(i)});let n=Gp.getSymbolTotalCodewords(r),s=hE.getTotalCodewordsCount(r,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);let a=(o-i.getLengthInBits())/8;for(let u=0;u"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof r.senderPublicKey<"u"?nt.fromString(r.senderPublicKey,dr):void 0,i=typeof r.iv<"u"?nt.fromString(r.iv,dr):H2.randomBytes(Jw),n=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)).seal(i,nt.fromString(r.message,md));return Z2({type:e,sealed:n,iv:i,senderPublicKey:t})}function xq(r){let e=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)),{sealed:t,iv:i}=s1(r.encoded),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return nt.toString(n,md)}function Z2(r){if(Wc(r.type)===fu){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nt.toString(nt.concat([r.type,r.senderPublicKey,r.iv,r.sealed]),dd)}return nt.toString(nt.concat([r.type,r.iv,r.sealed]),dd)}function s1(r){let e=nt.fromString(r,dd),t=e.slice(Eq,M2),i=M2;if(Wc(t)===fu){let a=i+n1,u=a+Jw,h=e.slice(i,a),p=e.slice(a,u),w=e.slice(u);return{type:t,sealed:w,iv:p,senderPublicKey:h}}let n=i+Jw,s=e.slice(i,n),o=e.slice(n);return{type:t,sealed:o,iv:s}}function Tq(r,e){let t=s1(r);return eT({type:Wc(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?nt.toString(t.senderPublicKey,dr):void 0,receiverPublicKey:e?.receiverPublicKey})}function eT(r){let e=r?.type||i1;if(e===fu){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function Nq(r){return r.type===fu&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var Dq=Object.defineProperty,R2=Object.getOwnPropertySymbols,Oq=Object.prototype.hasOwnProperty,Pq=Object.prototype.propertyIsEnumerable,L2=(r,e,t)=>e in r?Dq(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F2=(r,e)=>{for(var t in e||(e={}))Oq.call(e,t)&&L2(r,t,e[t]);if(R2)for(var t of R2(e))Pq.call(e,t)&&L2(r,t,e[t]);return r},tT="ReactNative",lu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pd=" ",Bq=":",rT="/",o1=2,Mq=1e3,iT="js";function a1(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}function nT(){return!zc.getDocument()&&!!zc.getNavigator()&&navigator.product===tT}function sT(){return!a1()&&!!zc.getNavigator()}function u1(){return nT()?lu.reactNative:a1()?lu.node:sT()?lu.browser:lu.unknown}function oT(r,e){let t=hd.parse(r);return t=F2(F2({},t),e),r=hd.stringify(t),r}function Rq(){return lq.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Lq(r,e){var t;let i=u1(),n={protocol:r,version:e,env:i};return i==="browser"&&(n.host=((t=zc.getLocation())==null?void 0:t.host)||"unknown"),n}function aT(){let r=cq.detect();if(r===null)return"unknown";let e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function uT(){var r;let e=u1();return e===lu.browser?[e,((r=zc.getLocation())==null?void 0:r.host)||"unknown"].join(":"):e}function cT(r,e,t){let i=aT(),n=uT();return[[r,e].join("-"),[iT,t].join("-"),i,n].join("/")}function Fq({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s}){let o=t.split("?"),a=cT(r,e,i),u={auth:n,ua:a,projectId:s},h=oT(o[1]||"",u);return o[0]+"?"+h}function Uq(r){let e=(r.match(/^[^:]+(?=:\/\/)/gi)||[])[0],t=typeof e<"u"?r.split("://")[1]:r;return e=e==="wss"?"https":"http",[e,t].join("://")}function qq(r,e,t){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function lT(r,e=o1){return fT(r.split(rT),e)}function Vq(r){return lT(r).join(pd)}function an(r,e){return r.filter(t=>e.includes(t)).length===r.length}function fT(r,e=o1){return r.slice(Math.max(r.length-e,0))}function Hq(r){return Object.fromEntries(r.entries())}function Qq(r){return new Map(Object.entries(r))}function jq(r,e){let t={};return Object.keys(r).forEach(i=>{t[i]=e(r[i])}),t}var Gq=r=>r;function hT(r){return r.trim().replace(/^\w/,e=>e.toUpperCase())}function Kq(r){return r.split(pd).map(e=>hT(e)).join(pd)}function zq(r){let e=Kc.toMiliseconds(r||Kc.FIVE_MINUTES),t,i,n;return{resolve:s=>{n&&t&&(clearTimeout(n),t(s))},reject:s=>{n&&i&&(clearTimeout(n),i(s))},done:()=>new Promise((s,o)=>{n=setTimeout(o,e),t=s,i=o})}}function kq(r,e){return new Promise(async(t,i)=>{let n=setTimeout(()=>i(),e),s=await r;clearTimeout(n),t(s)})}function c1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function Wq(r){return c1("topic",r)}function $q(r){return c1("id",r)}function Yq(r){let[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Jq(r,e){return Kc.fromMiliseconds((e||Date.now())+Kc.toMiliseconds(r))}function Xq(r){return Date.now()>=Kc.toMiliseconds(r)}function Zq(r,e){return`${r}${e?`:${e}`:""}`}var dT="irn";function eV(r){return r?.relay||{protocol:dT}}function tV(r){let e=hq.RELAY_JSONRPC[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var rV=Object.defineProperty,U2=Object.getOwnPropertySymbols,iV=Object.prototype.hasOwnProperty,nV=Object.prototype.propertyIsEnumerable,q2=(r,e,t)=>e in r?rV(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sV=(r,e)=>{for(var t in e||(e={}))iV.call(e,t)&&q2(r,t,e[t]);if(U2)for(var t of U2(e))nV.call(e,t)&&q2(r,t,e[t]);return r};function pT(r,e="-"){let t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){let s=n.replace(i,""),o=r[n];t[s]=o}}),t}function oV(r){let e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",o=hd.parse(s);return{protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:pT(o)}}function gT(r,e="-"){let t="relay",i={};return Object.keys(r).forEach(n=>{let s=t+e+n;r[n]&&(i[s]=r[n])}),i}function aV(r){return`${r.protocol}:${r.topic}@${r.version}?`+hd.stringify(sV({symKey:r.symKey},gT(r.relay)))}function hu(r){let e=[];return r.forEach(t=>{let[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function yT(r){let e=[];return Object.values(r).forEach(t=>{e.push(...hu(t.accounts))}),e}function mT(r,e){let t=[];return Object.values(r).forEach(i=>{hu(i.accounts).includes(e)&&t.push(...i.methods)}),t}function wT(r,e){let t=[];return Object.values(r).forEach(i=>{hu(i.accounts).includes(e)&&t.push(...i.events)}),t}function uV(r,e){let t=CT(r,e);if(t)throw new Error(t.message);let i={};for(let[n,s]of Object.entries(r))i[n]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return i}var cV={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}},lV={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 Hn(r,e){let{message:t,code:i}=lV[r];return{message:e?`${t} ${e}`:t,code:i}}function io(r,e){let{message:t,code:i}=cV[r];return{message:e?`${t} ${e}`:t,code:i}}function $c(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function l1(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Qn(r){return typeof r>"u"}function Sr(r,e){return e&&Qn(r)?!0:typeof r=="string"&&Boolean(r.trim().length)}function wd(r,e){return e&&Qn(r)?!0:typeof r=="number"&&!isNaN(r)}function fV(r,e){let{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t),s=!0;return an(n,i)?(i.forEach(o=>{let{accounts:a,methods:u,events:h}=r.namespaces[o],p=hu(a),w=t[o];(!an(kc(o,w),p)||!an(w.methods,u)||!an(w.events,h))&&(s=!1)}),s):!1}function vd(r){return Sr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function vT(r){if(Sr(r,!1)&&r.includes(":")){let e=r.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&vd(t)}}return!1}function hV(r){if(Sr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function dV(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function pV(r){return r?.topic}function gV(r,e){let t=null;return Sr(r?.publicKey,!1)||(t=Hn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Xw(r){let e=!0;return $c(r)?r.length&&(e=r.every(t=>Sr(t,!1))):e=!1,e}function ET(r,e,t){let i=null;return $c(e)?e.forEach(n=>{i||(!vd(n)||!n.includes(r))&&(i=io("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):i=io("UNSUPPORTED_CHAINS",`${t}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),i}function AT(r,e){let t=null;return Object.entries(r).forEach(([i,n])=>{if(t)return;let s=ET(i,kc(i,n),`${e} requiredNamespace`);s&&(t=s)}),t}function IT(r,e){let t=null;return $c(r)?r.forEach(i=>{t||vT(i)||(t=io("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=io("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function _T(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=IT(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function bT(r,e){let t=null;return Xw(r?.methods)?Xw(r?.events)||(t=io("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=io("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function f1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=bT(i,`${e}, namespace`);n&&(t=n)}),t}function yV(r,e,t){let i=null;if(r&&l1(r)){let n=f1(r,e);n&&(i=n);let s=AT(r,e);s&&(i=s)}else i=Hn("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function CT(r,e){let t=null;if(r&&l1(r)){let i=f1(r,e);i&&(t=i);let n=_T(r,e);n&&(t=n)}else t=Hn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function ST(r){return Sr(r.protocol,!0)}function mV(r,e){let t=!1;return e&&!r?t=!0:r&&$c(r)&&r.length&&r.forEach(i=>{t=ST(i)}),t}function wV(r){return typeof r=="number"}function vV(r){return typeof r<"u"&&typeof r!==null}function EV(r){return!(!r||typeof r!="object"||!r.code||!wd(r.code,!1)||!r.message||!Sr(r.message,!1))}function AV(r){return!(Qn(r)||!Sr(r.method,!1))}function IV(r){return!(Qn(r)||Qn(r.result)&&Qn(r.error)||!wd(r.id,!1)||!Sr(r.jsonrpc,!1))}function _V(r){return!(Qn(r)||!Sr(r.name,!1))}function bV(r,e){return!(!vd(e)||!yT(r).includes(e))}function CV(r,e,t){return Sr(t,!1)?mT(r,e).includes(t):!1}function SV(r,e,t){return Sr(t,!1)?wT(r,e).includes(t):!1}function xV(r,e,t,i){let n=null,s=Object.keys(r),o=Object.keys(e);return an(s,o)?s.forEach(a=>{if(n)return;let u=hu(e[a].accounts);an(kc(a,r[a]),u)?an(r[a].methods,e[a].methods)?an(r[a].events,e[a].events)||(n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${a}`)):n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${a}`):n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace chains for ${a}`)}):n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy ${i}`),n}function TV(r,e){return wd(r,!1)&&r<=e.max&&r>=e.min}re.BASE10=r1,re.BASE16=dr,re.BASE64=dd,re.COLON=Bq,re.DEFAULT_DEPTH=o1,re.EMPTY_SPACE=pd,re.ENV_MAP=lu,re.ONE_THOUSAND=Mq,re.REACT_NATIVE_PRODUCT=tT,re.RELAYER_DEFAULT_PROTOCOL=dT,re.SDK_TYPE=iT,re.SLASH=rT,re.TYPE_0=i1,re.TYPE_1=fu,re.UTF8=md,re.appendToQueryString=oT,re.assertType=qq,re.calcExpiry=Jq,re.capitalize=Kq,re.capitalizeWord=hT,re.createDelayedPromise=zq,re.createExpiringPromise=kq,re.decodeTypeByte=Wc,re.decrypt=xq,re.deriveSymKey=_q,re.deserialize=s1,re.encodeTypeByte=X2,re.encrypt=Sq,re.engineEvent=Zq,re.enumify=Gq,re.formatAccountId=z2,re.formatAccountWithChain=dq,re.formatChainId=K2,re.formatExpirerTarget=c1,re.formatIdTarget=$q,re.formatMessage=vq,re.formatMessageContext=Vq,re.formatRelayParams=gT,re.formatRelayRpcUrl=Fq,re.formatTopicTarget=Wq,re.formatUA=cT,re.formatUri=aV,re.generateKeyPair=Aq,re.generateRandomBytes32=Iq,re.getAccountsChains=hu,re.getAccountsFromNamespaces=gq,re.getAddressFromAccount=k2,re.getAddressesFromAccounts=pq,re.getAppMetadata=Rq,re.getChainFromAccount=W2,re.getChainsFromAccounts=$2,re.getChainsFromNamespace=kc,re.getChainsFromNamespaces=yq,re.getChainsFromRequiredNamespaces=mq,re.getDidAddress=J2,re.getDidAddressSegments=yd,re.getDidChainId=Y2,re.getEnvironment=u1,re.getHttpUrl=Uq,re.getInternalError=Hn,re.getJavascriptID=uT,re.getJavascriptOS=aT,re.getLastItems=fT,re.getNamespacedDidChainId=wq,re.getNamespacesChains=yT,re.getNamespacesEventsForChainId=wT,re.getNamespacesMethodsForChainId=mT,re.getRelayClientMetadata=Lq,re.getRelayProtocolApi=tV,re.getRelayProtocolName=eV,re.getRequiredNamespacesFromNamespaces=uV,re.getSdkError=io,re.getUniqueValues=t1,re.hasOverlap=an,re.hashKey=bq,re.hashMessage=Cq,re.isBrowser=sT,re.isConformingNamespaces=xV,re.isExpired=Xq,re.isNode=a1,re.isProposalStruct=dV,re.isReactNative=nT,re.isSessionCompatible=fV,re.isSessionStruct=pV,re.isTypeOneEnvelope=Nq,re.isUndefined=Qn,re.isValidAccountId=vT,re.isValidAccounts=IT,re.isValidActions=bT,re.isValidArray=$c,re.isValidChainId=vd,re.isValidChains=ET,re.isValidController=gV,re.isValidErrorReason=EV,re.isValidEvent=_V,re.isValidId=wV,re.isValidNamespaceAccounts=_T,re.isValidNamespaceActions=f1,re.isValidNamespaceChains=AT,re.isValidNamespaceMethodsOrEvents=Xw,re.isValidNamespaces=CT,re.isValidNamespacesChainId=bV,re.isValidNamespacesEvent=SV,re.isValidNamespacesRequest=CV,re.isValidNumber=wd,re.isValidObject=l1,re.isValidParams=vV,re.isValidRelay=ST,re.isValidRelays=mV,re.isValidRequest=AV,re.isValidRequestExpiry=TV,re.isValidRequiredNamespaces=yV,re.isValidResponse=IV,re.isValidString=Sr,re.isValidUrl=hV,re.mapEntries=jq,re.mapToObj=Hq,re.objToMap=Qq,re.parseAccountId=e1,re.parseChainId=G2,re.parseContextNames=lT,re.parseExpirerTarget=Yq,re.parseRelayParams=pT,re.parseUri=oV,re.serialize=Z2,re.validateDecoding=Tq,re.validateEncoding=eT});var xT,TT,NT,DT,Ad,Yc,h1,Id,jn,Jc,_d=me(()=>{f();xT="PARSE_ERROR",TT="INVALID_REQUEST",NT="METHOD_NOT_FOUND",DT="INVALID_PARAMS",Ad="INTERNAL_ERROR",Yc="SERVER_ERROR",h1=[-32700,-32600,-32601,-32602,-32603],Id=[-32e3,-32099],jn={[xT]:{code:-32700,message:"Parse error"},[TT]:{code:-32600,message:"Invalid Request"},[NT]:{code:-32601,message:"Method not found"},[DT]:{code:-32602,message:"Invalid params"},[Ad]:{code:-32603,message:"Internal error"},[Yc]:{code:-32e3,message:"Server error"}},Jc=Yc});function NV(r){return r<=Id[0]&&r>=Id[1]}function bd(r){return h1.includes(r)}function OT(r){return typeof r=="number"}function Cd(r){return Object.keys(jn).includes(r)?jn[r]:jn[Jc]}function Sd(r){let e=Object.values(jn).find(t=>t.code===r);return e||jn[Jc]}function DV(r){if(typeof r.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof r.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!OT(r.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${r.error.code}`};if(bd(r.error.code)){let e=Sd(r.error.code);if(e.message!==jn[Jc].message&&r.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${r.error.code}`}}return{valid:!0}}function d1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var p1=me(()=>{f();_d()});var BT=B(Gn=>{"use strict";f();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.isBrowserCryptoAvailable=Gn.getSubtleCrypto=Gn.getBrowerCrypto=void 0;function g1(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Gn.getBrowerCrypto=g1;function PT(){let r=g1();return r.subtle||r.webkitSubtle}Gn.getSubtleCrypto=PT;function OV(){return!!g1()&&!!PT()}Gn.isBrowserCryptoAvailable=OV});var LT=B(Kn=>{"use strict";f();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.isBrowser=Kn.isNode=Kn.isReactNative=void 0;function MT(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Kn.isReactNative=MT;function RT(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}Kn.isNode=RT;function PV(){return!MT()&&!RT()}Kn.isBrowser=PV});var y1=B(xd=>{"use strict";f();Object.defineProperty(xd,"__esModule",{value:!0});var FT=(br(),at(_r));FT.__exportStar(BT(),xd);FT.__exportStar(LT(),xd)});var $t={};ot($t,{isNodeJs:()=>qT});var UT,qT,VT=me(()=>{f();UT=_e(y1());er($t,_e(y1()));qT=UT.isNode});function HT(){let r=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return r+e}function m1(r,e,t){return{id:t||HT(),jsonrpc:"2.0",method:r,params:e}}function BV(r,e){return{id:r,jsonrpc:"2.0",result:e}}function w1(r,e,t){return{id:r,jsonrpc:"2.0",error:QT(e,t)}}function QT(r,e){return typeof r>"u"?Cd(Ad):(typeof r=="string"&&(r=Object.assign(Object.assign({},Cd(Yc)),{message:r})),typeof e<"u"&&(r.data=e),bd(r.code)&&(r=Sd(r.code)),r)}var jT=me(()=>{f();p1();_d()});function MV(r){return r.includes("*")?Nd(r):!/\W/g.test(r)}function Td(r){return r==="*"}function Nd(r){return Td(r)?!0:!(!r.includes("*")||r.split("*").length!==2||r.split("*").filter(e=>e.trim()==="").length!==1)}function RV(r){return!Td(r)&&Nd(r)&&!r.split("*")[0].trim()}function LV(r){return!Td(r)&&Nd(r)&&!r.split("*")[1].trim()}var GT=me(()=>{f()});var KT=me(()=>{f()});var du,v1=me(()=>{f();du=class{}});var E1,Dd,Xc,zT=me(()=>{f();v1();E1=class extends du{constructor(e){super()}},Dd=class extends du{constructor(){super()}},Xc=class extends Dd{constructor(e){super()}}});var kT=me(()=>{f()});var WT=me(()=>{f();KT();v1();zT();kT()});var $T=me(()=>{f();WT()});function qV(r){let e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function YT(r,e){let t=qV(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function VV(r){return YT(r,FV)}function Od(r){return YT(r,UV)}function A1(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}var FV,UV,JT=me(()=>{f();FV="^https?:",UV="^wss?:"});function I1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function HV(r){return I1(r)&&"method"in r}function _1(r){return I1(r)&&(XT(r)||Pd(r))}function XT(r){return"result"in r}function Pd(r){return"error"in r}function QV(r){return"error"in r&&r.valid===!1}var ZT=me(()=>{f()});var lr={};ot(lr,{DEFAULT_ERROR:()=>Jc,IBaseJsonRpcProvider:()=>Dd,IEvents:()=>du,IJsonRpcConnection:()=>E1,IJsonRpcProvider:()=>Xc,INTERNAL_ERROR:()=>Ad,INVALID_PARAMS:()=>DT,INVALID_REQUEST:()=>TT,METHOD_NOT_FOUND:()=>NT,PARSE_ERROR:()=>xT,RESERVED_ERROR_CODES:()=>h1,SERVER_ERROR:()=>Yc,SERVER_ERROR_CODE_RANGE:()=>Id,STANDARD_ERROR_MAP:()=>jn,formatErrorMessage:()=>QT,formatJsonRpcError:()=>w1,formatJsonRpcRequest:()=>m1,formatJsonRpcResult:()=>BV,getError:()=>Cd,getErrorByCode:()=>Sd,isHttpUrl:()=>VV,isJsonRpcError:()=>Pd,isJsonRpcPayload:()=>I1,isJsonRpcRequest:()=>HV,isJsonRpcResponse:()=>_1,isJsonRpcResult:()=>XT,isJsonRpcValidationInvalid:()=>QV,isLocalhostUrl:()=>A1,isNodeJs:()=>qT,isReservedErrorCode:()=>bd,isServerErrorCode:()=>NV,isValidDefaultRoute:()=>Td,isValidErrorCode:()=>OT,isValidLeadingWildcardRoute:()=>RV,isValidRoute:()=>MV,isValidTrailingWildcardRoute:()=>LV,isValidWildcardRoute:()=>Nd,isWsUrl:()=>Od,parseConnectionError:()=>d1,payloadId:()=>HT,validateJsonRpcError:()=>DV});var Zc=me(()=>{f();_d();p1();VT();er(lr,$t);jT();GT();$T();JT();ZT()});var eN,Bd,tN,b1=me(()=>{f();eN=_e($s());Zc();Bd=class extends Xc{constructor(e){super(e),this.events=new eN.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(m1(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Pd(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),_1(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}},tN=Bd});var rN={};ot(rN,{JsonRpcProvider:()=>Bd,default:()=>jV});var jV,iN=me(()=>{f();b1();b1();jV=tN});var sN=B((Gte,nN)=>{"use strict";f();nN.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var aN,oN,GV,KV,zV,Md,uN,C1=me(()=>{f();aN=_e($s());xh();Zc();oN=10,GV=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:sN(),KV=()=>typeof window<"u",zV=GV(),Md=class{constructor(e){if(this.url=e,this.events=new aN.EventEmitter,this.registering=!1,!Od(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=()=>{this.onClose(),e()},this.socket.close()})}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(xc(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Od(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,lr.isReactNative)()?void 0:{rejectUnauthorized:!A1(e)},s=new zV(e,[],n);KV()?s.onerror=o=>{let a=o;i(this.emitError(a.error))}:s.on("error",o=>{i(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=()=>this.onClose(),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t=typeof e.data=="string"?Sc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let i=this.parseError(t),n=i.message||i.toString(),s=w1(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return d1(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>oN&&this.events.setMaxListeners(oN)}emitError(e){let t=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",t),t}},uN=Md});var cN={};ot(cN,{WsConnection:()=>Md,default:()=>kV});var kV,lN=me(()=>{f();C1();C1();kV=uN});var KN=B((el,gu)=>{f();var WV=200,L1="__lodash_hash_undefined__",Qd=1,IN=2,_N=9007199254740991,Rd="[object Arguments]",N1="[object Array]",$V="[object AsyncFunction]",bN="[object Boolean]",CN="[object Date]",SN="[object Error]",xN="[object Function]",YV="[object GeneratorFunction]",Ld="[object Map]",TN="[object Number]",JV="[object Null]",pu="[object Object]",fN="[object Promise]",XV="[object Proxy]",NN="[object RegExp]",Fd="[object Set]",DN="[object String]",ZV="[object Symbol]",e7="[object Undefined]",D1="[object WeakMap]",ON="[object ArrayBuffer]",Ud="[object DataView]",t7="[object Float32Array]",r7="[object Float64Array]",i7="[object Int8Array]",n7="[object Int16Array]",s7="[object Int32Array]",o7="[object Uint8Array]",a7="[object Uint8ClampedArray]",u7="[object Uint16Array]",c7="[object Uint32Array]",l7=/[\\^$.*+?()[\]{}|]/g,f7=/^\[object .+?Constructor\]$/,h7=/^(?:0|[1-9]\d*)$/,Xe={};Xe[t7]=Xe[r7]=Xe[i7]=Xe[n7]=Xe[s7]=Xe[o7]=Xe[a7]=Xe[u7]=Xe[c7]=!0;Xe[Rd]=Xe[N1]=Xe[ON]=Xe[bN]=Xe[Ud]=Xe[CN]=Xe[SN]=Xe[xN]=Xe[Ld]=Xe[TN]=Xe[pu]=Xe[NN]=Xe[Fd]=Xe[DN]=Xe[D1]=!1;var PN=typeof global=="object"&&global&&global.Object===Object&&global,d7=typeof self=="object"&&self&&self.Object===Object&&self,un=PN||d7||Function("return this")(),BN=typeof el=="object"&&el&&!el.nodeType&&el,hN=BN&&typeof gu=="object"&&gu&&!gu.nodeType&&gu,MN=hN&&hN.exports===BN,S1=MN&&PN.process,dN=function(){try{return S1&&S1.binding&&S1.binding("util")}catch{}}(),pN=dN&&dN.isTypedArray;function p7(r,e){for(var t=-1,i=r==null?0:r.length,n=0,s=[];++t-1}function G7(r,e){var t=this.__data__,i=Gd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}cn.prototype.clear=V7;cn.prototype.delete=H7;cn.prototype.get=Q7;cn.prototype.has=j7;cn.prototype.set=G7;function oo(r){var e=-1,t=r==null?0:r.length;for(this.clear();++ea))return!1;var h=s.get(r);if(h&&s.get(e))return h==e;var p=-1,w=!0,N=t&IN?new Vd:void 0;for(s.set(r,e),s.set(e,r);++p-1&&r%1==0&&r-1&&r%1==0&&r<=_N}function jN(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function il(r){return r!=null&&typeof r=="object"}var GN=pN?w7(pN):aH;function AH(r){return vH(r)?iH(r):uH(r)}function IH(){return[]}function _H(){return!1}gu.exports=EH});var z3=B(Ee=>{"use strict";f();Object.defineProperty(Ee,"__esModule",{value:!0});var uo=$s(),bH=lh(),CH=TC(),ip=GC(),st=bm(),Wn=Hm(),zN=(xh(),at(JC)),SH=(Ax(),at(Ex)),fe=Ed(),Ht=Ys(),xH=(iN(),at(rN)),ti=(Zc(),at(lr)),TH=(lN(),at(cN)),NH=KN();function ol(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}function DH(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var OH=ol(uo),c3=ol(bH),PH=ol(CH),zd=DH(SH),BH=ol(TH),MH=ol(NH);function RH(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var LH=RH,FH=LH,l3=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},UH=r=>new TextEncoder().encode(r),qH=r=>new TextDecoder().decode(r),q1=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},V1=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 f3(this,e)}},H1=class{constructor(e){this.decoders=e}or(e){return f3(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},f3=(r,e)=>new H1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Q1=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new q1(e,t,i),this.decoder=new V1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},np=({name:r,prefix:e,encode:t,decode:i})=>new Q1(r,e,t,i),al=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=FH(t,e);return np({prefix:r,name:e,encode:i,decode:s=>l3(n(s))})},VH=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},HH=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<np({prefix:e,name:r,encode(n){return HH(n,i,t)},decode(n){return VH(n,i,t,r)}}),QH=np({prefix:"\0",name:"identity",encode:r=>qH(r),decode:r=>UH(r)}),jH=Object.freeze({__proto__:null,identity:QH}),GH=tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),KH=Object.freeze({__proto__:null,base2:GH}),zH=tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),kH=Object.freeze({__proto__:null,base8:zH}),WH=al({prefix:"9",name:"base10",alphabet:"0123456789"}),$H=Object.freeze({__proto__:null,base10:WH}),YH=tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),JH=tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),XH=Object.freeze({__proto__:null,base16:YH,base16upper:JH}),ZH=tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eQ=tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tQ=tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rQ=tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iQ=tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nQ=tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sQ=tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oQ=tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aQ=tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),uQ=Object.freeze({__proto__:null,base32:ZH,base32upper:eQ,base32pad:tQ,base32padupper:rQ,base32hex:iQ,base32hexupper:nQ,base32hexpad:sQ,base32hexpadupper:oQ,base32z:aQ}),cQ=al({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lQ=al({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),fQ=Object.freeze({__proto__:null,base36:cQ,base36upper:lQ}),hQ=al({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dQ=al({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),pQ=Object.freeze({__proto__:null,base58btc:hQ,base58flickr:dQ}),gQ=tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),yQ=tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mQ=tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wQ=tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),vQ=Object.freeze({__proto__:null,base64:gQ,base64pad:yQ,base64url:mQ,base64urlpad:wQ}),h3=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}"),EQ=h3.reduce((r,e,t)=>(r[t]=e,r),[]),AQ=h3.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function IQ(r){return r.reduce((e,t)=>(e+=EQ[t],e),"")}function _Q(r){let e=[];for(let t of r){let i=AQ[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var bQ=np({prefix:"\u{1F680}",name:"base256emoji",encode:IQ,decode:_Q}),CQ=Object.freeze({__proto__:null,base256emoji:bQ}),SQ=d3,kN=128,xQ=127,TQ=~xQ,NQ=Math.pow(2,31);function d3(r,e,t){e=e||[],t=t||0;for(var i=t;r>=NQ;)e[t++]=r&255|kN,r/=128;for(;r&TQ;)e[t++]=r&255|kN,r>>>=7;return e[t]=r|0,d3.bytes=t-i+1,e}var DQ=j1,OQ=128,WN=127;function j1(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw j1.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WN)<=OQ);return j1.bytes=s-i,t}var PQ=Math.pow(2,7),BQ=Math.pow(2,14),MQ=Math.pow(2,21),RQ=Math.pow(2,28),LQ=Math.pow(2,35),FQ=Math.pow(2,42),UQ=Math.pow(2,49),qQ=Math.pow(2,56),VQ=Math.pow(2,63),HQ=function(r){return r(p3.encode(r,e,t),e),YN=r=>p3.encodingLength(r),G1=(r,e)=>{let t=e.byteLength,i=YN(r),n=i+YN(t),s=new Uint8Array(n+t);return $N(r,s,0),$N(t,s,i),s.set(e,n),new K1(r,t,e,s)},K1=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}},g3=({name:r,code:e,encode:t})=>new z1(r,e,t),z1=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?G1(this.code,t):t.then(i=>G1(this.code,i))}else throw Error("Unknown type, must be binary type")}},y3=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),jQ=g3({name:"sha2-256",code:18,encode:y3("SHA-256")}),GQ=g3({name:"sha2-512",code:19,encode:y3("SHA-512")}),KQ=Object.freeze({__proto__:null,sha256:jQ,sha512:GQ}),m3=0,zQ="identity",w3=l3,kQ=r=>G1(m3,w3(r)),WQ={code:m3,name:zQ,encode:w3,digest:kQ},$Q=Object.freeze({__proto__:null,identity:WQ});new TextEncoder,new TextDecoder;var JN={...jH,...KH,...kH,...$H,...XH,...uQ,...fQ,...pQ,...vQ,...CQ};({...KQ,...$Q});function YQ(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function v3(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var XN=v3("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),F1=v3("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=YQ(r.length);for(let t=0;t{if(!this.initialized){let i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();let n=this.keychain.get(i);if(typeof n>"u"){let{message:s}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$d=class{constructor(e,t,i){this.core=e,this.logger=t,this.name=_3,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();let n=await this.getClientSeed(),s=zd.generateKeyPair(n);return zd.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let n=fe.generateKeyPair();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();let s=await this.getClientSeed(),o=zd.generateKeyPair(s),a=fe.generateRandomBytes32(),u=b3;return await zd.signJWT(a,n,u,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();let a=this.getPrivateKey(n),u=fe.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();let o=s||fe.hashKey(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();let a=fe.validateEncoding(o),u=zN.safeJsonStringify(s);if(fe.isTypeOneEnvelope(a)){let N=a.senderPublicKey,O=a.receiverPublicKey;n=await this.generateSharedKey(N,O)}let h=this.getSymKey(n),{type:p,senderPublicKey:w}=a;return fe.encrypt({type:p,symKey:h,message:u,senderPublicKey:w})},this.decode=async(n,s,o)=>{this.isInitialized();let a=fe.validateDecoding(s,o);if(fe.isTypeOneEnvelope(a)){let p=a.receiverPublicKey,w=a.senderPublicKey;n=await this.generateSharedKey(p,w)}let u=this.getSymKey(n),h=fe.decrypt({symKey:u,encoded:s});return zN.safeJsonParse(h)},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.keychain=i||new Wd(this.core,this.logger)}get context(){return st.getLoggerContext(this.logger)}getPayloadType(e){let t=fe.deserialize(e);return fe.decodeTypeByte(t.type)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(k1)}catch{e=fe.generateRandomBytes32(),await this.keychain.set(k1,e)}return XQ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Yd=class extends Wn.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=x3,this.version=T3,this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();let s=fe.hashMessage(n),o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();let s=this.get(i),o=fe.hashMessage(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=st.generateChildLogger(e,this.name),this.core=t}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$1=class extends Wn.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new uo.EventEmitter,this.name=D3,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(i,n,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});try{let o=s?.ttl||N3,a=fe.getRelayProtocolName(s),u=s?.prompt||!1,h=s?.tag||0,p={topic:i,message:n,opts:{ttl:o,relay:a,prompt:u,tag:h}},w=fe.hashMessage(n);this.queue.set(w,p);try{await await fe.createExpiringPromise(this.rpcPublish(i,n,o,a,u,h),this.publishTimeout),this.relayer.events.emit(fr.publish,p)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(fr.connection_stalled);return}this.onPublish(w,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return st.getLoggerContext(this.logger)}rpcPublish(e,t,i,n,s,o){var a,u,h,p;let w={method:fe.getRelayProtocolApi(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o}};return fe.isUndefined((a=w.params)==null?void 0:a.prompt)&&((u=w.params)==null||delete u.prompt),fe.isUndefined((h=w.params)==null?void 0:h.tag)&&((p=w.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:w}),this.relayer.provider.request(w)}onPublish(e,t){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},Y1=class{constructor(){this.map=new Map,this.set=(e,t)=>{let i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let i=this.get(e);if(!this.exists(e,t))return;let n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},i9=Object.defineProperty,n9=Object.defineProperties,s9=Object.getOwnPropertyDescriptors,ZN=Object.getOwnPropertySymbols,o9=Object.prototype.hasOwnProperty,a9=Object.prototype.propertyIsEnumerable,e3=(r,e,t)=>e in r?i9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kd=(r,e)=>{for(var t in e||(e={}))o9.call(e,t)&&e3(r,t,e[t]);if(ZN)for(var t of ZN(e))a9.call(e,t)&&e3(r,t,e[t]);return r},U1=(r,e)=>n9(r,s9(e)),Jd=class extends Wn.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Y1,this.events=new uo.EventEmitter,this.name=F3,this.version=U3,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ln,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{let s=fe.getRelayProtocolName(n),o={topic:i,relay:s};this.pending.set(i,o);let a=await this.rpcSubscribe(i,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((n,s)=>{let o=new Ht.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),n(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=q3&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.clientId=""}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,t){let i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{let n=fe.getRelayProtocolName(i);await this.rpcUnsubscribe(e,t,n);let s=fe.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t){let i={method:fe.getRelayProtocolApi(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await fe.createExpiringPromise(this.relayer.provider.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(fr.connection_stalled)}return fe.hashMessage(e+this.clientId)}rpcUnsubscribe(e,t,i){let n={method:fe.getRelayProtocolApi(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.provider.request(n)}onSubscribe(e,t){this.setSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}onResubscribe(e,t){this.addSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,kd({},t)),this.topicMap.set(t.topic,e),this.events.emit(ei.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ei.deleted,U1(kd({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ei.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(ei.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}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 resubscribe(e){if(!this.ids.includes(e.id)){let{topic:t,relay:i}=e,n={topic:t,relay:i};this.pending.set(n.topic,n);let s=await this.rpcSubscribe(n.topic,n.relay);this.onResubscribe(s,n)}}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{let t=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(fr.connect,async()=>{await this.onConnect()}),this.relayer.on(fr.disconnect,()=>{this.onDisconnect()}),this.events.on(ei.created,async e=>{let t=ei.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(ei.deleted,async e=>{let t=ei.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}},u9=Object.defineProperty,t3=Object.getOwnPropertySymbols,c9=Object.prototype.hasOwnProperty,l9=Object.prototype.propertyIsEnumerable,r3=(r,e,t)=>e in r?u9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f9=(r,e)=>{for(var t in e||(e={}))c9.call(e,t)&&r3(r,t,e[t]);if(t3)for(var t of t3(e))l9.call(e,t)&&r3(r,t,e[t]);return r},Xd=class extends Wn.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new uo.EventEmitter,this.name=B3,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?st.generateChildLogger(e.logger,this.name):c3.default(st.getDefaultLoggerOptions({level:e.logger||P3})),this.messages=new Yd(this.logger,e.core),this.subscriber=new Jd(this,this.logger),this.publisher=new $1(this,this.logger),this.relayUrl=e?.relayUrl||X1,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return st.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t})}async subscribe(e,t){this.isInitialized();let i="";return await Promise.all([new Promise(n=>{this.subscriber.once(ei.created,s=>{s.topic===e&&n()})}),new Promise(async n=>{i=await this.subscriber.subscribe(e,t),n()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(fr.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(t=>{this.initialized||t(),this.subscriber.once(ei.resubscribed,()=>{t()})}),await Promise.race([new Promise(async t=>{await this.provider.connect(),this.removeListener(fr.transport_closed,this.rejectTransportOpen),t()}),new Promise(t=>this.once(fr.transport_closed,this.rejectTransportOpen))])])}catch(t){let i=t;if(!/socket hang up/i.test(i.message))throw t;this.logger.error(t),this.events.emit(fr.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(await this.transportClose(),await new Promise(t=>setTimeout(t,W1)),await this.transportOpen(e))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);return new xH.JsonRpcProvider(new BH.default(fe.formatRelayRpcUrl({sdkVersion:R3,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){let{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){let{topic:t,message:i}=e;return await this.subscriber.isSubscribed(t)?this.messages.has(t,i):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ti.isJsonRpcRequest(e)){if(!e.method.endsWith(M3))return;let t=e.params,{topic:i,message:n}=t.data,s={topic:i,message:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(f9({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(fr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=ti.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}registerEventListeners(){this.provider.on(sl.payload,e=>this.onProviderPayload(e)),this.provider.on(sl.connect,()=>{this.events.emit(fr.connect)}),this.provider.on(sl.disconnect,()=>{this.events.emit(fr.disconnect),this.attemptToReconnect()}),this.provider.on(sl.error,e=>this.events.emit(fr.error,e)),this.events.on(fr.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Ht.toMiliseconds(W1))}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},h9=Object.defineProperty,i3=Object.getOwnPropertySymbols,d9=Object.prototype.hasOwnProperty,p9=Object.prototype.propertyIsEnumerable,n3=(r,e,t)=>e in r?h9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,s3=(r,e)=>{for(var t in e||(e={}))d9.call(e,t)&&n3(r,t,e[t]);if(i3)for(var t of i3(e))p9.call(e,t)&&n3(r,t,e[t]);return r},Zd=class extends Wn.IStore{constructor(e,t,i,n=ln,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=L3,this.cached=[],this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{fe.isProposalStruct(o)?this.map.set(o.id,o):fe.isSessionStruct(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!fe.isUndefined(o)&&this.map.set(this.getKey(o),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=>MH.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=s3(s3({},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=st.generateChildLogger(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 t=this.map.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ep=class{constructor(e,t){this.core=e,this.logger=t,this.name=V3,this.version=H3,this.events=new OH.default,this.initialized=!1,this.storagePrefix=ln,this.ignoredPayloadTypes=[fe.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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();let i=fe.generateRandomBytes32(),n=await this.core.crypto.setSymKey(i),s=fe.calcExpiry(Ht.FIVE_MINUTES),o={protocol:O3},a={topic:n,expiry:s,relay:o,active:!1},u=fe.formatUri({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:i,relay:o});return await this.pairings.set(n,a),await this.core.relayer.subscribe(n),this.core.expirer.set(n,s),{topic:n,uri:u}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);let{topic:n,symKey:s,relay:o}=fe.parseUri(i.uri),a=fe.calcExpiry(Ht.FIVE_MINUTES),u={topic:n,relay:o,expiry:a,active:!1};return await this.pairings.set(n,u),await this.core.crypto.setSymKey(s,n),await this.core.relayer.subscribe(n,{relay:o}),this.core.expirer.set(n,a),i.activatePairing&&await this.activate({topic:n}),u},this.activate=async({topic:i})=>{this.isInitialized();let n=fe.calcExpiry(Ht.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:n}),this.core.expirer.set(i,n)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);let{topic:n}=i;if(this.pairings.keys.includes(n)){let s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=fe.createDelayedPromise();this.events.once(fe.engineEvent("pairing_ping",s),({error:h})=>{h?u(h):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);let{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",fe.getSdkError("USER_DISCONNECTED")),await this.deletePairing(n))},this.sendRequest=async(i,n,s)=>{let o=ti.formatJsonRpcRequest(n,s),a=await this.core.crypto.encode(i,o),u=mu[n].req;return this.core.history.set(i,o),await this.core.relayer.publish(i,a,u),o.id},this.sendResult=async(i,n,s)=>{let o=ti.formatJsonRpcResult(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=mu[u.request.method].res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{let o=ti.formatJsonRpcError(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=mu[u.request.method]?mu[u.request.method].res:mu.unregistered_method.res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,fe.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{let i=this.pairings.getAll().filter(n=>fe.isExpired(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{let{topic:n,payload:s}=i,o=s.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{let{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{let{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit("pairing_ping",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{let{id:s}=n;setTimeout(()=>{ti.isJsonRpcResult(n)?this.events.emit(fe.engineEvent("pairing_ping",s),{}):ti.isJsonRpcError(n)&&this.events.emit(fe.engineEvent("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{let{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.sendResult(s,i,!0),await this.deletePairing(i),this.events.emit("pairing_delete",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{let{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;let a=fe.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(fe.getSdkError("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!fe.isValidParams(i)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!fe.isValidUrl(i.uri)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}},this.isValidPing=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!fe.isValidString(i,!1)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){let{message:n}=fe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(fe.isExpired(this.pairings.get(i).expiry)){await this.deletePairing(i);let{message:n}=fe.getInternalError("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.pairings=new Zd(this.core,this.logger,this.name,this.storagePrefix)}get context(){return st.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(fr.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;let n=await this.core.crypto.decode(t,i);ti.isJsonRpcRequest(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):ti.isJsonRpcResponse(n)&&(await this.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:t}=fe.parseExpirerTarget(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}},tp=class extends Wn.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new uo.EventEmitter,this.name=Q3,this.version=j3,this.cached=[],this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;let o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Zr.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;let n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ti.isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.events.emit(Zr.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Zr.deleted,s)}})},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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(t=>{if(typeof t.response<"u")return;let i={topic:t.topic,request:ti.formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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(Zr.created,e=>{let t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{let t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{let t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},rp=class extends Wn.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new uo.EventEmitter,this.name=G3,this.version=K3,this.cached=[],this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{let n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();let s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Vr.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();let n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){let n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Vr.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 fe.formatTopicTarget(e);if(typeof e=="number")return fe.formatIdTarget(e);let{message:t}=fe.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 t=this.expirations.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){let{expiry:i}=t;Ht.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let t=Vr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let t=Vr.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let t=Vr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},g9=Object.defineProperty,o3=Object.getOwnPropertySymbols,y9=Object.prototype.hasOwnProperty,m9=Object.prototype.propertyIsEnumerable,a3=(r,e,t)=>e in r?g9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,u3=(r,e)=>{for(var t in e||(e={}))y9.call(e,t)&&a3(r,t,e[t]);if(o3)for(var t of o3(e))m9.call(e,t)&&a3(r,t,e[t]);return r},wu=class extends Wn.ICore{constructor(e){super(e),this.protocol=J1,this.version=E3,this.name=sp,this.events=new uo.EventEmitter,this.initialized=!1,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||X1;let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:c3.default(st.getDefaultLoggerOptions({level:e?.logger||A3.logger}));this.logger=st.generateChildLogger(t,this.name),this.heartbeat=new ip.HeartBeat,this.crypto=new $d(this,this.logger,e?.keychain),this.history=new tp(this,this.logger),this.expirer=new rp(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new PH.default(u3(u3({},I3),e?.storageOptions)),this.relayer=new Xd({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ep(this,this.logger)}static async init(e){let t=new wu(e);return await t.initialize(),t}get context(){return st.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}}},w9=wu;Ee.CORE_CONTEXT=sp,Ee.CORE_DEFAULT=A3,Ee.CORE_PROTOCOL=J1,Ee.CORE_STORAGE_OPTIONS=I3,Ee.CORE_STORAGE_PREFIX=ln,Ee.CORE_VERSION=E3,Ee.CRYPTO_CLIENT_SEED=k1,Ee.CRYPTO_CONTEXT=_3,Ee.CRYPTO_JWT_TTL=b3,Ee.Core=w9,Ee.Crypto=$d,Ee.EXPIRER_CONTEXT=G3,Ee.EXPIRER_DEFAULT_TTL=r9,Ee.EXPIRER_EVENTS=Vr,Ee.EXPIRER_STORAGE_VERSION=K3,Ee.Expirer=rp,Ee.HISTORY_CONTEXT=Q3,Ee.HISTORY_EVENTS=Zr,Ee.HISTORY_STORAGE_VERSION=j3,Ee.JsonRpcHistory=tp,Ee.KEYCHAIN_CONTEXT=C3,Ee.KEYCHAIN_STORAGE_VERSION=S3,Ee.KeyChain=Wd,Ee.MESSAGES_CONTEXT=x3,Ee.MESSAGES_STORAGE_VERSION=T3,Ee.MessageTracker=Yd,Ee.PAIRING_CONTEXT=V3,Ee.PAIRING_DEFAULT_TTL=t9,Ee.PAIRING_RPC_OPTS=mu,Ee.PAIRING_STORAGE_VERSION=H3,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=q3,Ee.PUBLISHER_CONTEXT=D3,Ee.PUBLISHER_DEFAULT_TTL=N3,Ee.Pairing=ep,Ee.RELAYER_CONTEXT=B3,Ee.RELAYER_DEFAULT_LOGGER=P3,Ee.RELAYER_DEFAULT_PROTOCOL=O3,Ee.RELAYER_DEFAULT_RELAY_URL=X1,Ee.RELAYER_EVENTS=fr,Ee.RELAYER_PROVIDER_EVENTS=sl,Ee.RELAYER_RECONNECT_TIMEOUT=W1,Ee.RELAYER_SDK_VERSION=R3,Ee.RELAYER_STORAGE_OPTIONS=ZQ,Ee.RELAYER_SUBSCRIBER_SUFFIX=M3,Ee.Relayer=Xd,Ee.STORE_STORAGE_VERSION=L3,Ee.SUBSCRIBER_CONTEXT=F3,Ee.SUBSCRIBER_DEFAULT_TTL=e9,Ee.SUBSCRIBER_EVENTS=ei,Ee.SUBSCRIBER_STORAGE_VERSION=U3,Ee.Store=Zd,Ee.Subscriber=Jd,Ee.default=wu});var rD=B(lt=>{"use strict";f();Object.defineProperty(lt,"__esModule",{value:!0});var v9=lh(),$n=z3(),Z1=bm(),$3=Hm(),te=Ed(),Y3=$s(),ft=Ys(),Qt=(Zc(),at(lr));function J3(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var E9=J3(v9),A9=J3(Y3),sv="wc",ov=2,av="client",up=`${sv}@${ov}:${av}:`,op={name:av,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},I9={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"},_9={database:":memory:"},b9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},C9="history",S9="0.3",X3="proposal",x9=ft.THIRTY_DAYS,Z3="session",ul=ft.SEVEN_DAYS,eD="engine",vu={wc_sessionPropose:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1115}}},ap={min:ft.FIVE_MINUTES,max:ft.SEVEN_DAYS},tD="request",T9=Object.defineProperty,N9=Object.defineProperties,D9=Object.getOwnPropertyDescriptors,k3=Object.getOwnPropertySymbols,O9=Object.prototype.hasOwnProperty,P9=Object.prototype.propertyIsEnumerable,W3=(r,e,t)=>e in r?T9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hr=(r,e)=>{for(var t in e||(e={}))O9.call(e,t)&&W3(r,t,e[t]);if(k3)for(var t of k3(e))P9.call(e,t)&&W3(r,t,e[t]);return r},ev=(r,e)=>N9(r,D9(e)),tv=class extends $3.IEngine{constructor(e){super(e),this.name=eD,this.events=new A9.default,this.initialized=!1,this.ignoredPayloadTypes=[te.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(vu)}),this.initialized=!0)},this.connect=async t=>{this.isInitialized();let i=ev(Hr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);let{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=i,h=n,p,w=!1;if(h&&(w=this.client.core.pairing.pairings.get(h).active),!h||!w){let{topic:Y,uri:j}=await this.client.core.pairing.create();h=Y,p=j}let N=await this.client.core.crypto.generateKeyPair(),O=Hr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:$n.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:N,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:T,resolve:V,done:z}=te.createDelayedPromise();if(this.events.once(te.engineEvent("session_connect"),async({error:Y,session:j})=>{if(Y)T(Y);else if(j){j.self.publicKey=N;let W=ev(Hr({},j),{requiredNamespaces:j.requiredNamespaces,optionalNamespaces:j.optionalNamespaces});await this.client.session.set(j.topic,W),await this.setExpiry(j.topic,j.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:j.peer.metadata}),V(W)}}),!h){let{message:Y}=te.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(Y)}let $=await this.sendRequest(h,"wc_sessionPropose",O),se=te.calcExpiry(ft.FIVE_MINUTES);return await this.setProposal($,Hr({id:$,expiry:se},O)),{uri:p,approval:z}},this.pair=async t=>(this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{this.isInitialized(),await this.isValidApprove(t);let{id:i,relayProtocol:n,namespaces:s,sessionProperties:o}=t,a=this.client.proposal.get(i),{pairingTopic:u,proposer:h,requiredNamespaces:p,optionalNamespaces:w}=a;te.isValidObject(p)||(p=te.getRequiredNamespacesFromNamespaces(s,"approve()"));let N=await this.client.core.crypto.generateKeyPair(),O=h.publicKey,T=await this.client.core.crypto.generateSharedKey(N,O);u&&i&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:h.metadata}),await this.sendResult(i,u,{relay:{protocol:n??"irn"},responderPublicKey:N}),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let V=Hr({relay:{protocol:n??"irn"},namespaces:s,requiredNamespaces:p,optionalNamespaces:w,controller:{publicKey:N,metadata:this.client.metadata},expiry:te.calcExpiry(ul)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(T);let z=await this.sendRequest(T,"wc_sessionSettle",V),{done:$,resolve:se,reject:Y}=te.createDelayedPromise();this.events.once(te.engineEvent("session_approve",z),({error:W})=>{W?Y(W):se(this.client.session.get(T))});let j=ev(Hr({},V),{topic:T,acknowledged:!1,self:V.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:N});return await this.client.session.set(T,j),await this.setExpiry(T,te.calcExpiry(ul)),{topic:T,acknowledged:$}},this.reject=async t=>{this.isInitialized(),await this.isValidReject(t);let{id:i,reason:n}=t,{pairingTopic:s}=this.client.proposal.get(i);s&&(await this.sendError(i,s,n),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.isValidUpdate(t);let{topic:i,namespaces:n}=t,s=await this.sendRequest(i,"wc_sessionUpdate",{namespaces:n}),{done:o,resolve:a,reject:u}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_update",s),({error:h})=>{h?u(h):a()}),await this.client.session.update(i,{namespaces:n}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.isValidExtend(t);let{topic:i}=t,n=await this.sendRequest(i,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_extend",n),({error:u})=>{u?a(u):o()}),await this.setExpiry(i,te.calcExpiry(ul)),{acknowledged:s}},this.request=async t=>{this.isInitialized(),await this.isValidRequest(t);let{chainId:i,request:n,topic:s,expiry:o}=t,a=await this.sendRequest(s,"wc_sessionRequest",{request:n,chainId:i},o),{done:u,resolve:h,reject:p}=te.createDelayedPromise(o);return this.events.once(te.engineEvent("session_request",a),({error:w,result:N})=>{w?p(w):h(N)}),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i}),await u()},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);let{topic:i,response:n}=t,{id:s}=n;Qt.isJsonRpcResult(n)?await this.sendResult(s,i,n.result):Qt.isJsonRpcError(n)&&await this.sendError(s,i,n.error),this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0})},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);let{topic:i}=t;if(this.client.session.keys.includes(i)){let n=await this.sendRequest(i,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();this.events.once(te.engineEvent("session_ping",n),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.isValidEmit(t);let{topic:i,event:n,chainId:s}=t;await this.sendRequest(i,"wc_sessionEvent",{event:n,chainId:s})},this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);let{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest(i,"wc_sessionDelete",te.getSdkError("USER_DISCONNECTED")),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>te.isSessionCompatible(i,t))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(t,i)=>{let{self:n}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await Promise.all([this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.deleteSymKey(t),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,te.getSdkError("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.setPendingSessionRequest=async t=>{let i=vu.wc_sessionRequest.req.ttl,{id:n,topic:s,params:o}=t;await this.client.pendingRequest.set(n,{id:n,topic:s,params:o}),i&&this.client.core.expirer.set(n,te.calcExpiry(i))},this.sendRequest=async(t,i,n,s)=>{let o=Qt.formatJsonRpcRequest(i,n),a=await this.client.core.crypto.encode(t,o),u=vu[i].req;return s&&(u.ttl=s),this.client.core.history.set(t,o),this.client.core.relayer.publish(t,a,u),o.id},this.sendResult=async(t,i,n)=>{let s=Qt.formatJsonRpcResult(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=vu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.sendError=async(t,i,n)=>{let s=Qt.formatJsonRpcError(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=vu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let t=[],i=[];this.client.session.getAll().forEach(n=>{te.isExpired(n.expiry)&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{te.isExpired(n.expiry)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession(n)),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=t=>{let{topic:i,payload:n}=t,s=n.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(i,n);case"wc_sessionSettle":return this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return this.onSessionExtendRequest(i,n);case"wc_sessionPing":return this.onSessionPingRequest(i,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return this.onSessionRequest(i,n);case"wc_sessionEvent":return this.onSessionEventRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async t=>{let{topic:i,payload:n}=t,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidConnect(Hr({},i.params));let o=te.calcExpiry(ft.FIVE_MINUTES),a=Hr({id:s,pairingTopic:t,expiry:o},n);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(t,i)=>{let{id:n}=i;if(Qt.isJsonRpcResult(i)){let{result:s}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(n);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 h=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});let p=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:t})}else Qt.isJsonRpcError(i)&&(await this.client.proposal.delete(n,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:h,requiredNamespaces:p,optionalNamespaces:w,sessionProperties:N}=i.params,O=Hr({topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,requiredNamespaces:p,optionalNamespaces:w,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},N&&{sessionProperties:N});await this.sendResult(i.id,t,!0),this.events.emit(te.engineEvent("session_connect"),{session:O})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(te.engineEvent("session_approve",n),{})):Qt.isJsonRpcError(i)&&(await this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidUpdate(Hr({topic:t},n)),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult(s,t,!0),this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_update",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{let{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,te.calcExpiry(ul)),await this.sendResult(n,t,!0),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_extend",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{let{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult(n,t,!0),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{let{id:n}=i;setTimeout(()=>{Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_ping",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{let{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),this.client.core.relayer.once($n.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(t)}),await this.sendResult(n,t,!0),this.client.events.emit("session_delete",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidRequest(Hr({topic:t},s)),await this.setPendingSessionRequest({id:n,topic:t,params:s}),this.client.events.emit("session_request",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_request",n),{result:i.result}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidEmit(Hr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.isValidConnect=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(u)}let{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:a}=t;if(te.isUndefined(i)||await this.isValidPairingTopic(i),!te.isValidRelays(a,!0)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!te.isUndefined(n)&&te.isValidObject(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!te.isUndefined(s)&&te.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(t,i)=>{let n=te.isValidRequiredNamespaces(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!te.isValidParams(t))throw new Error(te.getInternalError("MISSING_OR_INVALID",`approve() params: ${t}`).message);let{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=t;await this.isValidProposalId(i);let a=this.client.proposal.get(i),u=te.isValidNamespaces(n,"approve()");if(u)throw new Error(u.message);let h=te.isConformingNamespaces(a.requiredNamespaces,n,"approve()","requiredNamespaces");if(h)throw new Error(h.message);if(!te.isValidString(s,!0)){let{message:p}=te.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(p)}if(Object.keys(n).length>Object.keys(a.requiredNamespaces).length){let p=Object.keys(a.optionalNamespaces).filter(O=>n[O]),w={};for(let O in a.optionalNamespaces)p.includes(O)&&(w[O]=a.optionalNamespaces[O]);let N=te.isConformingNamespaces(w,n,"approve()","optionalNamespaces");if(N)throw new Error(N.message)}te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}let{id:i,reason:n}=t;if(await this.isValidProposalId(i),!te.isValidErrorReason(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!te.isValidParams(t)){let{message:h}=te.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}let{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!te.isValidRelay(i)){let{message:h}=te.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}let a=te.isValidController(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=te.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(te.isExpired(o)){let{message:h}=te.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}let{topic:i,namespaces:n}=t;await this.isValidSessionTopic(i);let s=this.client.session.get(i),o=te.isValidNamespaces(n,"update()");if(o)throw new Error(o.message);let a=te.isConformingNamespaces(s.requiredNamespaces,n,"update()","requiredNamespaces");if(a)throw new Error(a.message)},this.isValidExtend=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(u)}let{topic:i,request:n,chainId:s,expiry:o}=t;await this.isValidSessionTopic(i);let{namespaces:a}=this.client.session.get(i);if(!te.isValidNamespacesChainId(a,s)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!te.isValidRequest(n)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(u)}if(!te.isValidNamespacesRequest(a,s,n.method)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(u)}if(o&&!te.isValidRequestExpiry(o,ap)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ap.min} and ${ap.max}`);throw new Error(u)}},this.isValidRespond=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(s)}let{topic:i,response:n}=t;if(await this.isValidSessionTopic(i),!te.isValidResponse(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidPing=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!te.isValidParams(t)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}let{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!te.isValidNamespacesChainId(o,s)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!te.isValidEvent(n)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!te.isValidNamespacesEvent(o,s,n.name)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!te.isValidString(n,!1)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`${i} must be in Record format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on($n.RELAYER_EVENTS.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;let n=await this.client.core.crypto.decode(t,i);Qt.isJsonRpcRequest(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):Qt.isJsonRpcResponse(n)&&(await this.client.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.client.core.expirer.on($n.EXPIRER_EVENTS.expired,async e=>{let{topic:t,id:i}=te.parseExpirerTarget(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,te.getInternalError("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}isValidPairingTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=te.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=te.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(t)}}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(te.isValidString(e,!1)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!te.isValidId(e)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=te.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},rv=class extends $n.Store{constructor(e,t){super(e,t,X3,up),this.core=e,this.logger=t}},iv=class extends $n.Store{constructor(e,t){super(e,t,Z3,up),this.core=e,this.logger=t}},nv=class extends $n.Store{constructor(e,t){super(e,t,tD,up),this.core=e,this.logger=t}},Eu=class extends $3.ISignClient{constructor(e){super(e),this.protocol=sv,this.version=ov,this.name=op.name,this.events=new Y3.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||op.name,this.metadata=e?.metadata||te.getAppMetadata();let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:E9.default(Z1.getDefaultLoggerOptions({level:e?.logger||op.logger}));this.core=e?.core||new $n.Core(e),this.logger=Z1.generateChildLogger(t,this.name),this.session=new iv(this.core,this.logger),this.proposal=new rv(this.core,this.logger),this.pendingRequest=new nv(this.core,this.logger),this.engine=new tv(this)}static async init(e){let t=new Eu(e);return await t.initialize(),t}get context(){return Z1.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.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},B9=Eu;lt.ENGINE_CONTEXT=eD,lt.ENGINE_RPC_OPTS=vu,lt.HISTORY_CONTEXT=C9,lt.HISTORY_EVENTS=b9,lt.HISTORY_STORAGE_VERSION=S9,lt.PROPOSAL_CONTEXT=X3,lt.PROPOSAL_EXPIRY=x9,lt.REQUEST_CONTEXT=tD,lt.SESSION_CONTEXT=Z3,lt.SESSION_EXPIRY=ul,lt.SESSION_REQUEST_EXPIRY_BOUNDARIES=ap,lt.SIGN_CLIENT_CONTEXT=av,lt.SIGN_CLIENT_DEFAULT=op,lt.SIGN_CLIENT_EVENTS=I9,lt.SIGN_CLIENT_PROTOCOL=sv,lt.SIGN_CLIENT_STORAGE_OPTIONS=_9,lt.SIGN_CLIENT_STORAGE_PREFIX=up,lt.SIGN_CLIENT_VERSION=ov,lt.SignClient=B9,lt.default=Eu});var iD=B(Mi=>{"use strict";f();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.WALLETCONNECT_OLD_METHOD_PREFIX=Mi.WALLETCONNECT_OLD_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE="multiversx";Mi.WALLETCONNECT_OLD_NAMESPACE="elrond";Mi.WALLETCONNECT_OLD_METHOD_PREFIX="erd"});var nD=B(Yn=>{"use strict";f();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.OldOperation=Yn.Operation=void 0;var M9;(function(r){r.SIGN_TRANSACTION="multiversx_signTransaction",r.SIGN_TRANSACTIONS="multiversx_signTransactions",r.SIGN_MESSAGE="multiversx_signMessage",r.SIGN_LOGIN_TOKEN="multiversx_signLoginToken"})(M9=Yn.Operation||(Yn.Operation={}));var R9;(function(r){r.SIGN_TRANSACTION="erd_signTransaction",r.SIGN_TRANSACTIONS="erd_signTransactions",r.SIGN_MESSAGE="erd_signMessage",r.SIGN_LOGIN_TOKEN="erd_signLoginToken"})(R9=Yn.OldOperation||(Yn.OldOperation={}))});var sD=B(cp=>{"use strict";f();Object.defineProperty(cp,"__esModule",{value:!0});cp.Logger=void 0;var uv=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};cp.Logger=uv});var oD=B(Au=>{"use strict";f();Object.defineProperty(Au,"__esModule",{value:!0});Au.Signature=Au.Address=void 0;var cv=class{constructor(e){this.value=e}bech32(){return this.value}};Au.Address=cv;var cl=class{constructor(e){this.buffer=e}static fromHex(e){return new cl(y.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Au.Signature=cl});var hv=B(ri=>{"use strict";f();Object.defineProperty(ri,"__esModule",{value:!0});ri.WalletConnectV2ProviderErrorMessagesEnum=ri.ErrBadAddress=ri.ErrNotImplemented=ri.Err=void 0;var ll=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};ri.Err=ll;var lv=class extends ll{constructor(){super("Method not yet implemented")}};ri.ErrNotImplemented=lv;var fv=class extends ll{constructor(e,t){super(`Bad address: ${e}`,t)}};ri.ErrBadAddress=fv;var L9;(function(r){r.unableToInit="WalletConnect is unable to init",r.notInitialized="WalletConnect is not initialized",r.unableToConnect="WalletConnect is unable to connect",r.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",r.unableToSignLoginToken="WalletConnect could not sign login token",r.unableToLogin="WalletConnect is unable to login",r.unableToHandleTopic="WalletConnect: Unable to handle topic update",r.unableToHandleEvent="WalletConnect: Unable to handle events",r.sessionNotConnected="WalletConnect Session is not connected",r.sessionDeleted="WalletConnect Session Deleted",r.sessionExpired="WalletConnect Session Expired",r.alreadyLoggedOut="WalletConnect: Already logged out",r.pingFailed="WalletConnect Ping Failed",r.invalidAddress="WalletConnect: Invalid address",r.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",r.invalidMessageResponse="WalletConnect could not sign the message",r.invalidMessageSignature="WalletConnect: Invalid message signature",r.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",r.invalidCustomRequestResponse="WalletConnect could not send the custom request",r.transactionError="Transaction canceled",r.connectionError="WalletConnect could not establish a connection"})(L9=ri.WalletConnectV2ProviderErrorMessagesEnum||(ri.WalletConnectV2ProviderErrorMessagesEnum={}))});var uD=B(Ri=>{"use strict";f();var F9=Ri&&Ri.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),U9=Ri&&Ri.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),q9=Ri&&Ri.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&F9(e,r,t);return U9(e,r),e};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.UserAddress=void 0;var V9=q9(kl()),aD=hv(),H9="erd",fl=class{constructor(e){this.value=e}static fromBech32(e){let t;try{t=V9.decode(e)}catch(i){throw new aD.ErrBadAddress(e,i)}if(t.prefix!=H9)throw new aD.ErrBadAddress(e);return new fl(e)}bech32(){return this.value}};Ri.UserAddress=fl});var dl=B(Fi=>{"use strict";f();var Yt=Fi&&Fi.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},Q9=Fi&&Fi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.WalletConnectV2Provider=Fi.WalletConnectV2ProviderErrorMessagesEnum=void 0;var j9=Q9(rD()),cD=Ed(),Ke=iD(),Li=nD(),Fe=sD(),hl=oD(),pe=hv();Object.defineProperty(Fi,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return pe.WalletConnectV2ProviderErrorMessagesEnum}});var lp=uD(),dv=class{constructor(e,t,i,n,s){this.chainId="",this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.options={},this.onClientConnect=e,this.chainId=t,this.walletConnectV2Relay=i,this.walletConnectV2ProjectId=n,this.options=s}reset(){this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.session=void 0}init(){return Yt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{this.reset();let e=yield j9.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,t)=>e(Boolean(this.isInitialized()&&typeof this.session<"u")))}connect(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"&&(yield this.init()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=[...Object.values(Li.Operation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)):[]],n=[...Object.values(Li.OldOperation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)):[]],s=[`${Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=[`${Ke.WALLETCONNECT_OLD_NAMESPACE}:${this.chainId}`],a=(t=e?.events)!==null&&t!==void 0?t:[];try{let u=yield this.walletConnector.connect({pairingTopic:e?.topic,requiredNamespaces:{[Ke.WALLETCONNECT_OLD_NAMESPACE]:{methods:n,chains:o,events:a}},optionalNamespaces:{[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:a}}});return this.events=a,this.methods=i,u}catch{throw e?.topic?(yield this.logout({topic:e.topic}),Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting)):(Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect))}})}login(e){var t,i;return Yt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout());try{if(e&&e.approval){let n=yield e.approval();if(!((t=n?.namespaces)===null||t===void 0)&&t[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((i=n?.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE),e.token){let s=this.getAddressFromSession(n),{signature:o}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_LOGIN_TOKEN:Li.OldOperation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:s}}});if(!o)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:o})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let i=(t=e?.topic)!==null&&t!==void 0?t:this.getCurrentTopic(this.walletConnector);if(i){yield this.walletConnector.disconnect({topic:i,reason:cD.getSdkError("USER_DISCONNECTED")});let n=this.walletConnector.core.pairing.pairings.getAll({active:!0}).filter(s=>s.topic!==i);this.pairings=n}}catch{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0}),this.reset()}return!0})}getAddress(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(e=this.pairings)!==null&&e!==void 0?e:this.walletConnector.core.pairing.pairings.getAll({active:!0})})}signMessage(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),{signature:i}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_MESSAGE:Li.OldOperation.SIGN_MESSAGE,params:{address:t,message:e.message.toString()}}});if(!i)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new hl.Signature(i),lp.UserAddress.fromBech32(t))}catch{throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.toPlainObject(i);if(this.chainId!==e.getChainID().valueOf())throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTION:Li.OldOperation.SIGN_TRANSACTION,params:{transaction:n}}});if(!s)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(hl.Signature.fromHex(s),lp.UserAddress.fromBech32(t)),e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(i)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTIONS:Li.OldOperation.SIGN_TRANSACTIONS,params:{transactions:n}}});(!s||!Array.isArray(s))&&Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(hl.Signature.fromHex(s[o].signature),lp.UserAddress.fromBech32(t));return e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((t=e?.request)===null||t===void 0)&&t.method){let i=Object.assign({},e.request),{method:n}=i;i.method.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)&&this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_OLD_METHOD_PREFIX,this.namespace)),i.method.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)&&this.namespace===Ke.WALLETCONNECT_OLD_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE,Ke.WALLETCONNECT_OLD_METHOD_PREFIX));let{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},i),{method:n})});if(!s)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{return yield this.walletConnector.ping({topic:this.getCurrentTopic(this.walletConnector)}),!0}catch{return Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return Yt(this,void 0,void 0,function*(){if(e){if(this.addressIsValid(e.address)){this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin();return}if(Fe.Logger.error(`${pe.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector){yield this.walletConnector.disconnect({topic:this.getCurrentTopic(this.walletConnector),reason:cD.getSdkError("USER_DISCONNECTED")});let t=this.walletConnector.core.pairing.pairings.getAll({active:!0});this.pairings=t}}})}onSessionConnected(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session,!((i=(t=e.session)===null||t===void 0?void 0:t.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((s=(n=e.session)===null||n===void 0?void 0:n.namespaces)===null||s===void 0)&&s[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE);let o=this.getAddressFromSession(e.session);return o&&(yield this.loginAccount({address:o,signature:e.signature})),""})}handleTopicUpdateEvent({topic:e}){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.address&&!this.isInitializing&&this.pairings)if(((t=this.pairings)===null||t===void 0?void 0:t.length)===0)this.onClientConnect.onClientLogout();else{let i=this.pairings[this.pairings.length-1];i?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0})}})}handleSessionEvents({topic:e,params:t}){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let{event:i}=t;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let n=i.data;this.onClientConnect.onClientEvent(n)}})}subscribeToEvents(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{let{namespaces:u}=a,h=e.session.get(o),p=Object.assign(Object.assign({},h),{namespaces:u});this.onSessionConnected({session:p})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",()=>{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout()}),e.on("session_expire",()=>{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout()}),(i=(t=e?.core)===null||t===void 0?void 0:t.pairing)===null||i===void 0||i.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(n=e?.core)===null||n===void 0?void 0:n.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=e.pairing.getAll({active:!0}),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let t=this.getCurrentSession(e);if(t)return yield this.onSessionConnected({session:t}),t}})}getCurrentSession(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t])}else throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t]).topic}else throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}addressIsValid(e){try{return!!lp.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){var t;let i=e.namespaces[(t=this.namespace)!==null&&t!==void 0?t:Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(i&&i.accounts){let n=i.accounts[0],[s,o,a]=n.split(":");return a}return""}};Fi.WalletConnectV2Provider=dv});var fD=B((wre,lD)=>{"use strict";f();lD.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var pD=B((Ere,dD)=>{"use strict";f();var hD=typeof Symbol<"u"&&Symbol,G9=fD();dD.exports=function(){return typeof hD!="function"||typeof Symbol!="function"||typeof hD("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:G9()}});var yD=B((Ire,gD)=>{"use strict";f();var K9="Function.prototype.bind called on incompatible ",pv=Array.prototype.slice,z9=Object.prototype.toString,k9="[object Function]";gD.exports=function(e){var t=this;if(typeof t!="function"||z9.call(t)!==k9)throw new TypeError(K9+t);for(var i=pv.call(arguments,1),n,s=function(){if(this instanceof n){var p=t.apply(this,i.concat(pv.call(arguments)));return Object(p)===p?p:this}else return t.apply(e,i.concat(pv.call(arguments)))},o=Math.max(0,t.length-i.length),a=[],u=0;u{"use strict";f();var W9=yD();mD.exports=Function.prototype.bind||W9});var vD=B((Sre,wD)=>{"use strict";f();var $9=fp();wD.exports=$9.call(Function.call,Object.prototype.hasOwnProperty)});var pp=B((Tre,bD)=>{"use strict";f();var Me,Cu=SyntaxError,_D=Function,bu=TypeError,gv=function(r){try{return _D('"use strict"; return ('+r+").constructor;")()}catch{}},co=Object.getOwnPropertyDescriptor;if(co)try{co({},"")}catch{co=null}var yv=function(){throw new bu},Y9=co?function(){try{return arguments.callee,yv}catch{try{return co(arguments,"callee").get}catch{return yv}}}():yv,Iu=pD()(),Ui=Object.getPrototypeOf||function(r){return r.__proto__},_u={},J9=typeof Uint8Array>"u"?Me:Ui(Uint8Array),lo={"%AggregateError%":typeof AggregateError>"u"?Me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Me:ArrayBuffer,"%ArrayIteratorPrototype%":Iu?Ui([][Symbol.iterator]()):Me,"%AsyncFromSyncIteratorPrototype%":Me,"%AsyncFunction%":_u,"%AsyncGenerator%":_u,"%AsyncGeneratorFunction%":_u,"%AsyncIteratorPrototype%":_u,"%Atomics%":typeof Atomics>"u"?Me:Atomics,"%BigInt%":typeof BigInt>"u"?Me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Me:FinalizationRegistry,"%Function%":_D,"%GeneratorFunction%":_u,"%Int8Array%":typeof Int8Array>"u"?Me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Iu?Ui(Ui([][Symbol.iterator]())):Me,"%JSON%":typeof JSON=="object"?JSON:Me,"%Map%":typeof Map>"u"?Me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Iu?Me:Ui(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Me:Promise,"%Proxy%":typeof Proxy>"u"?Me:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Iu?Me:Ui(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Iu?Ui(""[Symbol.iterator]()):Me,"%Symbol%":Iu?Symbol:Me,"%SyntaxError%":Cu,"%ThrowTypeError%":Y9,"%TypedArray%":J9,"%TypeError%":bu,"%Uint8Array%":typeof Uint8Array>"u"?Me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Me:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Me:WeakSet};try{null.error}catch(r){ED=Ui(Ui(r)),lo["%Error.prototype%"]=ED}var ED,X9=function r(e){var t;if(e==="%AsyncFunction%")t=gv("async function () {}");else if(e==="%GeneratorFunction%")t=gv("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=gv("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&(t=Ui(n.prototype))}return lo[e]=t,t},AD={"%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"]},pl=fp(),hp=vD(),Z9=pl.call(Function.call,Array.prototype.concat),ej=pl.call(Function.apply,Array.prototype.splice),ID=pl.call(Function.call,String.prototype.replace),dp=pl.call(Function.call,String.prototype.slice),tj=pl.call(Function.call,RegExp.prototype.exec),rj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ij=/\\(\\)?/g,nj=function(e){var t=dp(e,0,1),i=dp(e,-1);if(t==="%"&&i!=="%")throw new Cu("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Cu("invalid intrinsic syntax, expected opening `%`");var n=[];return ID(e,rj,function(s,o,a,u){n[n.length]=a?ID(u,ij,"$1"):o||s}),n},sj=function(e,t){var i=e,n;if(hp(AD,i)&&(n=AD[i],i="%"+n[0]+"%"),hp(lo,i)){var s=lo[i];if(s===_u&&(s=X9(i)),typeof s>"u"&&!t)throw new bu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Cu("intrinsic "+e+" does not exist!")};bD.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new bu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new bu('"allowMissing" argument must be a boolean');if(tj(/^%?[^%]*%?$/,e)===null)throw new Cu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=nj(e),n=i.length>0?i[0]:"",s=sj("%"+n+"%",t),o=s.name,a=s.value,u=!1,h=s.alias;h&&(n=h[0],ej(i,Z9([0,1],h)));for(var p=1,w=!0;p=i.length){var V=co(a,N);w=!!V,w&&"get"in V&&!("originalValue"in V.get)?a=V.get:a=a[N]}else w=hp(a,N),a=a[N];w&&!u&&(lo[o]=a)}}return a}});var DD=B((Dre,gp)=>{"use strict";f();var mv=fp(),Su=pp(),xD=Su("%Function.prototype.apply%"),TD=Su("%Function.prototype.call%"),ND=Su("%Reflect.apply%",!0)||mv.call(TD,xD),CD=Su("%Object.getOwnPropertyDescriptor%",!0),fo=Su("%Object.defineProperty%",!0),oj=Su("%Math.max%");if(fo)try{fo({},"a",{value:1})}catch{fo=null}gp.exports=function(e){var t=ND(mv,TD,arguments);if(CD&&fo){var i=CD(t,"length");i.configurable&&fo(t,"length",{value:1+oj(0,e.length-(arguments.length-1))})}return t};var SD=function(){return ND(mv,xD,arguments)};fo?fo(gp.exports,"apply",{value:SD}):gp.exports.apply=SD});var MD=B((Pre,BD)=>{"use strict";f();var OD=pp(),PD=DD(),aj=PD(OD("String.prototype.indexOf"));BD.exports=function(e,t){var i=OD(e,!!t);return typeof i=="function"&&aj(e,".prototype.")>-1?PD(i):i}});var RD=B(()=>{f()});var tO=B((Fre,eO)=>{f();var xv=typeof Map=="function"&&Map.prototype,wv=Object.getOwnPropertyDescriptor&&xv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mp=xv&&wv&&typeof wv.get=="function"?wv.get:null,LD=xv&&Map.prototype.forEach,Tv=typeof Set=="function"&&Set.prototype,vv=Object.getOwnPropertyDescriptor&&Tv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wp=Tv&&vv&&typeof vv.get=="function"?vv.get:null,FD=Tv&&Set.prototype.forEach,uj=typeof WeakMap=="function"&&WeakMap.prototype,yl=uj?WeakMap.prototype.has:null,cj=typeof WeakSet=="function"&&WeakSet.prototype,ml=cj?WeakSet.prototype.has:null,lj=typeof WeakRef=="function"&&WeakRef.prototype,UD=lj?WeakRef.prototype.deref:null,fj=Boolean.prototype.valueOf,hj=Object.prototype.toString,dj=Function.prototype.toString,pj=String.prototype.match,Nv=String.prototype.slice,Xn=String.prototype.replace,gj=String.prototype.toUpperCase,qD=String.prototype.toLowerCase,WD=RegExp.prototype.test,VD=Array.prototype.concat,qi=Array.prototype.join,yj=Array.prototype.slice,HD=Math.floor,Iv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ev=Object.getOwnPropertySymbols,_v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xu||"symbol")?Symbol.toStringTag:null,$D=Object.prototype.propertyIsEnumerable,QD=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function jD(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||WD.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-HD(-r):HD(r);if(i!==r){var n=String(i),s=Nv.call(e,n.length+1);return Xn.call(n,t,"$&_")+"."+Xn.call(Xn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xn.call(e,t,"$&_")}var bv=RD(),GD=bv.custom,KD=JD(GD)?GD:null;eO.exports=function r(e,t,i,n){var s=t||{};if(Jn(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Jn(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=Jn(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(Jn(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(Jn(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 ZD(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?jD(e,u):u}if(typeof e=="bigint"){var h=String(e)+"n";return a?jD(e,h):h}var p=typeof s.depth>"u"?5:s.depth;if(typeof i>"u"&&(i=0),i>=p&&p>0&&typeof e=="object")return Cv(e)?"[Array]":"[Object]";var w=Mj(s,i);if(typeof n>"u")n=[];else if(XD(n,e)>=0)return"[Circular]";function N(A,c,d){if(c&&(n=yj.call(n),n.push(c)),d){var g={depth:s.depth};return Jn(s,"quoteStyle")&&(g.quoteStyle=s.quoteStyle),r(A,g,i+1,n)}return r(A,s,i+1,n)}if(typeof e=="function"&&!zD(e)){var O=Cj(e),T=yp(e,N);return"[Function"+(O?": "+O:" (anonymous)")+"]"+(T.length>0?" { "+qi.call(T,", ")+" }":"")}if(JD(e)){var V=xu?Xn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_v.call(e);return typeof e=="object"&&!xu?gl(V):V}if(Oj(e)){for(var z="<"+qD.call(String(e.nodeName)),$=e.attributes||[],se=0;se<$.length;se++)z+=" "+$[se].name+"="+YD(mj($[se].value),"double",s);return z+=">",e.childNodes&&e.childNodes.length&&(z+="..."),z+="",z}if(Cv(e)){if(e.length===0)return"[]";var Y=yp(e,N);return w&&!Bj(Y)?"["+Sv(Y,w)+"]":"[ "+qi.call(Y,", ")+" ]"}if(vj(e)){var j=yp(e,N);return!("cause"in Error.prototype)&&"cause"in e&&!$D.call(e,"cause")?"{ ["+String(e)+"] "+qi.call(VD.call("[cause]: "+N(e.cause),j),", ")+" }":j.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+qi.call(j,", ")+" }"}if(typeof e=="object"&&o){if(KD&&typeof e[KD]=="function"&&bv)return bv(e,{depth:p-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Sj(e)){var W=[];return LD&&LD.call(e,function(A,c){W.push(N(c,e,!0)+" => "+N(A,e))}),kD("Map",mp.call(e),W,w)}if(Nj(e)){var k=[];return FD&&FD.call(e,function(A){k.push(N(A,e))}),kD("Set",wp.call(e),k,w)}if(xj(e))return Av("WeakMap");if(Dj(e))return Av("WeakSet");if(Tj(e))return Av("WeakRef");if(Aj(e))return gl(N(Number(e)));if(_j(e))return gl(N(Iv.call(e)));if(Ij(e))return gl(fj.call(e));if(Ej(e))return gl(N(String(e)));if(!wj(e)&&!zD(e)){var R=yp(e,N),F=QD?QD(e)===Object.prototype:e instanceof Object||e.constructor===Object,G=e instanceof Object?"":"null prototype",ce=!F&&hr&&Object(e)===e&&hr in e?Nv.call(Zn(e),8,-1):G?"Object":"",J=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=J+(ce||G?"["+qi.call(VD.call([],ce||[],G||[]),": ")+"] ":"");return R.length===0?X+"{}":w?X+"{"+Sv(R,w)+"}":X+"{ "+qi.call(R,", ")+" }"}return String(e)};function YD(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function mj(r){return Xn.call(String(r),/"/g,""")}function Cv(r){return Zn(r)==="[object Array]"&&(!hr||!(typeof r=="object"&&hr in r))}function wj(r){return Zn(r)==="[object Date]"&&(!hr||!(typeof r=="object"&&hr in r))}function zD(r){return Zn(r)==="[object RegExp]"&&(!hr||!(typeof r=="object"&&hr in r))}function vj(r){return Zn(r)==="[object Error]"&&(!hr||!(typeof r=="object"&&hr in r))}function Ej(r){return Zn(r)==="[object String]"&&(!hr||!(typeof r=="object"&&hr in r))}function Aj(r){return Zn(r)==="[object Number]"&&(!hr||!(typeof r=="object"&&hr in r))}function Ij(r){return Zn(r)==="[object Boolean]"&&(!hr||!(typeof r=="object"&&hr in r))}function JD(r){if(xu)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!_v)return!1;try{return _v.call(r),!0}catch{}return!1}function _j(r){if(!r||typeof r!="object"||!Iv)return!1;try{return Iv.call(r),!0}catch{}return!1}var bj=Object.prototype.hasOwnProperty||function(r){return r in this};function Jn(r,e){return bj.call(r,e)}function Zn(r){return hj.call(r)}function Cj(r){if(r.name)return r.name;var e=pj.call(dj.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function XD(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return ZD(Nv.call(r,0,e.maxStringLength),e)+i}var n=Xn.call(Xn.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Pj);return YD(n,"single",e)}function Pj(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+gj.call(e.toString(16))}function gl(r){return"Object("+r+")"}function Av(r){return r+" { ? }"}function kD(r,e,t,i){var n=i?Sv(t,i):qi.call(t,", ");return r+" ("+e+") {"+n+"}"}function Bj(r){for(var e=0;e=0)return!1;return!0}function Mj(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=qi.call(Array(r.indent+1)," ");else return null;return{base:t,prev:qi.call(Array(e+1),t)}}function Sv(r,e){if(r.length===0)return"";var t=` +`+e.prev+e.base;return t+qi.call(r,","+t)+` +`+e.prev}function yp(r,e){var t=Cv(r),i=[];if(t){i.length=r.length;for(var n=0;n{"use strict";f();var Dv=pp(),Tu=MD(),Rj=tO(),Lj=Dv("%TypeError%"),vp=Dv("%WeakMap%",!0),Ep=Dv("%Map%",!0),Fj=Tu("WeakMap.prototype.get",!0),Uj=Tu("WeakMap.prototype.set",!0),qj=Tu("WeakMap.prototype.has",!0),Vj=Tu("Map.prototype.get",!0),Hj=Tu("Map.prototype.set",!0),Qj=Tu("Map.prototype.has",!0),Ov=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},jj=function(r,e){var t=Ov(r,e);return t&&t.value},Gj=function(r,e,t){var i=Ov(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},Kj=function(r,e){return!!Ov(r,e)};rO.exports=function(){var e,t,i,n={assert:function(s){if(!n.has(s))throw new Lj("Side channel does not contain "+Rj(s))},get:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Fj(e,s)}else if(Ep){if(t)return Vj(t,s)}else if(i)return jj(i,s)},has:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return qj(e,s)}else if(Ep){if(t)return Qj(t,s)}else if(i)return Kj(i,s);return!1},set:function(s,o){vp&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new vp),Uj(e,s,o)):Ep?(t||(t=new Ep),Hj(t,s,o)):(i||(i={key:{},next:null}),Gj(i,s,o))}};return n}});var Ap=B((Hre,nO)=>{"use strict";f();var zj=String.prototype.replace,kj=/%20/g,Pv={RFC1738:"RFC1738",RFC3986:"RFC3986"};nO.exports={default:Pv.RFC3986,formatters:{RFC1738:function(r){return zj.call(r,kj,"+")},RFC3986:function(r){return String(r)}},RFC1738:Pv.RFC1738,RFC3986:Pv.RFC3986}});var Mv=B((jre,oO)=>{"use strict";f();var Wj=Ap(),Bv=Object.prototype.hasOwnProperty,ho=Array.isArray,Vi=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),$j=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(ho(i)){for(var n=[],s=0;s=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===Wj.RFC1738&&(h===40||h===41)){a+=o.charAt(u);continue}if(h<128){a=a+Vi[h];continue}if(h<2048){a=a+(Vi[192|h>>6]+Vi[128|h&63]);continue}if(h<55296||h>=57344){a=a+(Vi[224|h>>12]+Vi[128|h>>6&63]+Vi[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|o.charCodeAt(u)&1023),a+=Vi[240|h>>18]+Vi[128|h>>12&63]+Vi[128|h>>6&63]+Vi[128|h&63]}return a},eG=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],n=0;n{"use strict";f();var cO=iO(),Lv=Mv(),wl=Ap(),sG=Object.prototype.hasOwnProperty,aO={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},po=Array.isArray,oG=String.prototype.split,aG=Array.prototype.push,lO=function(r,e){aG.apply(r,po(e)?e:[e])},uG=Date.prototype.toISOString,uO=wl.default,rr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Lv.encode,encodeValuesOnly:!1,format:uO,formatter:wl.formatters[uO],indices:!1,serializeDate:function(e){return uG.call(e)},skipNulls:!1,strictNullHandling:!1},cG=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Rv={},lG=function r(e,t,i,n,s,o,a,u,h,p,w,N,O,T,V){for(var z=e,$=V,se=0,Y=!1;($=$.get(Rv))!==void 0&&!Y;){var j=$.get(e);if(se+=1,typeof j<"u"){if(j===se)throw new RangeError("Cyclic object value");Y=!0}typeof $.get(Rv)>"u"&&(se=0)}if(typeof a=="function"?z=a(t,z):z instanceof Date?z=p(z):i==="comma"&&po(z)&&(z=Lv.maybeMap(z,function(m){return m instanceof Date?p(m):m})),z===null){if(n)return o&&!O?o(t,rr.encoder,T,"key",w):t;z=""}if(cG(z)||Lv.isBuffer(z)){if(o){var W=O?t:o(t,rr.encoder,T,"key",w);if(i==="comma"&&O){for(var k=oG.call(String(z),","),R="",F=0;F"u")return G;var ce;if(i==="comma"&&po(z))ce=[{value:z.length>0?z.join(",")||null:void 0}];else if(po(a))ce=a;else{var J=Object.keys(z);ce=u?J.sort(u):J}for(var X=0;X"u"?rr.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:rr.charsetSentinel,delimiter:typeof e.delimiter>"u"?rr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:rr.encode,encoder:typeof e.encoder=="function"?e.encoder:rr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:rr.encodeValuesOnly,filter:s,format:i,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:rr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:rr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:rr.strictNullHandling}};fO.exports=function(r,e){var t=r,i=fG(e),n,s;typeof i.filter=="function"?(s=i.filter,t=s("",t)):po(i.filter)&&(s=i.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in aO?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=aO[a];n||(n=Object.keys(t)),i.sort&&n.sort(i.sort);for(var h=cO(),p=0;p0?O+N:""}});var gO=B((kre,pO)=>{"use strict";f();var Nu=Mv(),Fv=Object.prototype.hasOwnProperty,hG=Array.isArray,Jt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Nu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},dG=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},dO=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},pG="utf8=%26%2310003%3B",gG="utf8=%E2%9C%93",yG=function(e,t){var i={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),a=-1,u,h=t.charset;if(t.charsetSentinel)for(u=0;u-1&&(T=hG(T)?[T]:T),Fv.call(i,O)?i[O]=Nu.combine(i[O],T):i[O]=T}return i},mG=function(r,e,t,i){for(var n=i?e:dO(e,t),s=r.length-1;s>=0;--s){var o,a=r[s];if(a==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(u,10);!t.parseArrays&&u===""?o={0:n}:!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=n):u!=="__proto__"&&(o[u]=n)}n=o}return n},wG=function(e,t,i,n){if(e){var s=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=i.depth>0&&o.exec(s),h=u?s.slice(0,u.index):s,p=[];if(h){if(!i.plainObjects&&Fv.call(Object.prototype,h)&&!i.allowPrototypes)return;p.push(h)}for(var w=0;i.depth>0&&(u=a.exec(s))!==null&&w"u"?Jt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Jt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Jt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Jt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Jt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Jt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Jt.comma,decoder:typeof e.decoder=="function"?e.decoder:Jt.decoder,delimiter:typeof e.delimiter=="string"||Nu.isRegExp(e.delimiter)?e.delimiter:Jt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Jt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Jt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Jt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Jt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Jt.strictNullHandling}};pO.exports=function(r,e){var t=vG(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?yG(r,t):r,n=t.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o{"use strict";f();var EG=hO(),AG=gO(),IG=Ap();yO.exports={formats:IG,parse:AG,stringify:EG}});var Uv=B(ht=>{"use strict";f();Object.defineProperty(ht,"__esModule",{value:!0});ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ht.WALLET_PROVIDER_CALLBACK_PARAM=ht.WALLET_PROVIDER_SIGN_MESSAGE_URL=ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ht.WALLET_PROVIDER_SEND_TRANSACTION_URL=ht.WALLET_PROVIDER_DISCONNECT_URL=ht.WALLET_PROVIDER_CONNECT_URL=ht.WALLET_PROVIDER_TESTNET=ht.WALLET_PROVIDER_DEVNET=ht.WALLET_PROVIDER_MAINNET=void 0;ht.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_CONNECT_URL="hook/login";ht.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ht.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ht.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ht.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var wO=B(Du=>{"use strict";f();Object.defineProperty(Du,"__esModule",{value:!0});Du.ErrInvalidTxSignReturnValue=Du.Err=void 0;var Ip=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Du.Err=Ip;var qv=class extends Ip{constructor(){super("Invalid response in transaction sign return url")}};Du.ErrInvalidTxSignReturnValue=qv});var vO=B(_p=>{"use strict";f();Object.defineProperty(_p,"__esModule",{value:!0});_p.PlainSignedTransaction=void 0;var Vv=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.options=void 0,this.signature="",Object.assign(this,e)}};_p.PlainSignedTransaction=Vv});var vl=B(es=>{"use strict";f();var go=es&&es.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},_G=es&&es.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var EO=_G(mO()),yo=Uv(),AO=wO(),bG=vO(),Ou=class{constructor(e){this.walletUrl=e}login(e){return go(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(t,e?.redirectDelayMilliseconds),t})}redirect(e,t){return go(this,void 0,void 0,function*(){t?yield this.redirectLater(e,t):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,t){return go(this,void 0,void 0,function*(){yield new Promise(i=>{setTimeout(()=>{window.location.href=e,i(!0)},t)})})}logout(e){return go(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(t,e?.redirectDelayMilliseconds),!0})}signMessage(e,t){return go(this,void 0,void 0,function*(){let i=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:t?.callbackUrl,params:{message:e}});return yield this.redirect(i),i})}signTransactions(e,t){return go(this,void 0,void 0,function*(){let i={};e.map(s=>{let o=Ou.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(o[a])});let n=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:t?.callbackUrl,params:i});window.location.href=n})}signTransaction(e,t){return go(this,void 0,void 0,function*(){yield this.signTransactions([e],t)})}getTransactionsFromWalletUrl(){let e=EO.default.parse(window.location.search.slice(1));return Ou.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(yo.WALLET_PROVIDER_CALLBACK_PARAM)&&e[yo.WALLET_PROVIDER_CALLBACK_PARAM]===yo.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var t;console.info(`Received urlParams: ${e}`);let i=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of i)if(!e[o]||!Array.isArray(e[o]))throw new AO.ErrInvalidTxSignReturnValue;let n=e.nonce.length;for(let o of i)if(e[o].length!==n)throw new AO.ErrInvalidTxSignReturnValue;let s=[];for(let o=0;o{f()});var TO=B((xO,Hv)=>{f();(function(r,e){"use strict";function t(A,c){if(!A)throw new Error(c||"Assertion failed")}function i(A,c){A.super_=c;var d=function(){};d.prototype=c.prototype,A.prototype=new d,A.prototype.constructor=A}function n(A,c,d){if(n.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,A!==null&&((c==="le"||c==="be")&&(d=c,c=10),this._init(A||0,c||10,d||"be"))}typeof r=="object"?r.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=SO().Buffer}catch{}n.isBN=function(c){return c instanceof n?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===n.wordSize&&Array.isArray(c.words)},n.max=function(c,d){return c.cmp(d)>0?c:d},n.min=function(c,d){return c.cmp(d)<0?c:d},n.prototype._init=function(c,d,g){if(typeof c=="number")return this._initNumber(c,d,g);if(typeof c=="object")return this._initArray(c,d,g);d==="hex"&&(d=16),t(d===(d|0)&&d>=2&&d<=36),c=c.toString().replace(/\s+/g,"");var m=0;c[0]==="-"&&(m++,this.negative=1),m=0;m-=3)S=c[m]|c[m-1]<<8|c[m-2]<<16,this.words[v]|=S<>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);else if(g==="le")for(m=0,v=0;m>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);return this._strip()};function o(A,c){var d=A.charCodeAt(c);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;t(!1,"Invalid character in "+A)}function a(A,c,d){var g=o(A,d);return d-1>=c&&(g|=o(A,d-1)<<4),g}n.prototype._parseHex=function(c,d,g){this.length=Math.ceil((c.length-d)/6),this.words=new Array(this.length);for(var m=0;m=d;m-=2)D=a(c,d,m)<=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8;else{var I=c.length-d;for(m=I%2===0?d+1:d;m=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8}this._strip()};function u(A,c,d,g){for(var m=0,v=0,S=Math.min(A.length,d),D=c;D=49?v=I-49+10:I>=17?v=I-17+10:v=I,t(I>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{n.prototype.inspect=p}else n.prototype.inspect=p;function p(){return(this.red?""}var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],N=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(c,d){c=c||10,d=d|0||1;var g;if(c===16||c==="hex"){g="";for(var m=0,v=0,S=0;S>>24-m&16777215,m+=2,m>=26&&(m-=26,S--),v!==0||S!==this.length-1?g=w[6-I.length]+I+g:g=I+g}for(v!==0&&(g=v.toString(16)+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var l=N[c],C=O[c];g="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ie=Z.modrn(C).toString(c);Z=Z.idivn(C),Z.isZero()?g=ie+g:g=w[l-ie.length]+ie+g}for(this.isZero()&&(g="0"+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}t(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(c,d){return this.toArrayLike(s,c,d)}),n.prototype.toArray=function(c,d){return this.toArrayLike(Array,c,d)};var T=function(c,d){return c.allocUnsafe?c.allocUnsafe(d):new c(d)};n.prototype.toArrayLike=function(c,d,g){this._strip();var m=this.byteLength(),v=g||Math.max(1,m);t(m<=v,"byte array longer than desired length"),t(v>0,"Requested array length <= 0");var S=T(c,v),D=d==="le"?"LE":"BE";return this["_toArrayLike"+D](S,m),S},n.prototype._toArrayLikeLE=function(c,d){for(var g=0,m=0,v=0,S=0;v>8&255),g>16&255),S===6?(g>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g=0&&(c[g--]=D>>8&255),g>=0&&(c[g--]=D>>16&255),S===6?(g>=0&&(c[g--]=D>>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g>=0)for(c[g--]=m;g>=0;)c[g--]=0},Math.clz32?n.prototype._countBits=function(c){return 32-Math.clz32(c)}:n.prototype._countBits=function(c){var d=c,g=0;return d>=4096&&(g+=13,d>>>=13),d>=64&&(g+=7,d>>>=7),d>=8&&(g+=4,d>>>=4),d>=2&&(g+=2,d>>>=2),g+d},n.prototype._zeroBits=function(c){if(c===0)return 26;var d=c,g=0;return d&8191||(g+=13,d>>>=13),d&127||(g+=7,d>>>=7),d&15||(g+=4,d>>>=4),d&3||(g+=2,d>>>=2),d&1||g++,g},n.prototype.bitLength=function(){var c=this.words[this.length-1],d=this._countBits(c);return(this.length-1)*26+d};function V(A){for(var c=new Array(A.bitLength()),d=0;d>>m&1}return c}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,d=0;dc.length?this.clone().ior(c):c.clone().ior(this)},n.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},n.prototype.iuand=function(c){var d;this.length>c.length?d=c:d=this;for(var g=0;gc.length?this.clone().iand(c):c.clone().iand(this)},n.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},n.prototype.iuxor=function(c){var d,g;this.length>c.length?(d=this,g=c):(d=c,g=this);for(var m=0;mc.length?this.clone().ixor(c):c.clone().ixor(this)},n.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},n.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var d=Math.ceil(c/26)|0,g=c%26;this._expand(d),g>0&&d--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-g),this._strip()},n.prototype.notn=function(c){return this.clone().inotn(c)},n.prototype.setn=function(c,d){t(typeof c=="number"&&c>=0);var g=c/26|0,m=c%26;return this._expand(g+1),d?this.words[g]=this.words[g]|1<c.length?(g=this,m=c):(g=c,m=this);for(var v=0,S=0;S>>26;for(;v!==0&&S>>26;if(this.length=g.length,v!==0)this.words[this.length]=v,this.length++;else if(g!==this)for(;Sc.length?this.clone().iadd(c):c.clone().iadd(this)},n.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var d=this.iadd(c);return c.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,v;g>0?(m=this,v=c):(m=c,v=this);for(var S=0,D=0;D>26,this.words[D]=d&67108863;for(;S!==0&&D>26,this.words[D]=d&67108863;if(S===0&&D>>26,Z=I&67108863,ie=Math.min(l,c.length-1),ee=Math.max(0,l-A.length+1);ee<=ie;ee++){var ae=l-ee|0;m=A.words[ae]|0,v=c.words[ee]|0,S=m*v+Z,C+=S/67108864|0,Z=S&67108863}d.words[l]=Z|0,I=C|0}return I!==0?d.words[l]=I|0:d.length--,d._strip()}var $=function(c,d,g){var m=c.words,v=d.words,S=g.words,D=0,I,l,C,Z=m[0]|0,ie=Z&8191,ee=Z>>>13,ae=m[1]|0,E=ae&8191,b=ae>>>13,x=m[2]|0,L=x&8191,P=x>>>13,U=m[3]|0,q=U&8191,M=U>>>13,Q=m[4]|0,K=Q&8191,H=Q>>>13,ue=m[5]|0,he=ue&8191,de=ue>>>13,Re=m[6]|0,be=Re&8191,xe=Re>>>13,Be=m[7]|0,Ie=Be&8191,Pe=Be>>>13,us=m[8]|0,Ze=us&8191,et=us>>>13,Ar=m[9]|0,ze=Ar&8191,Ue=Ar>>>13,jt=v[0]|0,Ce=jt&8191,mt=jt>>>13,vE=v[1]|0,wt=vE&8191,vt=vE>>>13,EE=v[2]|0,Et=EE&8191,At=EE>>>13,AE=v[3]|0,It=AE&8191,_t=AE>>>13,IE=v[4]|0,bt=IE&8191,Ct=IE>>>13,_E=v[5]|0,St=_E&8191,xt=_E>>>13,bE=v[6]|0,Tt=bE&8191,Nt=bE>>>13,CE=v[7]|0,Dt=CE&8191,Ot=CE>>>13,SE=v[8]|0,Pt=SE&8191,Bt=SE>>>13,xE=v[9]|0,Mt=xE&8191,Rt=xE>>>13;g.negative=c.negative^d.negative,g.length=19,I=Math.imul(ie,Ce),l=Math.imul(ie,mt),l=l+Math.imul(ee,Ce)|0,C=Math.imul(ee,mt);var Yp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Yp>>>26)|0,Yp&=67108863,I=Math.imul(E,Ce),l=Math.imul(E,mt),l=l+Math.imul(b,Ce)|0,C=Math.imul(b,mt),I=I+Math.imul(ie,wt)|0,l=l+Math.imul(ie,vt)|0,l=l+Math.imul(ee,wt)|0,C=C+Math.imul(ee,vt)|0;var Jp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Jp>>>26)|0,Jp&=67108863,I=Math.imul(L,Ce),l=Math.imul(L,mt),l=l+Math.imul(P,Ce)|0,C=Math.imul(P,mt),I=I+Math.imul(E,wt)|0,l=l+Math.imul(E,vt)|0,l=l+Math.imul(b,wt)|0,C=C+Math.imul(b,vt)|0,I=I+Math.imul(ie,Et)|0,l=l+Math.imul(ie,At)|0,l=l+Math.imul(ee,Et)|0,C=C+Math.imul(ee,At)|0;var Xp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Xp>>>26)|0,Xp&=67108863,I=Math.imul(q,Ce),l=Math.imul(q,mt),l=l+Math.imul(M,Ce)|0,C=Math.imul(M,mt),I=I+Math.imul(L,wt)|0,l=l+Math.imul(L,vt)|0,l=l+Math.imul(P,wt)|0,C=C+Math.imul(P,vt)|0,I=I+Math.imul(E,Et)|0,l=l+Math.imul(E,At)|0,l=l+Math.imul(b,Et)|0,C=C+Math.imul(b,At)|0,I=I+Math.imul(ie,It)|0,l=l+Math.imul(ie,_t)|0,l=l+Math.imul(ee,It)|0,C=C+Math.imul(ee,_t)|0;var Zp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Zp>>>26)|0,Zp&=67108863,I=Math.imul(K,Ce),l=Math.imul(K,mt),l=l+Math.imul(H,Ce)|0,C=Math.imul(H,mt),I=I+Math.imul(q,wt)|0,l=l+Math.imul(q,vt)|0,l=l+Math.imul(M,wt)|0,C=C+Math.imul(M,vt)|0,I=I+Math.imul(L,Et)|0,l=l+Math.imul(L,At)|0,l=l+Math.imul(P,Et)|0,C=C+Math.imul(P,At)|0,I=I+Math.imul(E,It)|0,l=l+Math.imul(E,_t)|0,l=l+Math.imul(b,It)|0,C=C+Math.imul(b,_t)|0,I=I+Math.imul(ie,bt)|0,l=l+Math.imul(ie,Ct)|0,l=l+Math.imul(ee,bt)|0,C=C+Math.imul(ee,Ct)|0;var e0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(e0>>>26)|0,e0&=67108863,I=Math.imul(he,Ce),l=Math.imul(he,mt),l=l+Math.imul(de,Ce)|0,C=Math.imul(de,mt),I=I+Math.imul(K,wt)|0,l=l+Math.imul(K,vt)|0,l=l+Math.imul(H,wt)|0,C=C+Math.imul(H,vt)|0,I=I+Math.imul(q,Et)|0,l=l+Math.imul(q,At)|0,l=l+Math.imul(M,Et)|0,C=C+Math.imul(M,At)|0,I=I+Math.imul(L,It)|0,l=l+Math.imul(L,_t)|0,l=l+Math.imul(P,It)|0,C=C+Math.imul(P,_t)|0,I=I+Math.imul(E,bt)|0,l=l+Math.imul(E,Ct)|0,l=l+Math.imul(b,bt)|0,C=C+Math.imul(b,Ct)|0,I=I+Math.imul(ie,St)|0,l=l+Math.imul(ie,xt)|0,l=l+Math.imul(ee,St)|0,C=C+Math.imul(ee,xt)|0;var t0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(t0>>>26)|0,t0&=67108863,I=Math.imul(be,Ce),l=Math.imul(be,mt),l=l+Math.imul(xe,Ce)|0,C=Math.imul(xe,mt),I=I+Math.imul(he,wt)|0,l=l+Math.imul(he,vt)|0,l=l+Math.imul(de,wt)|0,C=C+Math.imul(de,vt)|0,I=I+Math.imul(K,Et)|0,l=l+Math.imul(K,At)|0,l=l+Math.imul(H,Et)|0,C=C+Math.imul(H,At)|0,I=I+Math.imul(q,It)|0,l=l+Math.imul(q,_t)|0,l=l+Math.imul(M,It)|0,C=C+Math.imul(M,_t)|0,I=I+Math.imul(L,bt)|0,l=l+Math.imul(L,Ct)|0,l=l+Math.imul(P,bt)|0,C=C+Math.imul(P,Ct)|0,I=I+Math.imul(E,St)|0,l=l+Math.imul(E,xt)|0,l=l+Math.imul(b,St)|0,C=C+Math.imul(b,xt)|0,I=I+Math.imul(ie,Tt)|0,l=l+Math.imul(ie,Nt)|0,l=l+Math.imul(ee,Tt)|0,C=C+Math.imul(ee,Nt)|0;var r0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(r0>>>26)|0,r0&=67108863,I=Math.imul(Ie,Ce),l=Math.imul(Ie,mt),l=l+Math.imul(Pe,Ce)|0,C=Math.imul(Pe,mt),I=I+Math.imul(be,wt)|0,l=l+Math.imul(be,vt)|0,l=l+Math.imul(xe,wt)|0,C=C+Math.imul(xe,vt)|0,I=I+Math.imul(he,Et)|0,l=l+Math.imul(he,At)|0,l=l+Math.imul(de,Et)|0,C=C+Math.imul(de,At)|0,I=I+Math.imul(K,It)|0,l=l+Math.imul(K,_t)|0,l=l+Math.imul(H,It)|0,C=C+Math.imul(H,_t)|0,I=I+Math.imul(q,bt)|0,l=l+Math.imul(q,Ct)|0,l=l+Math.imul(M,bt)|0,C=C+Math.imul(M,Ct)|0,I=I+Math.imul(L,St)|0,l=l+Math.imul(L,xt)|0,l=l+Math.imul(P,St)|0,C=C+Math.imul(P,xt)|0,I=I+Math.imul(E,Tt)|0,l=l+Math.imul(E,Nt)|0,l=l+Math.imul(b,Tt)|0,C=C+Math.imul(b,Nt)|0,I=I+Math.imul(ie,Dt)|0,l=l+Math.imul(ie,Ot)|0,l=l+Math.imul(ee,Dt)|0,C=C+Math.imul(ee,Ot)|0;var i0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(i0>>>26)|0,i0&=67108863,I=Math.imul(Ze,Ce),l=Math.imul(Ze,mt),l=l+Math.imul(et,Ce)|0,C=Math.imul(et,mt),I=I+Math.imul(Ie,wt)|0,l=l+Math.imul(Ie,vt)|0,l=l+Math.imul(Pe,wt)|0,C=C+Math.imul(Pe,vt)|0,I=I+Math.imul(be,Et)|0,l=l+Math.imul(be,At)|0,l=l+Math.imul(xe,Et)|0,C=C+Math.imul(xe,At)|0,I=I+Math.imul(he,It)|0,l=l+Math.imul(he,_t)|0,l=l+Math.imul(de,It)|0,C=C+Math.imul(de,_t)|0,I=I+Math.imul(K,bt)|0,l=l+Math.imul(K,Ct)|0,l=l+Math.imul(H,bt)|0,C=C+Math.imul(H,Ct)|0,I=I+Math.imul(q,St)|0,l=l+Math.imul(q,xt)|0,l=l+Math.imul(M,St)|0,C=C+Math.imul(M,xt)|0,I=I+Math.imul(L,Tt)|0,l=l+Math.imul(L,Nt)|0,l=l+Math.imul(P,Tt)|0,C=C+Math.imul(P,Nt)|0,I=I+Math.imul(E,Dt)|0,l=l+Math.imul(E,Ot)|0,l=l+Math.imul(b,Dt)|0,C=C+Math.imul(b,Ot)|0,I=I+Math.imul(ie,Pt)|0,l=l+Math.imul(ie,Bt)|0,l=l+Math.imul(ee,Pt)|0,C=C+Math.imul(ee,Bt)|0;var n0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(n0>>>26)|0,n0&=67108863,I=Math.imul(ze,Ce),l=Math.imul(ze,mt),l=l+Math.imul(Ue,Ce)|0,C=Math.imul(Ue,mt),I=I+Math.imul(Ze,wt)|0,l=l+Math.imul(Ze,vt)|0,l=l+Math.imul(et,wt)|0,C=C+Math.imul(et,vt)|0,I=I+Math.imul(Ie,Et)|0,l=l+Math.imul(Ie,At)|0,l=l+Math.imul(Pe,Et)|0,C=C+Math.imul(Pe,At)|0,I=I+Math.imul(be,It)|0,l=l+Math.imul(be,_t)|0,l=l+Math.imul(xe,It)|0,C=C+Math.imul(xe,_t)|0,I=I+Math.imul(he,bt)|0,l=l+Math.imul(he,Ct)|0,l=l+Math.imul(de,bt)|0,C=C+Math.imul(de,Ct)|0,I=I+Math.imul(K,St)|0,l=l+Math.imul(K,xt)|0,l=l+Math.imul(H,St)|0,C=C+Math.imul(H,xt)|0,I=I+Math.imul(q,Tt)|0,l=l+Math.imul(q,Nt)|0,l=l+Math.imul(M,Tt)|0,C=C+Math.imul(M,Nt)|0,I=I+Math.imul(L,Dt)|0,l=l+Math.imul(L,Ot)|0,l=l+Math.imul(P,Dt)|0,C=C+Math.imul(P,Ot)|0,I=I+Math.imul(E,Pt)|0,l=l+Math.imul(E,Bt)|0,l=l+Math.imul(b,Pt)|0,C=C+Math.imul(b,Bt)|0,I=I+Math.imul(ie,Mt)|0,l=l+Math.imul(ie,Rt)|0,l=l+Math.imul(ee,Mt)|0,C=C+Math.imul(ee,Rt)|0;var s0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(s0>>>26)|0,s0&=67108863,I=Math.imul(ze,wt),l=Math.imul(ze,vt),l=l+Math.imul(Ue,wt)|0,C=Math.imul(Ue,vt),I=I+Math.imul(Ze,Et)|0,l=l+Math.imul(Ze,At)|0,l=l+Math.imul(et,Et)|0,C=C+Math.imul(et,At)|0,I=I+Math.imul(Ie,It)|0,l=l+Math.imul(Ie,_t)|0,l=l+Math.imul(Pe,It)|0,C=C+Math.imul(Pe,_t)|0,I=I+Math.imul(be,bt)|0,l=l+Math.imul(be,Ct)|0,l=l+Math.imul(xe,bt)|0,C=C+Math.imul(xe,Ct)|0,I=I+Math.imul(he,St)|0,l=l+Math.imul(he,xt)|0,l=l+Math.imul(de,St)|0,C=C+Math.imul(de,xt)|0,I=I+Math.imul(K,Tt)|0,l=l+Math.imul(K,Nt)|0,l=l+Math.imul(H,Tt)|0,C=C+Math.imul(H,Nt)|0,I=I+Math.imul(q,Dt)|0,l=l+Math.imul(q,Ot)|0,l=l+Math.imul(M,Dt)|0,C=C+Math.imul(M,Ot)|0,I=I+Math.imul(L,Pt)|0,l=l+Math.imul(L,Bt)|0,l=l+Math.imul(P,Pt)|0,C=C+Math.imul(P,Bt)|0,I=I+Math.imul(E,Mt)|0,l=l+Math.imul(E,Rt)|0,l=l+Math.imul(b,Mt)|0,C=C+Math.imul(b,Rt)|0;var o0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(o0>>>26)|0,o0&=67108863,I=Math.imul(ze,Et),l=Math.imul(ze,At),l=l+Math.imul(Ue,Et)|0,C=Math.imul(Ue,At),I=I+Math.imul(Ze,It)|0,l=l+Math.imul(Ze,_t)|0,l=l+Math.imul(et,It)|0,C=C+Math.imul(et,_t)|0,I=I+Math.imul(Ie,bt)|0,l=l+Math.imul(Ie,Ct)|0,l=l+Math.imul(Pe,bt)|0,C=C+Math.imul(Pe,Ct)|0,I=I+Math.imul(be,St)|0,l=l+Math.imul(be,xt)|0,l=l+Math.imul(xe,St)|0,C=C+Math.imul(xe,xt)|0,I=I+Math.imul(he,Tt)|0,l=l+Math.imul(he,Nt)|0,l=l+Math.imul(de,Tt)|0,C=C+Math.imul(de,Nt)|0,I=I+Math.imul(K,Dt)|0,l=l+Math.imul(K,Ot)|0,l=l+Math.imul(H,Dt)|0,C=C+Math.imul(H,Ot)|0,I=I+Math.imul(q,Pt)|0,l=l+Math.imul(q,Bt)|0,l=l+Math.imul(M,Pt)|0,C=C+Math.imul(M,Bt)|0,I=I+Math.imul(L,Mt)|0,l=l+Math.imul(L,Rt)|0,l=l+Math.imul(P,Mt)|0,C=C+Math.imul(P,Rt)|0;var a0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(a0>>>26)|0,a0&=67108863,I=Math.imul(ze,It),l=Math.imul(ze,_t),l=l+Math.imul(Ue,It)|0,C=Math.imul(Ue,_t),I=I+Math.imul(Ze,bt)|0,l=l+Math.imul(Ze,Ct)|0,l=l+Math.imul(et,bt)|0,C=C+Math.imul(et,Ct)|0,I=I+Math.imul(Ie,St)|0,l=l+Math.imul(Ie,xt)|0,l=l+Math.imul(Pe,St)|0,C=C+Math.imul(Pe,xt)|0,I=I+Math.imul(be,Tt)|0,l=l+Math.imul(be,Nt)|0,l=l+Math.imul(xe,Tt)|0,C=C+Math.imul(xe,Nt)|0,I=I+Math.imul(he,Dt)|0,l=l+Math.imul(he,Ot)|0,l=l+Math.imul(de,Dt)|0,C=C+Math.imul(de,Ot)|0,I=I+Math.imul(K,Pt)|0,l=l+Math.imul(K,Bt)|0,l=l+Math.imul(H,Pt)|0,C=C+Math.imul(H,Bt)|0,I=I+Math.imul(q,Mt)|0,l=l+Math.imul(q,Rt)|0,l=l+Math.imul(M,Mt)|0,C=C+Math.imul(M,Rt)|0;var u0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(u0>>>26)|0,u0&=67108863,I=Math.imul(ze,bt),l=Math.imul(ze,Ct),l=l+Math.imul(Ue,bt)|0,C=Math.imul(Ue,Ct),I=I+Math.imul(Ze,St)|0,l=l+Math.imul(Ze,xt)|0,l=l+Math.imul(et,St)|0,C=C+Math.imul(et,xt)|0,I=I+Math.imul(Ie,Tt)|0,l=l+Math.imul(Ie,Nt)|0,l=l+Math.imul(Pe,Tt)|0,C=C+Math.imul(Pe,Nt)|0,I=I+Math.imul(be,Dt)|0,l=l+Math.imul(be,Ot)|0,l=l+Math.imul(xe,Dt)|0,C=C+Math.imul(xe,Ot)|0,I=I+Math.imul(he,Pt)|0,l=l+Math.imul(he,Bt)|0,l=l+Math.imul(de,Pt)|0,C=C+Math.imul(de,Bt)|0,I=I+Math.imul(K,Mt)|0,l=l+Math.imul(K,Rt)|0,l=l+Math.imul(H,Mt)|0,C=C+Math.imul(H,Rt)|0;var c0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(c0>>>26)|0,c0&=67108863,I=Math.imul(ze,St),l=Math.imul(ze,xt),l=l+Math.imul(Ue,St)|0,C=Math.imul(Ue,xt),I=I+Math.imul(Ze,Tt)|0,l=l+Math.imul(Ze,Nt)|0,l=l+Math.imul(et,Tt)|0,C=C+Math.imul(et,Nt)|0,I=I+Math.imul(Ie,Dt)|0,l=l+Math.imul(Ie,Ot)|0,l=l+Math.imul(Pe,Dt)|0,C=C+Math.imul(Pe,Ot)|0,I=I+Math.imul(be,Pt)|0,l=l+Math.imul(be,Bt)|0,l=l+Math.imul(xe,Pt)|0,C=C+Math.imul(xe,Bt)|0,I=I+Math.imul(he,Mt)|0,l=l+Math.imul(he,Rt)|0,l=l+Math.imul(de,Mt)|0,C=C+Math.imul(de,Rt)|0;var l0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(l0>>>26)|0,l0&=67108863,I=Math.imul(ze,Tt),l=Math.imul(ze,Nt),l=l+Math.imul(Ue,Tt)|0,C=Math.imul(Ue,Nt),I=I+Math.imul(Ze,Dt)|0,l=l+Math.imul(Ze,Ot)|0,l=l+Math.imul(et,Dt)|0,C=C+Math.imul(et,Ot)|0,I=I+Math.imul(Ie,Pt)|0,l=l+Math.imul(Ie,Bt)|0,l=l+Math.imul(Pe,Pt)|0,C=C+Math.imul(Pe,Bt)|0,I=I+Math.imul(be,Mt)|0,l=l+Math.imul(be,Rt)|0,l=l+Math.imul(xe,Mt)|0,C=C+Math.imul(xe,Rt)|0;var f0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(f0>>>26)|0,f0&=67108863,I=Math.imul(ze,Dt),l=Math.imul(ze,Ot),l=l+Math.imul(Ue,Dt)|0,C=Math.imul(Ue,Ot),I=I+Math.imul(Ze,Pt)|0,l=l+Math.imul(Ze,Bt)|0,l=l+Math.imul(et,Pt)|0,C=C+Math.imul(et,Bt)|0,I=I+Math.imul(Ie,Mt)|0,l=l+Math.imul(Ie,Rt)|0,l=l+Math.imul(Pe,Mt)|0,C=C+Math.imul(Pe,Rt)|0;var h0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(h0>>>26)|0,h0&=67108863,I=Math.imul(ze,Pt),l=Math.imul(ze,Bt),l=l+Math.imul(Ue,Pt)|0,C=Math.imul(Ue,Bt),I=I+Math.imul(Ze,Mt)|0,l=l+Math.imul(Ze,Rt)|0,l=l+Math.imul(et,Mt)|0,C=C+Math.imul(et,Rt)|0;var d0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(d0>>>26)|0,d0&=67108863,I=Math.imul(ze,Mt),l=Math.imul(ze,Rt),l=l+Math.imul(Ue,Mt)|0,C=Math.imul(Ue,Rt);var p0=(D+I|0)+((l&8191)<<13)|0;return D=(C+(l>>>13)|0)+(p0>>>26)|0,p0&=67108863,S[0]=Yp,S[1]=Jp,S[2]=Xp,S[3]=Zp,S[4]=e0,S[5]=t0,S[6]=r0,S[7]=i0,S[8]=n0,S[9]=s0,S[10]=o0,S[11]=a0,S[12]=u0,S[13]=c0,S[14]=l0,S[15]=f0,S[16]=h0,S[17]=d0,S[18]=p0,D!==0&&(S[19]=D,g.length++),g};Math.imul||($=z);function se(A,c,d){d.negative=c.negative^A.negative,d.length=A.length+c.length;for(var g=0,m=0,v=0;v>>26)|0,m+=S>>>26,S&=67108863}d.words[v]=D,g=S,S=m}return g!==0?d.words[v]=g:d.length--,d._strip()}function Y(A,c,d){return se(A,c,d)}n.prototype.mulTo=function(c,d){var g,m=this.length+c.length;return this.length===10&&c.length===10?g=$(this,c,d):m<63?g=z(this,c,d):m<1024?g=se(this,c,d):g=Y(this,c,d),g};function j(A,c){this.x=A,this.y=c}j.prototype.makeRBT=function(c){for(var d=new Array(c),g=n.prototype._countBits(c)-1,m=0;m>=1;return m},j.prototype.permute=function(c,d,g,m,v,S){for(var D=0;D>>1)v++;return 1<>>13,g[2*S+1]=v&8191,v=v>>>13;for(S=2*d;S>=26,g+=v/67108864|0,g+=S>>>26,this.words[m]=S&67108863}return g!==0&&(this.words[m]=g,this.length++),d?this.ineg():this},n.prototype.muln=function(c){return this.clone().imuln(c)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(c){var d=V(c);if(d.length===0)return new n(1);for(var g=this,m=0;m=0);var d=c%26,g=(c-d)/26,m=67108863>>>26-d<<26-d,v;if(d!==0){var S=0;for(v=0;v>>26-d}S&&(this.words[v]=S,this.length++)}if(g!==0){for(v=this.length-1;v>=0;v--)this.words[v+g]=this.words[v];for(v=0;v=0);var m;d?m=(d-d%26)/26:m=0;var v=c%26,S=Math.min((c-v)/26,this.length),D=67108863^67108863>>>v<S)for(this.length-=S,l=0;l=0&&(C!==0||l>=m);l--){var Z=this.words[l]|0;this.words[l]=C<<26-v|Z>>>v,C=Z&D}return I&&C!==0&&(I.words[I.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(c,d,g){return t(this.negative===0),this.iushrn(c,d,g)},n.prototype.shln=function(c){return this.clone().ishln(c)},n.prototype.ushln=function(c){return this.clone().iushln(c)},n.prototype.shrn=function(c){return this.clone().ishrn(c)},n.prototype.ushrn=function(c){return this.clone().iushrn(c)},n.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var d=c%26,g=(c-d)/26,m=1<=0);var d=c%26,g=(c-d)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(d!==0&&g++,this.length=Math.min(g,this.length),d!==0){var m=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(I/67108864|0),this.words[v+g]=S&67108863}for(;v>26,this.words[v+g]=S&67108863;if(D===0)return this._strip();for(t(D===-1),D=0,v=0;v>26,this.words[v]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(c,d){var g=this.length-c.length,m=this.clone(),v=c,S=v.words[v.length-1]|0,D=this._countBits(S);g=26-D,g!==0&&(v=v.ushln(g),m.iushln(g),S=v.words[v.length-1]|0);var I=m.length-v.length,l;if(d!=="mod"){l=new n(null),l.length=I+1,l.words=new Array(l.length);for(var C=0;C=0;ie--){var ee=(m.words[v.length+ie]|0)*67108864+(m.words[v.length+ie-1]|0);for(ee=Math.min(ee/S|0,67108863),m._ishlnsubmul(v,ee,ie);m.negative!==0;)ee--,m.negative=0,m._ishlnsubmul(v,1,ie),m.isZero()||(m.negative^=1);l&&(l.words[ie]=ee)}return l&&l._strip(),m._strip(),d!=="div"&&g!==0&&m.iushrn(g),{div:l||null,mod:m}},n.prototype.divmod=function(c,d,g){if(t(!c.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var m,v,S;return this.negative!==0&&c.negative===0?(S=this.neg().divmod(c,d),d!=="mod"&&(m=S.div.neg()),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.iadd(c)),{div:m,mod:v}):this.negative===0&&c.negative!==0?(S=this.divmod(c.neg(),d),d!=="mod"&&(m=S.div.neg()),{div:m,mod:S.mod}):this.negative&c.negative?(S=this.neg().divmod(c.neg(),d),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.isub(c)),{div:S.div,mod:v}):c.length>this.length||this.cmp(c)<0?{div:new n(0),mod:this}:c.length===1?d==="div"?{div:this.divn(c.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new n(this.modrn(c.words[0]))}:this._wordDiv(c,d)},n.prototype.div=function(c){return this.divmod(c,"div",!1).div},n.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},n.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},n.prototype.divRound=function(c){var d=this.divmod(c);if(d.mod.isZero())return d.div;var g=d.div.negative!==0?d.mod.isub(c):d.mod,m=c.ushrn(1),v=c.andln(1),S=g.cmp(m);return S<0||v===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=(1<<26)%c,m=0,v=this.length-1;v>=0;v--)m=(g*m+(this.words[v]|0))%c;return d?-m:m},n.prototype.modn=function(c){return this.modrn(c)},n.prototype.idivn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=0,m=this.length-1;m>=0;m--){var v=(this.words[m]|0)+g*67108864;this.words[m]=v/c|0,g=v%c}return this._strip(),d?this.ineg():this},n.prototype.divn=function(c){return this.clone().idivn(c)},n.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=new n(0),D=new n(1),I=0;d.isEven()&&g.isEven();)d.iushrn(1),g.iushrn(1),++I;for(var l=g.clone(),C=d.clone();!d.isZero();){for(var Z=0,ie=1;!(d.words[0]&ie)&&Z<26;++Z,ie<<=1);if(Z>0)for(d.iushrn(Z);Z-- >0;)(m.isOdd()||v.isOdd())&&(m.iadd(l),v.isub(C)),m.iushrn(1),v.iushrn(1);for(var ee=0,ae=1;!(g.words[0]&ae)&&ee<26;++ee,ae<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(S.isOdd()||D.isOdd())&&(S.iadd(l),D.isub(C)),S.iushrn(1),D.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(S),v.isub(D)):(g.isub(d),S.isub(m),D.isub(v))}return{a:S,b:D,gcd:g.iushln(I)}},n.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=g.clone();d.cmpn(1)>0&&g.cmpn(1)>0;){for(var D=0,I=1;!(d.words[0]&I)&&D<26;++D,I<<=1);if(D>0)for(d.iushrn(D);D-- >0;)m.isOdd()&&m.iadd(S),m.iushrn(1);for(var l=0,C=1;!(g.words[0]&C)&&l<26;++l,C<<=1);if(l>0)for(g.iushrn(l);l-- >0;)v.isOdd()&&v.iadd(S),v.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(v)):(g.isub(d),v.isub(m))}var Z;return d.cmpn(1)===0?Z=m:Z=v,Z.cmpn(0)<0&&Z.iadd(c),Z},n.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var d=this.clone(),g=c.clone();d.negative=0,g.negative=0;for(var m=0;d.isEven()&&g.isEven();m++)d.iushrn(1),g.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;g.isEven();)g.iushrn(1);var v=d.cmp(g);if(v<0){var S=d;d=g,g=S}else if(v===0||g.cmpn(1)===0)break;d.isub(g)}while(!0);return g.iushln(m)},n.prototype.invm=function(c){return this.egcd(c).a.umod(c)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(c){return this.words[0]&c},n.prototype.bincn=function(c){t(typeof c=="number");var d=c%26,g=(c-d)/26,m=1<>>26,D&=67108863,this.words[S]=D}return v!==0&&(this.words[S]=v,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(c){var d=c<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var g;if(this.length>1)g=1;else{d&&(c=-c),t(c<=67108863,"Number is too big");var m=this.words[0]|0;g=m===c?0:mc.length)return 1;if(this.length=0;g--){var m=this.words[g]|0,v=c.words[g]|0;if(m!==v){mv&&(d=1);break}}return d},n.prototype.gtn=function(c){return this.cmpn(c)===1},n.prototype.gt=function(c){return this.cmp(c)===1},n.prototype.gten=function(c){return this.cmpn(c)>=0},n.prototype.gte=function(c){return this.cmp(c)>=0},n.prototype.ltn=function(c){return this.cmpn(c)===-1},n.prototype.lt=function(c){return this.cmp(c)===-1},n.prototype.lten=function(c){return this.cmpn(c)<=0},n.prototype.lte=function(c){return this.cmp(c)<=0},n.prototype.eqn=function(c){return this.cmpn(c)===0},n.prototype.eq=function(c){return this.cmp(c)===0},n.red=function(c){return new J(c)},n.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},n.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(c){return this.red=c,this},n.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},n.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},n.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},n.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},n.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},n.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},n.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},n.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},n.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var W={k256:null,p224:null,p192:null,p25519:null};function k(A,c){this.name=A,this.p=new n(c,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new n(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var d=c,g;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),g=d.bitLength();while(g>this.n);var m=g0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},k.prototype.split=function(c,d){c.iushrn(this.n,0,d)},k.prototype.imulK=function(c){return c.imul(this.k)};function R(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,k),R.prototype.split=function(c,d){for(var g=4194303,m=Math.min(c.length,9),v=0;v>>22,S=D}S>>>=22,c.words[v-10]=S,S===0&&c.length>10?c.length-=10:c.length-=9},R.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var d=0,g=0;g>>=26,c.words[g]=v,d=m}return d!==0&&(c.words[c.length++]=d),c},n._prime=function(c){if(W[c])return W[c];var d;if(c==="k256")d=new R;else if(c==="p224")d=new F;else if(c==="p192")d=new G;else if(c==="p25519")d=new ce;else throw new Error("Unknown prime "+c);return W[c]=d,d};function J(A){if(typeof A=="string"){var c=n._prime(A);this.m=c.p,this.prime=c}else t(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}J.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},J.prototype._verify2=function(c,d){t((c.negative|d.negative)===0,"red works only with positives"),t(c.red&&c.red===d.red,"red works only with red numbers")},J.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(h(c,c.umod(this.m)._forceRed(this)),c)},J.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},J.prototype.add=function(c,d){this._verify2(c,d);var g=c.add(d);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},J.prototype.iadd=function(c,d){this._verify2(c,d);var g=c.iadd(d);return g.cmp(this.m)>=0&&g.isub(this.m),g},J.prototype.sub=function(c,d){this._verify2(c,d);var g=c.sub(d);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},J.prototype.isub=function(c,d){this._verify2(c,d);var g=c.isub(d);return g.cmpn(0)<0&&g.iadd(this.m),g},J.prototype.shl=function(c,d){return this._verify1(c),this.imod(c.ushln(d))},J.prototype.imul=function(c,d){return this._verify2(c,d),this.imod(c.imul(d))},J.prototype.mul=function(c,d){return this._verify2(c,d),this.imod(c.mul(d))},J.prototype.isqr=function(c){return this.imul(c,c.clone())},J.prototype.sqr=function(c){return this.mul(c,c)},J.prototype.sqrt=function(c){if(c.isZero())return c.clone();var d=this.m.andln(3);if(t(d%2===1),d===3){var g=this.m.add(new n(1)).iushrn(2);return this.pow(c,g)}for(var m=this.m.subn(1),v=0;!m.isZero()&&m.andln(1)===0;)v++,m.iushrn(1);t(!m.isZero());var S=new n(1).toRed(this),D=S.redNeg(),I=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);this.pow(l,I).cmp(D)!==0;)l.redIAdd(D);for(var C=this.pow(l,m),Z=this.pow(c,m.addn(1).iushrn(1)),ie=this.pow(c,m),ee=v;ie.cmp(S)!==0;){for(var ae=ie,E=0;ae.cmp(S)!==0;E++)ae=ae.redSqr();t(E=0;v--){for(var C=d.words[v],Z=l-1;Z>=0;Z--){var ie=C>>Z&1;if(S!==m[0]&&(S=this.sqr(S)),ie===0&&D===0){I=0;continue}D<<=1,D|=ie,I++,!(I!==g&&(v!==0||Z!==0))&&(S=this.mul(S,m[D]),I=0,D=0)}l=26}return S},J.prototype.convertTo=function(c){var d=c.umod(this.m);return d===c?d.clone():d},J.prototype.convertFrom=function(c){var d=c.clone();return d.red=null,d},n.mont=function(c){return new X(c)};function X(A){J.call(this,A),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,J),X.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},X.prototype.convertFrom=function(c){var d=this.imod(c.mul(this.rinv));return d.red=null,d},X.prototype.imul=function(c,d){if(c.isZero()||d.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.mul=function(c,d){if(c.isZero()||d.isZero())return new n(0)._forceRed(this);var g=c.mul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.invm=function(c){var d=this.imod(c._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof Hv>"u"||Hv,xO)});var NO=B(Sp=>{"use strict";f();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.TransactionStatus=void 0;var El=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new El("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}};Sp.TransactionStatus=El});var Mu=B(Zt=>{"use strict";f();var CG=Zt&&Zt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),SG=Zt&&Zt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),xG=Zt&&Zt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&CG(e,r,t);return SG(e,r),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.zeroPadStringIfOddLength=Zt.isPaddedHex=Zt.numberToPaddedHex=Zt.Nonce=Zt.Address=void 0;var DO=xG(kl()),TG="erd",Al=class{constructor(e){this.value=e}static fromPubkey(e){let t=DO.toWords(e),i=DO.encode(TG,t);return new Al(i)}bech32(){return this.value}toString(){return this.bech32()}};Zt.Address=Al;var Qv=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return OO(this.value)}};Zt.Nonce=Qv;function OO(r){let e=r.toString(16);return PO(e)}Zt.numberToPaddedHex=OO;function NG(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}Zt.isPaddedHex=NG;function PO(r){return r=r||"",r.length%2==1?"0"+r:r}Zt.zeroPadStringIfOddLength=PO});var MO=B(xp=>{"use strict";f();Object.defineProperty(xp,"__esModule",{value:!0});xp.TransactionReceipt=void 0;var BO=Mu(),Il=class{constructor(){this.value="",this.sender=new BO.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new Il;return t.value=(e.value||0).toString(),t.sender=new BO.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}};xp.TransactionReceipt=Il});var RO=B(Hi=>{"use strict";f();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.ErrContractQuery=Hi.ErrNetworkProvider=Hi.ErrUnexpectedCondition=Hi.Err=void 0;var Ru=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Hi.Err=Ru;var jv=class extends Ru{constructor(e){super(`Unexpected condition: [${e}]`)}};Hi.ErrUnexpectedCondition=jv;var Gv=class extends Ru{constructor(e,t,i){let n=`Request error on url [${e}]: [${t}]`;super(n,i)}};Hi.ErrNetworkProvider=Gv;var Kv=class extends Ru{constructor(e){super(e.message.replace("executeQuery:",""))}};Hi.ErrContractQuery=Kv});var FO=B(Lu=>{"use strict";f();Object.defineProperty(Lu,"__esModule",{value:!0});Lu.TransactionEventTopic=Lu.TransactionEvent=void 0;var LO=Mu(),_l=class{constructor(e){this.address=new LO.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let t=new _l;return t.address=new LO.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map(i=>new Tp(i)),t.data=y.Buffer.from(e.data||"","base64").toString(),t}findFirstOrNoneTopic(e){return this.topics.filter(t=>e(t))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Lu.TransactionEvent=_l;var Tp=class{constructor(e){this.raw=y.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Lu.TransactionEventTopic=Tp});var zv=B(Np=>{"use strict";f();Object.defineProperty(Np,"__esModule",{value:!0});Np.TransactionLogs=void 0;var DG=RO(),UO=Mu(),OG=FO(),bl=class{constructor(e){this.address=new UO.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new bl;return t.address=new UO.Address(e.address),t.events=(e.events||[]).map(i=>OG.TransactionEvent.fromHttpResponse(i)),t}findSingleOrNoneEvent(e,t){let i=this.findEvents(e,t);if(i.length>1)throw new DG.ErrUnexpectedCondition(`more than one event of type ${e}`);return i[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let i=this.events.filter(n=>n.identifier==e);return t&&(i=i.filter(n=>t(n))),i}};Np.TransactionLogs=bl});var VO=B(Uu=>{"use strict";f();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ContractResultItem=Uu.ContractResults=void 0;var qO=zv(),Dp=Mu(),Fu=class{constructor(e){this.items=e,this.items.sort(function(t,i){return t.nonce.valueOf()-i.nonce.valueOf()})}static fromProxyHttpResponse(e){let t=e.map(i=>fn.fromProxyHttpResponse(i));return new Fu(t)}static fromApiHttpResponse(e){let t=e.map(i=>fn.fromApiHttpResponse(i));return new Fu(t)}};Uu.ContractResults=Fu;var fn=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Dp.Address(""),this.sender=new Dp.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new qO.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return fn.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=fn.fromHttpResponse(e);return t.data=y.Buffer.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new fn;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new Dp.Address(e.receiver),t.sender=new Dp.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=qO.TransactionLogs.fromHttpResponse(e.logs||{}),t}};Uu.ContractResultItem=fn});var HO=B(rs=>{"use strict";f();var PG=rs&&rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rs,"__esModule",{value:!0});rs.EsdtContractAddress=rs.MaxUint64AsBigNumber=void 0;var BG=PG(jr()),MG=Mu();rs.MaxUint64AsBigNumber=new BG.default("18446744073709551615");rs.EsdtContractAddress=new MG.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var QO=B(qu=>{"use strict";f();var RG=qu&&qu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qu,"__esModule",{value:!0});qu.ContractQueryResponse=void 0;var LG=RG(jr()),FG=HO(),Cl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,i=e.returnCode||e.ReturnCode,n=e.returnMessage||e.ReturnMessage,s=new LG.default(e.gasRemaining||e.GasRemaining||0),o=FG.MaxUint64AsBigNumber.minus(s).toNumber();return new Cl({returnData:t,returnCode:i,returnMessage:n,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>y.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};qu.ContractQueryResponse=Cl});var jO=B(Op=>{"use strict";f();Object.defineProperty(Op,"__esModule",{value:!0});Op.ContractQueryRequest=void 0;var kv=class{constructor(e){this.query=e}toHttpRequest(){var e;let t={},i=this.query;return t.scAddress=i.address.bech32(),t.caller=!((e=i.caller)===null||e===void 0)&&e.bech32()?i.caller.bech32():void 0,t.funcName=i.func.toString(),t.value=i.value?i.value.toString():void 0,t.args=i.getEncodedArguments(),t}};Op.ContractQueryRequest=kv});var GO=B(Pp=>{"use strict";f();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.Query=void 0;var UG=Gr(),qG=jf(),Wv=class{constructor(e){this.caller=e.caller||new UG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new qG.ArgSerializer().valuesToStrings(this.args)}};Pp.Query=Wv});var t6=B((bne,e6)=>{f();e6.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var is=B(vo=>{f();var $v,VG=[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];vo.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};vo.getSymbolTotalCodewords=function(e){return VG[e]};vo.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};vo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');$v=e};vo.isKanjiModeEnabled=function(){return typeof $v<"u"};vo.toSJIS=function(e){return $v(e)}});var Rp=B(Qr=>{f();Qr.L={bit:1};Qr.M={bit:0};Qr.Q={bit:3};Qr.H={bit:2};function HG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.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: "+r)}}Qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Qr.from=function(e,t){if(Qr.isValid(e))return e;try{return HG(e)}catch{return t}}});var n6=B((Dne,i6)=>{f();function r6(){this.buffer=[],this.length=0}r6.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};i6.exports=r6});var o6=B((Pne,s6)=>{f();function Sl(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sl.prototype.set=function(r,e,t,i){let n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)};Sl.prototype.get=function(r,e){return this.data[r*this.size+e]};Sl.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};Sl.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};s6.exports=Sl});var a6=B(Lp=>{f();var QG=is().getSymbolSize;Lp.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,i=QG(e),n=i===145?26:Math.ceil((i-13)/(2*t-2))*2,s=[i-7];for(let o=1;o{f();var jG=is().getSymbolSize,u6=7;c6.getPositions=function(e){let t=jG(e);return[[0,0],[t-u6,0],[0,t-u6]]}});var f6=B($e=>{f();$e.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};$e.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};$e.from=function(e){return $e.isValid(e)?parseInt(e,10):void 0};$e.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let u=0;u=5&&(i+=Eo.N1+(n-5)),o=p,n=1),p=e.get(h,u),p===a?s++:(s>=5&&(i+=Eo.N1+(s-5)),a=p,s=1)}n>=5&&(i+=Eo.N1+(n-5)),s>=5&&(i+=Eo.N1+(s-5))}return i};$e.getPenaltyN2=function(e){let t=e.size,i=0;for(let n=0;n=10&&(n===1488||n===93)&&i++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&i++}return i*Eo.N3};$e.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let s=0;s{f();var ns=Rp(),Fp=[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],Up=[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];Yv.getBlocksCount=function(e,t){switch(t){case ns.L:return Fp[(e-1)*4+0];case ns.M:return Fp[(e-1)*4+1];case ns.Q:return Fp[(e-1)*4+2];case ns.H:return Fp[(e-1)*4+3];default:return}};Yv.getTotalCodewordsCount=function(e,t){switch(t){case ns.L:return Up[(e-1)*4+0];case ns.M:return Up[(e-1)*4+1];case ns.Q:return Up[(e-1)*4+2];case ns.H:return Up[(e-1)*4+3];default:return}}});var h6=B(Vp=>{f();var xl=new Uint8Array(512),qp=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)xl[t]=e,qp[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)xl[t]=xl[t-255]})();Vp.log=function(e){if(e<1)throw new Error("log("+e+")");return qp[e]};Vp.exp=function(e){return xl[e]};Vp.mul=function(e,t){return e===0||t===0?0:xl[qp[e]+qp[t]]}});var d6=B(Tl=>{f();var Xv=h6();Tl.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n=0;){let n=i[0];for(let o=0;o{f();var p6=d6();function Zv(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Zv.prototype.initialize=function(e){this.degree=e,this.genPoly=p6.generateECPolynomial(this.degree)};Zv.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=p6.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let s=new Uint8Array(this.degree);return s.set(i,n),s}return i};g6.exports=Zv});var eE=B(m6=>{f();m6.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var tE=B(hn=>{f();var w6="[0-9]+",KG="[A-Z $%*+\\-./:]+",Nl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Nl=Nl.replace(/u/g,"\\u");var zG="(?:(?![A-Z0-9 $%*+\\-./:]|"+Nl+`)(?:.|[\r +]))+`;hn.KANJI=new RegExp(Nl,"g");hn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");hn.BYTE=new RegExp(zG,"g");hn.NUMERIC=new RegExp(w6,"g");hn.ALPHANUMERIC=new RegExp(KG,"g");var kG=new RegExp("^"+Nl+"$"),WG=new RegExp("^"+w6+"$"),$G=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");hn.testKanji=function(e){return kG.test(e)};hn.testNumeric=function(e){return WG.test(e)};hn.testAlphanumeric=function(e){return $G.test(e)}});var ss=B(qt=>{f();var YG=eE(),rE=tE();qt.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};qt.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};qt.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};qt.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};qt.MIXED={bit:-1};qt.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!YG.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};qt.getBestModeForData=function(e){return rE.testNumeric(e)?qt.NUMERIC:rE.testAlphanumeric(e)?qt.ALPHANUMERIC:rE.testKanji(e)?qt.KANJI:qt.BYTE};qt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};qt.isValid=function(e){return e&&e.bit&&e.ccBits};function JG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return qt.NUMERIC;case"alphanumeric":return qt.ALPHANUMERIC;case"kanji":return qt.KANJI;case"byte":return qt.BYTE;default:throw new Error("Unknown mode: "+r)}}qt.from=function(e,t){if(qt.isValid(e))return e;try{return JG(e)}catch{return t}}});var _6=B(Ao=>{f();var Hp=is(),XG=Jv(),v6=Rp(),os=ss(),iE=eE(),A6=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,E6=Hp.getBCHDigit(A6);function ZG(r,e,t){for(let i=1;i<=40;i++)if(e<=Ao.getCapacity(i,t,r))return i}function I6(r,e){return os.getCharCountIndicator(r,e)+4}function eK(r,e){let t=0;return r.forEach(function(i){let n=I6(i.mode,e);t+=n+i.getBitsLength()}),t}function tK(r,e){for(let t=1;t<=40;t++)if(eK(r,t)<=Ao.getCapacity(t,e,os.MIXED))return t}Ao.from=function(e,t){return iE.isValid(e)?parseInt(e,10):t};Ao.getCapacity=function(e,t,i){if(!iE.isValid(e))throw new Error("Invalid QR Code version");typeof i>"u"&&(i=os.BYTE);let n=Hp.getSymbolTotalCodewords(e),s=XG.getTotalCodewordsCount(e,t),o=(n-s)*8;if(i===os.MIXED)return o;let a=o-I6(i,e);switch(i){case os.NUMERIC:return Math.floor(a/10*3);case os.ALPHANUMERIC:return Math.floor(a/11*2);case os.KANJI:return Math.floor(a/13);case os.BYTE:default:return Math.floor(a/8)}};Ao.getBestVersionForData=function(e,t){let i,n=v6.from(t,v6.M);if(Array.isArray(e)){if(e.length>1)return tK(e,n);if(e.length===0)return 1;i=e[0]}else i=e;return ZG(i.mode,i.getLength(),n)};Ao.getEncodedBits=function(e){if(!iE.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Hp.getBCHDigit(t)-E6>=0;)t^=A6<{f();var nE=is(),C6=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,rK=1<<14|1<<12|1<<10|1<<4|1<<1,b6=nE.getBCHDigit(C6);S6.getEncodedBits=function(e,t){let i=e.bit<<3|t,n=i<<10;for(;nE.getBCHDigit(n)-b6>=0;)n^=C6<{f();var iK=ss();function Vu(r){this.mode=iK.NUMERIC,this.data=r.toString()}Vu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);let s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};T6.exports=Vu});var O6=B((ose,D6)=>{f();var nK=ss(),sE=["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 Hu(r){this.mode=nK.ALPHANUMERIC,this.data=r}Hu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Hu.prototype.getLength=function(){return this.data.length};Hu.prototype.getBitsLength=function(){return Hu.getBitsLength(this.data.length)};Hu.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=sE.indexOf(this.data[t])*45;i+=sE.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(sE.indexOf(this.data[t]),6)};D6.exports=Hu});var B6=B((use,P6)=>{"use strict";f();P6.exports=function(e){for(var t=[],i=e.length,n=0;n=55296&&s<=56319&&i>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}});var R6=B((lse,M6)=>{f();var sK=B6(),oK=ss();function Qu(r){this.mode=oK.BYTE,typeof r=="string"&&(r=sK(r)),this.data=new Uint8Array(r)}Qu.getBitsLength=function(e){return e*8};Qu.prototype.getLength=function(){return this.data.length};Qu.prototype.getBitsLength=function(){return Qu.getBitsLength(this.data.length)};Qu.prototype.write=function(r){for(let e=0,t=this.data.length;e{f();var aK=ss(),uK=is();function ju(r){this.mode=aK.KANJI,this.data=r}ju.getBitsLength=function(e){return e*13};ju.prototype.getLength=function(){return this.data.length};ju.prototype.getBitsLength=function(){return ju.getBitsLength(this.data.length)};ju.prototype.write=function(r){let e;for(e=0;e=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};L6.exports=ju});var U6=B((pse,oE)=>{"use strict";f();var Dl={single_source_shortest_paths:function(r,e,t){var i={},n={};n[e]=0;var s=Dl.PriorityQueue.make();s.push(e,0);for(var o,a,u,h,p,w,N,O,T;!s.empty();){o=s.pop(),a=o.value,h=o.cost,p=r[a]||{};for(u in p)p.hasOwnProperty(u)&&(w=p[u],N=h+w,O=n[u],T=typeof n[u]>"u",(T||O>N)&&(n[u]=N,s.push(u,N),i[u]=a))}if(typeof t<"u"&&typeof n[t]>"u"){var V=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(V)}return i},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],i=e,n;i;)t.push(i),n=r[i],i=r[i];return t.reverse(),t},find_path:function(r,e,t){var i=Dl.single_source_shortest_paths(r,e,t);return Dl.extract_shortest_path_from_predecessor_list(i,t)},PriorityQueue:{make:function(r){var e=Dl.PriorityQueue,t={},i;r=r||{};for(i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof oE<"u"&&(oE.exports=Dl)});var z6=B(Gu=>{f();var Qe=ss(),H6=N6(),Q6=O6(),j6=R6(),G6=F6(),Ol=tE(),Qp=is(),cK=U6();function q6(r){return unescape(encodeURIComponent(r)).length}function Pl(r,e,t){let i=[],n;for(;(n=r.exec(t))!==null;)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function K6(r){let e=Pl(Ol.NUMERIC,Qe.NUMERIC,r),t=Pl(Ol.ALPHANUMERIC,Qe.ALPHANUMERIC,r),i,n;return Qp.isKanjiModeEnabled()?(i=Pl(Ol.BYTE,Qe.BYTE,r),n=Pl(Ol.KANJI,Qe.KANJI,r)):(i=Pl(Ol.BYTE_KANJI,Qe.BYTE,r),n=[]),e.concat(t,i,n).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function aE(r,e){switch(e){case Qe.NUMERIC:return H6.getBitsLength(r);case Qe.ALPHANUMERIC:return Q6.getBitsLength(r);case Qe.KANJI:return G6.getBitsLength(r);case Qe.BYTE:return j6.getBitsLength(r)}}function lK(r){return r.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function fK(r){let e=[];for(let t=0;t{f();var Gp=is(),uE=Rp(),dK=n6(),pK=o6(),gK=a6(),yK=l6(),fE=f6(),hE=Jv(),mK=y6(),jp=_6(),wK=x6(),vK=ss(),cE=z6();function EK(r,e){let t=r.size,i=yK.getPositions(e);for(let n=0;n=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?r.set(s+a,o+u,!0,!0):r.set(s+a,o+u,!1,!0))}}function AK(r){let e=r.size;for(let t=8;t>a&1)===1,r.set(n,s,o,!0),r.set(s,n,o,!0)}function lE(r,e,t){let i=r.size,n=wK.getEncodedBits(e,t),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?r.set(s,8,o,!0):s<8?r.set(s+1,8,o,!0):r.set(i-15+s,8,o,!0),s<8?r.set(8,i-s-1,o,!0):s<9?r.set(8,15-s-1+1,o,!0):r.set(8,15-s-1,o,!0);r.set(i-8,8,1,!0)}function bK(r,e){let t=r.size,i=-1,n=t-1,s=7,o=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!r.isReserved(n,a-u)){let h=!1;o>>s&1)===1),r.set(n,a-u,h),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function CK(r,e,t){let i=new dK;t.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),vK.getCharCountIndicator(u.mode,r)),u.write(i)});let n=Gp.getSymbolTotalCodewords(r),s=hE.getTotalCodewordsCount(r,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);let a=(o-i.getLengthInBits())/8;for(let u=0;u=7&&IK(u,e),_K(u,o),isNaN(i)&&(i=fE.getBestMask(u,lE.bind(null,u,t))),fE.applyMask(i,u),lE(u,t,i),{modules:u,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}z6.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=uE.M,n,s;return typeof t<"u"&&(i=uE.from(t.errorCorrectionLevel,uE.M),n=jp.from(t.version),s=fE.from(t.maskPattern),t.toSJISFunc&&Gp.setToSJISFunction(t.toSJISFunc)),SK(e,n,i,s)}});var dE=B(Ao=>{f();function W6(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}Ao.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:W6(e.color.dark||"#000000ff"),light:W6(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ao.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};Ao.getImageWidth=function(e,t){let i=Ao.getScale(e,t);return Math.floor((e+t.margin*2)*i)};Ao.qrToImageData=function(e,t,i){let n=t.modules.size,s=t.modules.data,o=Ao.getScale(n,i),a=Math.floor((n+i.margin*2)*o),u=i.margin*o,h=[i.color.light,i.color.dark];for(let p=0;p=u&&w>=u&&p{f();var pE=dE();function xK(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function TK(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Kp.render=function(e,t,i){let n=i,s=t;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),t||(s=TK()),n=pE.getOptions(n);let o=pE.getImageWidth(e.modules.size,n),a=s.getContext("2d"),u=a.createImageData(o,o);return pE.qrToImageData(u.data,e,n),xK(a,s,o),a.putImageData(u,0,0),s};Kp.renderToDataURL=function(e,t,i){let n=i;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),n||(n={});let s=Kp.render(e,t,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}});var X6=B(J6=>{f();var NK=dE();function Y6(r,e){let t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function gE(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function DK(r,e,t){let i="",n=0,s=!1,o=0;for(let a=0;a0&&u>0&&r[a-1]||(i+=s?gE("M",u+t,.5+h+t):gE("m",n,0),n=0,s=!1),u+1':"",h="',p='viewBox="0 0 '+a+" "+a+'"',N=''+u+h+` -`;return typeof i=="function"&&i(null,N),N}});var e8=B(Bl=>{f();var OK=e6(),yE=k6(),Z6=$6(),PK=X6();function mE(r,e,t,i,n){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!OK())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=t,t=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(t=e,e=i=void 0):o===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(u,h){try{let p=yE.create(t,i);u(r(p,e,i))}catch(p){h(p)}})}try{let u=yE.create(t,i);n(null,r(u,e,i))}catch(u){n(u)}}Bl.create=yE.create;Bl.toCanvas=mE.bind(null,Z6.render);Bl.toDataURL=mE.bind(null,Z6.renderToDataURL);Bl.toString=mE.bind(null,function(r,e,t){return PK.render(r,t)})});var h8=B(as=>{"use strict";f();var GK=as&&as.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),f8=as&&as.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&GK(e,r,t)};Object.defineProperty(as,"__esModule",{value:!0});f8(vl(),as);f8(Uv(),as)});f();var KK=_e(og()),w8=_e($I()),zK=_e(Gr()),kK=_e(zf()),WK=_e(jy()),$K=_e(sc()),YK=_e(Wy()),JK=_e(mn()),v8=_e(ic()),XK=_e(ec()),ZK=_e(cy()),ez=_e(Yb()),tz=_e(Go());f();f();var nC=_e(Zy());f();f();var nh="elvenjs_state",tC="https://devnet-api.multiversx.com";var sh="/dapp/init",oh="devnet",rC="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",iC=["wss://relay.walletconnect.com"],xi={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.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",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",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Ne={get(r){let e=localStorage.getItem(nh);if(!e)return{};let t=JSON.parse(e);return r?t[r]:t},set(r,e){let t=this.get();t[r]=e,localStorage.setItem(nh,JSON.stringify(t))},clear(){localStorage.removeItem(nh)}};var ah=()=>Te(void 0,null,function*(){let r=nC.ExtensionProvider.getInstance();try{let e=yield r.init(),t=Ne.get();if(t!=null&&t.address&&r.setAddress(t.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return r}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var g8=_e(Zy()),y8=_e(dl()),m8=_e(vl());f();var _O=_e(dl());f();f();var De=class{static set(e,t){if(!e)return;let i=OE(_o({},this.events),{[e]:t});this.events=i}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...t){var i,n;!e||!this.events||(n=(i=this.events)[e])==null||n.call(i,...t)}static clear(){this.events=void 0}};f();var yo=(n=>(n.ledger="ledger",n.mobile="mobile",n.webWallet="web-wallet",n.browserExtension="browser-extension",n))(yo||{});var Pu=r=>Te(void 0,null,function*(){if(!r.dappProvider)throw new Error("Error: Logout failed: There is no active session!");De.run("onLoginPending");let e=yield r.dappProvider.logout();return e&&(Ne.clear(),De.run("onLogout")),e});f();var AO=_e(Gr()),IO=_e(zf());f();var Xt=r=>typeof r=="string"?r.toUpperCase():r instanceof Error?r.message:`Error: ${JSON.stringify(r)}`;f();var Bu=()=>new Date().setHours(new Date().getHours()+24),bp=r=>Date.now()>r;var ts=r=>Te(void 0,null,function*(){let e=Ne.get("address"),t=Ne.get("expires");if(!(t&&bp(t))&&e&&r.networkProvider){let n=new AO.Address(e),s=new IO.Account(n);try{let o=yield r.networkProvider.getAccount(n);Ne.set("address",e),Ne.set("nonce",o.nonce.valueOf()),Ne.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});f();function Cp(r){return r[Math.floor(Math.random()*r.length)]}var bO=r=>Te(void 0,null,function*(){if(!r.initOptions.walletConnectV2ProjectId||!r.initOptions.chainType)return;let e={onClientLogin:()=>{ts(r),De.run("onLoggedIn")},onClientLogout:()=>Pu(r),onClientEvent:n=>{console.log("wc2 session event: ",n)}},t=Cp(r.initOptions.walletConnectV2RelayAddresses),i=new _O.WalletConnectV2Provider(e,xi[r.initOptions.chainType].shortId,t,r.initOptions.walletConnectV2ProjectId);try{return yield i.init(),i}catch(n){console.warn("Can't initialize the Dapp Provider!")}});f();var GO=_e(xO()),Bp=_e(Gr()),KO=_e(TO()),zO=_e(BO()),kO=_e(zv()),WO=_e(qO()),$O=_e(HO()),YO=_e(QO()),JO=_e(jO());var Mp=class{constructor({apiUrl:e,chainType:t,apiTimeout:i}){var n,s;this.chainType=t||oh,this.apiUrl=e||((n=xi[this.chainType])==null?void 0:n.apiAddress),this.apiTimeout=i||((s=xi[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,t){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,n=setTimeout(()=>i.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:i.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,t||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(n),Promise.reject(u)}return clearTimeout(n),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,t,i){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,s=setTimeout(()=>n.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t||{}),signal:n.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,i||{})),u=yield a.json();if(!a.ok){let h=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(h)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,t){if(!e.response)throw new Error(`Request error on url [${t}]: [${e.toString()}]`);let i=e.response.data,n=i.error||i.message||JSON.stringify(i);throw new Error(n)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let t=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Bp.Address((t==null?void 0:t.address)||""),nonce:Number((t==null?void 0:t.nonce)||0),balance:new GO.default((t==null?void 0:t.balance)||0),code:(t==null?void 0:t.code)||"",userName:(t==null?void 0:t.username)||""}})}getTransaction(e){return Te(this,null,function*(){let t=yield this.apiGet(`transactions/${e}`),i=new KO.TransactionStatus(t.status);return{hash:e,type:t.type||"",nonce:t.nonce||0,round:t.round,epoch:t.epoch||0,value:(t.value||0).toString(),sender:new Bp.Address(t.sender),receiver:new Bp.Address(t.receiver),gasPrice:t.gasPrice||0,gasLimit:t.gasLimit||0,data:y.Buffer.from(t.data||"","base64"),status:i,timestamp:t.timestamp||0,blockNonce:t.blockNonce||0,hyperblockNonce:t.hyperblockNonce||0,hyperblockHash:t.hyperblockHash||"",receipt:zO.TransactionReceipt.fromHttpResponse(t.receipt||{}),logs:kO.TransactionLogs.fromHttpResponse(t.logs||{}),contractResults:WO.ContractResults.fromApiHttpResponse(t.results||[]),isCompleted:!i.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i,value:n,caller:s}){try{let a=new JO.Query({address:e,func:t,args:i,value:n,caller:s}),u=new YO.ContractQueryRequest(a).toHttpRequest(),h=yield this.apiPost("query",u);return $O.ContractQueryResponse.fromHttpResponse(h)}catch(a){this.handleApiError(a,"query")}})}};f();var XO=(r,e)=>Te(void 0,null,function*(){let t=yield ah();try{t&&(yield t.login()),De.run("onLoginPending")}catch(n){let s=Xt(n);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!t)throw new Error("Error: There were problems with auth provider initialization!");let{signature:i}=t.account;if(e&&Ne.set("loginToken",e),i&&Ne.set("signature",i),r.networkProvider)try{let n=yield t.getAddress();if(!n)throw new Error("Canceled!");return Ne.set("address",n),Ne.set("loginMethod","browser-extension"),Ne.set("expires",Bu()),yield ts(r),t}catch(n){console.warn(`Something went wrong trying to synchronize the user account: ${n==null?void 0:n.message}`)}finally{De.run("onLoggedIn")}});f();f();var t8=_e(e8()),r8=_e(dl());var MK=r=>{var t;let e=document.createElement("template");return e.innerHTML=r.trim(),(t=e.content.firstChild)==null?void 0:t.cloneNode(!0)},RK=r=>{let e=`${rC}?wallet-connect=${encodeURIComponent(r)}`,t=document.createElement("a");return t.setAttribute("href",e),t.setAttribute("rel","noopener noreferrer nofollow"),t.setAttribute("target","_blank"),t.textContent="Maiar login",t.classList.add("elven-qr-code-deep-link"),t},LK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairings"),r},FK=()=>{let r=document.createElement("div");return r.textContent="Existing WalletConnect pairings:",r.classList.add("elven-wc-pairings-header"),r},wE={},UK=(r,e)=>{let t=document.createElement("button");return t.classList.add("elven-wc-pairings-remove-btn"),t.textContent="\u2716",wE[r.topic]=new AbortController,t.addEventListener("click",()=>e(r.topic),{signal:wE[r.topic].signal}),t},zp={},qK=(r,e,t)=>{var o,a;let i=document.createElement("div"),n=document.createElement("div");i.classList.add("elven-wc-pairing-item"),i.setAttribute("id",r.topic),n.classList.add("elven-wc-pairing-item-description"),n.textContent=`${(o=r.peerMetadata)==null?void 0:o.description} (${(a=r.peerMetadata)==null?void 0:a.url})`,i.appendChild(n);let s=UK(r,e);return i.appendChild(s),zp[r.topic]=new AbortController,i.addEventListener("click",()=>t(r.topic),{signal:zp[r.topic].signal}),i},VK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairing-item-confirm-msessage"),r.innerText="Confirm on xPortal app!",r},HK=r=>{if(!r)return;let e=document.getElementById(r);e==null||e.remove()},QK=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),jK=r=>Te(void 0,null,function*(){return r?yield t8.default.toString(r,{type:"svg"}):void 0}),i8=(r,e,t,i)=>Te(void 0,null,function*(){if(!r)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let n=null;typeof r=="string"?n=document.getElementById(r):r instanceof HTMLElement&&(n=r);let s=yield jK(e),o;if(s&&(o=MK(s)),n&&o&&(n.replaceChildren(),n.appendChild(o),QK()&&n.appendChild(RK(e))),n&&t instanceof r8.WalletConnectV2Provider){let a=t.pairings,u=p=>Te(void 0,null,function*(){try{p&&(yield t.logout({topic:p}),HK(p))}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to remove the existing pairing: ${N}`)}finally{zp[p].abort()}}),h=p=>Te(void 0,null,function*(){try{let{approval:w}=yield t.connect({topic:p,methods:["erd_cancelAction"]}),N=document.getElementById(p);N==null||N.after(VK()),yield t.login({approval:w,token:i})}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to login the user: ${N}`)}finally{for(let w of Object.values(zp))w==null||w.abort();for(let w of Object.values(wE))w==null||w.abort()}});if(a&&a.length>0){let p=LK();n.appendChild(p);let w=FK();p.appendChild(w);for(let N of a){let O=qK(N,u,h);p.appendChild(O)}}}return n});var kp=_e(dl());var n8=(r,e,t)=>Te(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let i=Cp(r.initOptions.walletConnectV2RelayAddresses);if(!i||!r.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!r.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!r.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let n,s={onClientLogin:()=>Te(void 0,null,function*(){if(r.dappProvider instanceof kp.WalletConnectV2Provider){De.run("onLoginPending");let a=yield r.dappProvider.getAddress(),u=yield r.dappProvider.getSignature();Ne.set("address",a),Ne.set("loginMethod","mobile"),Ne.set("expires",Bu()),yield ts(r),u&&Ne.set("signature",u),t&&Ne.set("loginToken",t),De.run("onLoggedIn"),n==null||n.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){r.dappProvider instanceof kp.WalletConnectV2Provider&&(yield Pu(r),De.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new kp.WalletConnectV2Provider(s,xi[r.initOptions.chainType].shortId,i,r.initOptions.walletConnectV2ProjectId);try{if(o){r.dappProvider=o,De.run("onQrPending");let{uri:a,approval:u}=yield o.connect({methods:["erd_cancelAction"]}),h=t?`${a}&token=${t}`:a;return e&&h&&(n=yield i8(e,h,o,t),De.run("onQrLoaded")),yield o.login({approval:u,token:t}),o}}catch(a){let u=Xt(a);console.warn(`Something went wrong trying to login the user: ${u}`)}});f();var s8=_e(vl());var o8=(r,e,t)=>Te(void 0,null,function*(){let i=new s8.WalletProvider(`${r}${sh}`),n=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=_o({callbackUrl:n},t?{token:t}:{});try{return De.run("onLoginPending"),Ne.set("loginMethod","web-wallet"),yield i.login(s),Ne.set("expires",Bu()),t&&Ne.set("loginToken",t),i}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Ne.set("loginMethod","")}});f();var Io=r=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(r)}};f();var a8=_e(vl());var u8=r=>Te(void 0,null,function*(){let e=Io("signature"),t=Io("address"),i=Ne.get("address");if(e&&Ne.set("signature",e),t||i)return t&&(Ne.set("address",t),window.history.replaceState(null,"",window.location.pathname)),new a8.WalletProvider(`${r}${sh}`)});f();var c8=_e(zf()),l8=_e(Wy());var Wp=(r,e)=>Te(void 0,null,function*(){De.run("onTxSent",r),yield new l8.TransactionWatcher(e).awaitCompleted(r);let i=r.getSender(),n=new c8.Account(i),s=yield e.getAccount(i);n.update(s),Ne.set("address",n.address.bech32()),Ne.set("nonce",n.getNonceThenIncrement().valueOf()),Ne.set("balance",n.balance.toString()),De.run("onTxFinalized",r)});f();var $p=_e(h8()),d8=_e(jy());var p8=(r,e,t)=>Te(void 0,null,function*(){if(Io($p.WALLET_PROVIDER_CALLBACK_PARAM)===$p.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&r&&e&&"getTransactionsFromWalletUrl"in r){let n=r.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=n==null?void 0:n[0];if(s){s.data=y.Buffer.from(s.data).toString("base64");let o=d8.Transaction.fromPlainObject(s);o.setNonce(t);try{De.run("onTxStarted",o),yield e.sendTransaction(o),yield Wp(o,e)}catch(a){let u=Xt(a);throw De.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Rl=class{static init(e){return Te(this,null,function*(){let t=Ne.get();if(t.expires&&bp(t.expires)){Ne.clear(),this.dappProvider=void 0;return}this.initOptions=_o({chainType:oh,apiUrl:tC,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:iC},e),this.networkProvider=new Mp(this.initOptions),this.initOptions.onLoginPending&&De.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&De.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&De.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&De.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&De.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&De.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&De.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&De.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&De.set("onTxError",this.initOptions.onTxError),((t==null?void 0:t.address)||t.loginMethod==="web-wallet"&&Io("address"))&&(t!=null&&t.loginMethod)&&(De.run("onLoginPending"),t.loginMethod==="browser-extension"&&(this.dappProvider=yield ah()),t.loginMethod==="mobile"&&(this.dappProvider=yield bO(this)),t.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield u8(xi[this.initOptions.chainType].walletAddress)),yield ts(this),De.run("onLoggedIn"),t.loginMethod==="web-wallet"&&(yield p8(this.dappProvider,this.networkProvider,t.nonce)))})}static login(e,t){return Te(this,null,function*(){var n;if(!Object.values(yo).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield XO(this,t==null?void 0:t.token);this.dappProvider=s}if(e==="mobile"){let s=yield n8(this,t==null?void 0:t.qrCodeContainer,t==null?void 0:t.token);this.dappProvider=s}if(e==="web-wallet"&&((n=this.initOptions)!=null&&n.chainType)){let s=yield o8(xi[this.initOptions.chainType].walletAddress,t==null?void 0:t.callbackRoute,t==null?void 0:t.token);this.dappProvider=s}}catch(s){let o=Xt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Te(this,null,function*(){try{let e=yield Pu(this);return this.dappProvider=void 0,e}catch(e){let t=Xt(e);console.warn("Something went wrong when logging out: ",t)}})}static signAndSendTransaction(e){return Te(this,null,function*(){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!");try{De.run("onTxStarted",e);let t=Ne.get();e.setNonce(t.nonce),this.dappProvider instanceof g8.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof y8.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof m8.WalletProvider&&(yield this.dappProvider.signTransaction(e)),t.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Wp(e,this.networkProvider))}catch(t){let i=Xt(t);throw De.run("onTxError",e,i),new Error(`Error: Transaction signing failed! ${i}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i=[],value:n=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!t)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:t,args:i,value:n,caller:s})}catch(a){let u=Xt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},Ml=Rl;Ml.storage=Ne,Ml.destroy=()=>{Rl.networkProvider=void 0,Rl.dappProvider=void 0,Rl.initOptions=void 0,De.clear()};var export_Account=kK.Account;var export_Address=zK.Address;var export_AddressValue=tz.AddressValue;var export_BigUIntValue=v8.BigUIntValue;var export_BooleanValue=XK.BooleanValue;var export_BytesValue=JK.BytesValue;var export_ContractCallPayloadBuilder=ZK.ContractCallPayloadBuilder;var export_ContractFunction=ez.ContractFunction;var export_ESDTNFTTransferPayloadBuilder=w8.ESDTNFTTransferPayloadBuilder;var export_ESDTTransferPayloadBuilder=w8.ESDTTransferPayloadBuilder;var export_TokenPayment=KK.TokenPayment;var export_Transaction=WK.Transaction;var export_TransactionPayload=$K.TransactionPayload;var export_TransactionWatcher=YK.TransactionWatcher;var export_U32Value=v8.U32Value;export{export_Account as Account,export_Address as Address,export_AddressValue as AddressValue,export_BigUIntValue as BigUIntValue,export_BooleanValue as BooleanValue,export_BytesValue as BytesValue,export_ContractCallPayloadBuilder as ContractCallPayloadBuilder,export_ContractFunction as ContractFunction,export_ESDTNFTTransferPayloadBuilder as ESDTNFTTransferPayloadBuilder,export_ESDTTransferPayloadBuilder as ESDTTransferPayloadBuilder,Ml as ElvenJS,yo as LoginMethodsEnum,export_TokenPayment as TokenPayment,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_U32Value as U32Value}; +`);let o=CK(e,t,n),a=Gp.getSymbolSize(e),u=new pK(a);return EK(u,e),AK(u),IK(u,e),lE(u,t,0),e>=7&&_K(u,e),bK(u,o),isNaN(i)&&(i=fE.getBestMask(u,lE.bind(null,u,t))),fE.applyMask(i,u),lE(u,t,i),{modules:u,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}k6.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=uE.M,n,s;return typeof t<"u"&&(i=uE.from(t.errorCorrectionLevel,uE.M),n=jp.from(t.version),s=fE.from(t.maskPattern),t.toSJISFunc&&Gp.setToSJISFunction(t.toSJISFunc)),xK(e,n,i,s)}});var dE=B(Io=>{f();function $6(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}Io.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:$6(e.color.dark||"#000000ff"),light:$6(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Io.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};Io.getImageWidth=function(e,t){let i=Io.getScale(e,t);return Math.floor((e+t.margin*2)*i)};Io.qrToImageData=function(e,t,i){let n=t.modules.size,s=t.modules.data,o=Io.getScale(n,i),a=Math.floor((n+i.margin*2)*o),u=i.margin*o,h=[i.color.light,i.color.dark];for(let p=0;p=u&&w>=u&&p{f();var pE=dE();function TK(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function NK(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Kp.render=function(e,t,i){let n=i,s=t;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),t||(s=NK()),n=pE.getOptions(n);let o=pE.getImageWidth(e.modules.size,n),a=s.getContext("2d"),u=a.createImageData(o,o);return pE.qrToImageData(u.data,e,n),TK(a,s,o),a.putImageData(u,0,0),s};Kp.renderToDataURL=function(e,t,i){let n=i;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),n||(n={});let s=Kp.render(e,t,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}});var Z6=B(X6=>{f();var DK=dE();function J6(r,e){let t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function gE(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function OK(r,e,t){let i="",n=0,s=!1,o=0;for(let a=0;a0&&u>0&&r[a-1]||(i+=s?gE("M",u+t,.5+h+t):gE("m",n,0),n=0,s=!1),u+1':"",h="',p='viewBox="0 0 '+a+" "+a+'"',N=''+u+h+` +`;return typeof i=="function"&&i(null,N),N}});var t8=B(Bl=>{f();var PK=t6(),yE=W6(),e8=Y6(),BK=Z6();function mE(r,e,t,i,n){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!PK())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=t,t=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(t=e,e=i=void 0):o===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(u,h){try{let p=yE.create(t,i);u(r(p,e,i))}catch(p){h(p)}})}try{let u=yE.create(t,i);n(null,r(u,e,i))}catch(u){n(u)}}Bl.create=yE.create;Bl.toCanvas=mE.bind(null,e8.render);Bl.toDataURL=mE.bind(null,e8.renderToDataURL);Bl.toString=mE.bind(null,function(r,e,t){return BK.render(r,t)})});var d8=B(as=>{"use strict";f();var KK=as&&as.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),h8=as&&as.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&KK(e,r,t)};Object.defineProperty(as,"__esModule",{value:!0});h8(vl(),as);h8(Uv(),as)});f();var zK=_e(og()),v8=_e($I()),kK=_e(Gr()),WK=_e(zf()),$K=_e(jy()),YK=_e(sc()),JK=_e(Wy()),XK=_e(wn()),E8=_e(ic()),ZK=_e(ec()),ez=_e(cy()),tz=_e(Yb()),rz=_e(Ko());f();f();var nC=_e(Zy());f();f();var nh="elvenjs_state",tC="https://devnet-api.multiversx.com";var sh="/dapp/init",oh="devnet",rC="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",iC=["wss://relay.walletconnect.com"],xi={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.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",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",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Ne={get(r){let e=localStorage.getItem(nh);if(!e)return{};let t=JSON.parse(e);return r?t[r]:t},set(r,e){let t=this.get();t[r]=e,localStorage.setItem(nh,JSON.stringify(t))},clear(){localStorage.removeItem(nh)}};var ah=()=>Te(void 0,null,function*(){let r=nC.ExtensionProvider.getInstance();try{let e=yield r.init(),t=Ne.get();if(t!=null&&t.address&&r.setAddress(t.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return r}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var y8=_e(Zy()),m8=_e(dl()),w8=_e(vl());f();var bO=_e(dl());f();f();var De=class{static set(e,t){if(!e)return;let i=OE(bo({},this.events),{[e]:t});this.events=i}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...t){var i,n;!e||!this.events||(n=(i=this.events)[e])==null||n.call(i,...t)}static clear(){this.events=void 0}};f();var mo=(n=>(n.ledger="ledger",n.mobile="mobile",n.webWallet="web-wallet",n.browserExtension="browser-extension",n))(mo||{});var Pu=r=>Te(void 0,null,function*(){if(!r.dappProvider)throw new Error("Error: Logout failed: There is no active session!");De.run("onLoginPending");let e=yield r.dappProvider.logout();return e&&(Ne.clear(),De.run("onLogout")),e});f();var IO=_e(Gr()),_O=_e(zf());f();var Xt=r=>typeof r=="string"?r.toUpperCase():r instanceof Error?r.message:`Error: ${JSON.stringify(r)}`;f();var Bu=()=>new Date().setHours(new Date().getHours()+24),bp=r=>Date.now()>r;var ts=r=>Te(void 0,null,function*(){let e=Ne.get("address"),t=Ne.get("expires");if(!(t&&bp(t))&&e&&r.networkProvider){let n=new IO.Address(e),s=new _O.Account(n);try{let o=yield r.networkProvider.getAccount(n);Ne.set("address",e),Ne.set("nonce",o.nonce.valueOf()),Ne.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});f();function Cp(r){return r[Math.floor(Math.random()*r.length)]}var CO=r=>Te(void 0,null,function*(){if(!r.initOptions.walletConnectV2ProjectId||!r.initOptions.chainType)return;let e={onClientLogin:()=>{ts(r),De.run("onLoggedIn")},onClientLogout:()=>Pu(r),onClientEvent:n=>{console.log("wc2 session event: ",n)}},t=Cp(r.initOptions.walletConnectV2RelayAddresses),i=new bO.WalletConnectV2Provider(e,xi[r.initOptions.chainType].shortId,t,r.initOptions.walletConnectV2ProjectId);try{return yield i.init(),i}catch(n){console.warn("Can't initialize the Dapp Provider!")}});f();var KO=_e(TO()),Bp=_e(Gr()),zO=_e(NO()),kO=_e(MO()),WO=_e(zv()),$O=_e(VO()),YO=_e(QO()),JO=_e(jO()),XO=_e(GO());var Mp=class{constructor({apiUrl:e,chainType:t,apiTimeout:i}){var n,s;this.chainType=t||oh,this.apiUrl=e||((n=xi[this.chainType])==null?void 0:n.apiAddress),this.apiTimeout=i||((s=xi[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,t){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,n=setTimeout(()=>i.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:i.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,t||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(n),Promise.reject(u)}return clearTimeout(n),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,t,i){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,s=setTimeout(()=>n.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t||{}),signal:n.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,i||{})),u=yield a.json();if(!a.ok){let h=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(h)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,t){if(!e.response)throw new Error(`Request error on url [${t}]: [${e.toString()}]`);let i=e.response.data,n=i.error||i.message||JSON.stringify(i);throw new Error(n)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let t=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Bp.Address((t==null?void 0:t.address)||""),nonce:Number((t==null?void 0:t.nonce)||0),balance:new KO.default((t==null?void 0:t.balance)||0),code:(t==null?void 0:t.code)||"",userName:(t==null?void 0:t.username)||""}})}getTransaction(e){return Te(this,null,function*(){let t=yield this.apiGet(`transactions/${e}`),i=new zO.TransactionStatus(t.status);return{hash:e,type:t.type||"",nonce:t.nonce||0,round:t.round,epoch:t.epoch||0,value:(t.value||0).toString(),sender:new Bp.Address(t.sender),receiver:new Bp.Address(t.receiver),gasPrice:t.gasPrice||0,gasLimit:t.gasLimit||0,data:y.Buffer.from(t.data||"","base64"),status:i,timestamp:t.timestamp||0,blockNonce:t.blockNonce||0,hyperblockNonce:t.hyperblockNonce||0,hyperblockHash:t.hyperblockHash||"",receipt:kO.TransactionReceipt.fromHttpResponse(t.receipt||{}),logs:WO.TransactionLogs.fromHttpResponse(t.logs||{}),contractResults:$O.ContractResults.fromApiHttpResponse(t.results||[]),isCompleted:!i.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i,value:n,caller:s}){try{let a=new XO.Query({address:e,func:t,args:i,value:n,caller:s}),u=new JO.ContractQueryRequest(a).toHttpRequest(),h=yield this.apiPost("query",u);return YO.ContractQueryResponse.fromHttpResponse(h)}catch(a){this.handleApiError(a,"query")}})}};f();var ZO=(r,e)=>Te(void 0,null,function*(){let t=yield ah();try{t&&(yield t.login()),De.run("onLoginPending")}catch(n){let s=Xt(n);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!t)throw new Error("Error: There were problems with auth provider initialization!");let{signature:i}=t.account;if(e&&Ne.set("loginToken",e),i&&Ne.set("signature",i),r.networkProvider)try{let n=yield t.getAddress();if(!n)throw new Error("Canceled!");return Ne.set("address",n),Ne.set("loginMethod","browser-extension"),Ne.set("expires",Bu()),yield ts(r),t}catch(n){console.warn(`Something went wrong trying to synchronize the user account: ${n==null?void 0:n.message}`)}finally{De.run("onLoggedIn")}});f();f();var r8=_e(t8()),i8=_e(dl());var RK=r=>{var t;let e=document.createElement("template");return e.innerHTML=r.trim(),(t=e.content.firstChild)==null?void 0:t.cloneNode(!0)},LK=r=>{let e=`${rC}?wallet-connect=${encodeURIComponent(r)}`,t=document.createElement("a");return t.setAttribute("href",e),t.setAttribute("rel","noopener noreferrer nofollow"),t.setAttribute("target","_blank"),t.textContent="Maiar login",t.classList.add("elven-qr-code-deep-link"),t},FK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairings"),r},UK=()=>{let r=document.createElement("div");return r.textContent="Existing WalletConnect pairings:",r.classList.add("elven-wc-pairings-header"),r},wE={},qK=(r,e)=>{let t=document.createElement("button");return t.classList.add("elven-wc-pairings-remove-btn"),t.textContent="\u2716",wE[r.topic]=new AbortController,t.addEventListener("click",()=>e(r.topic),{signal:wE[r.topic].signal}),t},zp={},VK=(r,e,t)=>{var o,a;let i=document.createElement("div"),n=document.createElement("div");i.classList.add("elven-wc-pairing-item"),i.setAttribute("id",r.topic),n.classList.add("elven-wc-pairing-item-description"),n.textContent=`${(o=r.peerMetadata)==null?void 0:o.description} (${(a=r.peerMetadata)==null?void 0:a.url})`,i.appendChild(n);let s=qK(r,e);return i.appendChild(s),zp[r.topic]=new AbortController,i.addEventListener("click",()=>t(r.topic),{signal:zp[r.topic].signal}),i},HK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairing-item-confirm-msessage"),r.innerText="Confirm on xPortal app!",r},QK=r=>{if(!r)return;let e=document.getElementById(r);e==null||e.remove()},jK=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),GK=r=>Te(void 0,null,function*(){return r?yield r8.default.toString(r,{type:"svg"}):void 0}),n8=(r,e,t,i)=>Te(void 0,null,function*(){if(!r)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let n=null;typeof r=="string"?n=document.getElementById(r):r instanceof HTMLElement&&(n=r);let s=yield GK(e),o;if(s&&(o=RK(s)),n&&o&&(n.replaceChildren(),n.appendChild(o),jK()&&n.appendChild(LK(e))),n&&t instanceof i8.WalletConnectV2Provider){let a=t.pairings,u=p=>Te(void 0,null,function*(){try{p&&(yield t.logout({topic:p}),QK(p))}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to remove the existing pairing: ${N}`)}finally{zp[p].abort()}}),h=p=>Te(void 0,null,function*(){try{let{approval:w}=yield t.connect({topic:p,methods:["erd_cancelAction"]}),N=document.getElementById(p);N==null||N.after(HK()),yield t.login({approval:w,token:i})}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to login the user: ${N}`)}finally{for(let w of Object.values(zp))w==null||w.abort();for(let w of Object.values(wE))w==null||w.abort()}});if(a&&a.length>0){let p=FK();n.appendChild(p);let w=UK();p.appendChild(w);for(let N of a){let O=VK(N,u,h);p.appendChild(O)}}}return n});var kp=_e(dl());var s8=(r,e,t)=>Te(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let i=Cp(r.initOptions.walletConnectV2RelayAddresses);if(!i||!r.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!r.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!r.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let n,s={onClientLogin:()=>Te(void 0,null,function*(){if(r.dappProvider instanceof kp.WalletConnectV2Provider){De.run("onLoginPending");let a=yield r.dappProvider.getAddress(),u=yield r.dappProvider.getSignature();Ne.set("address",a),Ne.set("loginMethod","mobile"),Ne.set("expires",Bu()),yield ts(r),u&&Ne.set("signature",u),t&&Ne.set("loginToken",t),De.run("onLoggedIn"),n==null||n.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){r.dappProvider instanceof kp.WalletConnectV2Provider&&(yield Pu(r),De.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new kp.WalletConnectV2Provider(s,xi[r.initOptions.chainType].shortId,i,r.initOptions.walletConnectV2ProjectId);try{if(o){r.dappProvider=o,De.run("onQrPending");let{uri:a,approval:u}=yield o.connect({methods:["erd_cancelAction"]}),h=t?`${a}&token=${t}`:a;return e&&h&&(n=yield n8(e,h,o,t),De.run("onQrLoaded")),yield o.login({approval:u,token:t}),o}}catch(a){let u=Xt(a);console.warn(`Something went wrong trying to login the user: ${u}`)}});f();var o8=_e(vl());var a8=(r,e,t)=>Te(void 0,null,function*(){let i=new o8.WalletProvider(`${r}${sh}`),n=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=bo({callbackUrl:n},t?{token:t}:{});try{return De.run("onLoginPending"),Ne.set("loginMethod","web-wallet"),yield i.login(s),Ne.set("expires",Bu()),t&&Ne.set("loginToken",t),i}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Ne.set("loginMethod","")}});f();var _o=r=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(r)}};f();var u8=_e(vl());var c8=r=>Te(void 0,null,function*(){let e=_o("signature"),t=_o("address"),i=Ne.get("address");if(e&&Ne.set("signature",e),t||i)return t&&(Ne.set("address",t),window.history.replaceState(null,"",window.location.pathname)),new u8.WalletProvider(`${r}${sh}`)});f();var l8=_e(zf()),f8=_e(Wy());var Wp=(r,e)=>Te(void 0,null,function*(){De.run("onTxSent",r),yield new f8.TransactionWatcher(e).awaitCompleted(r);let i=r.getSender(),n=new l8.Account(i),s=yield e.getAccount(i);n.update(s),Ne.set("address",n.address.bech32()),Ne.set("nonce",n.getNonceThenIncrement().valueOf()),Ne.set("balance",n.balance.toString()),De.run("onTxFinalized",r)});f();var $p=_e(d8()),p8=_e(jy());var g8=(r,e,t)=>Te(void 0,null,function*(){if(_o($p.WALLET_PROVIDER_CALLBACK_PARAM)===$p.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&r&&e&&"getTransactionsFromWalletUrl"in r){let n=r.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=n==null?void 0:n[0];if(s){s.data=y.Buffer.from(s.data).toString("base64");let o=p8.Transaction.fromPlainObject(s);o.setNonce(t);try{De.run("onTxStarted",o),yield e.sendTransaction(o),yield Wp(o,e)}catch(a){let u=Xt(a);throw De.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Rl=class{static init(e){return Te(this,null,function*(){let t=Ne.get();if(t.expires&&bp(t.expires)){Ne.clear(),this.dappProvider=void 0;return}this.initOptions=bo({chainType:oh,apiUrl:tC,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:iC},e),this.networkProvider=new Mp(this.initOptions),this.initOptions.onLoginPending&&De.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&De.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&De.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&De.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&De.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&De.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&De.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&De.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&De.set("onTxError",this.initOptions.onTxError),((t==null?void 0:t.address)||t.loginMethod==="web-wallet"&&_o("address"))&&(t!=null&&t.loginMethod)&&(De.run("onLoginPending"),t.loginMethod==="browser-extension"&&(this.dappProvider=yield ah()),t.loginMethod==="mobile"&&(this.dappProvider=yield CO(this)),t.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield c8(xi[this.initOptions.chainType].walletAddress)),yield ts(this),De.run("onLoggedIn"),t.loginMethod==="web-wallet"&&(yield g8(this.dappProvider,this.networkProvider,t.nonce)))})}static login(e,t){return Te(this,null,function*(){var n;if(!Object.values(mo).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield ZO(this,t==null?void 0:t.token);this.dappProvider=s}if(e==="mobile"){let s=yield s8(this,t==null?void 0:t.qrCodeContainer,t==null?void 0:t.token);this.dappProvider=s}if(e==="web-wallet"&&((n=this.initOptions)!=null&&n.chainType)){let s=yield a8(xi[this.initOptions.chainType].walletAddress,t==null?void 0:t.callbackRoute,t==null?void 0:t.token);this.dappProvider=s}}catch(s){let o=Xt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Te(this,null,function*(){try{let e=yield Pu(this);return this.dappProvider=void 0,e}catch(e){let t=Xt(e);console.warn("Something went wrong when logging out: ",t)}})}static signAndSendTransaction(e){return Te(this,null,function*(){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!");try{De.run("onTxStarted",e);let t=Ne.get();e.setNonce(t.nonce),this.dappProvider instanceof y8.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof m8.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof w8.WalletProvider&&(yield this.dappProvider.signTransaction(e)),t.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Wp(e,this.networkProvider))}catch(t){let i=Xt(t);throw De.run("onTxError",e,i),new Error(`Error: Transaction signing failed! ${i}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i=[],value:n=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!t)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:t,args:i,value:n,caller:s})}catch(a){let u=Xt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},Ml=Rl;Ml.storage=Ne,Ml.destroy=()=>{Rl.networkProvider=void 0,Rl.dappProvider=void 0,Rl.initOptions=void 0,De.clear()};var export_Account=WK.Account;var export_Address=kK.Address;var export_AddressValue=rz.AddressValue;var export_BigUIntValue=E8.BigUIntValue;var export_BooleanValue=ZK.BooleanValue;var export_BytesValue=XK.BytesValue;var export_ContractCallPayloadBuilder=ez.ContractCallPayloadBuilder;var export_ContractFunction=tz.ContractFunction;var export_ESDTNFTTransferPayloadBuilder=v8.ESDTNFTTransferPayloadBuilder;var export_ESDTTransferPayloadBuilder=v8.ESDTTransferPayloadBuilder;var export_TokenPayment=zK.TokenPayment;var export_Transaction=$K.Transaction;var export_TransactionPayload=YK.TransactionPayload;var export_TransactionWatcher=JK.TransactionWatcher;var export_U32Value=E8.U32Value;export{export_Account as Account,export_Address as Address,export_AddressValue as AddressValue,export_BigUIntValue as BigUIntValue,export_BooleanValue as BooleanValue,export_BytesValue as BytesValue,export_ContractCallPayloadBuilder as ContractCallPayloadBuilder,export_ContractFunction as ContractFunction,export_ESDTNFTTransferPayloadBuilder as ESDTNFTTransferPayloadBuilder,export_ESDTTransferPayloadBuilder as ESDTTransferPayloadBuilder,Ml as ElvenJS,mo as LoginMethodsEnum,export_TokenPayment as TokenPayment,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_U32Value as U32Value}; /*! Bundled license information: ieee754/index.js: diff --git a/esbuild.config.cjs b/esbuild.config.cjs index e1e3a2e..888284f 100644 --- a/esbuild.config.cjs +++ b/esbuild.config.cjs @@ -1,8 +1,10 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const esbuild = require('esbuild'); + // Bring back if needed // const plugin = require('node-stdlib-browser/helpers/esbuild/plugin'); // const stdLibBrowser = require('node-stdlib-browser'); + const fs = require('fs'); esbuild diff --git a/example/elven.js b/example/elven.js index 70da62a..b155be7 100644 --- a/example/elven.js +++ b/example/elven.js @@ -1,12 +1,12 @@ -var E8=Object.create;var Ku=Object.defineProperty,A8=Object.defineProperties,I8=Object.getOwnPropertyDescriptor,_8=Object.getOwnPropertyDescriptors,b8=Object.getOwnPropertyNames,TE=Object.getOwnPropertySymbols,C8=Object.getPrototypeOf,DE=Object.prototype.hasOwnProperty,S8=Object.prototype.propertyIsEnumerable;var NE=(r,e,t)=>e in r?Ku(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,_o=(r,e)=>{for(var t in e||={})DE.call(e,t)&&NE(r,t,e[t]);if(TE)for(var t of TE(e))S8.call(e,t)&&NE(r,t,e[t]);return r},OE=(r,e)=>A8(r,_8(e));var PE=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var me=(r,e)=>()=>(r&&(e=r(r=0)),e);var B=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ot=(r,e)=>{for(var t in e)Ku(r,t,{get:e[t],enumerable:!0})},Ll=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of b8(e))!DE.call(r,n)&&n!==t&&Ku(r,n,{get:()=>e[n],enumerable:!(i=I8(e,n))||i.enumerable});return r},er=(r,e,t)=>(Ll(r,e,"default"),t&&Ll(t,e,"default")),_e=(r,e,t)=>(t=r!=null?E8(C8(r)):{},Ll(e||!r||!r.__esModule?Ku(t,"default",{value:r,enumerable:!0}):t,r)),at=r=>Ll(Ku({},"__esModule",{value:!0}),r);var Te=(r,e,t)=>new Promise((i,n)=>{var s=u=>{try{a(t.next(u))}catch(h){n(h)}},o=u=>{try{a(t.throw(u))}catch(h){n(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);a((t=t.apply(r,e)).next())});var y0=B(Fl=>{"use strict";f();Fl.byteLength=T8;Fl.toByteArray=D8;Fl.fromByteArray=B8;var ii=[],xr=[],x8=typeof Uint8Array<"u"?Uint8Array:Array,g0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(cs=0,BE=g0.length;cs0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function T8(r){var e=ME(r),t=e[0],i=e[1];return(t+i)*3/4-i}function N8(r,e,t){return(e+t)*3/4-t}function D8(r){var e,t=ME(r),i=t[0],n=t[1],s=new x8(N8(r,i,n)),o=0,a=n>0?i-4:i,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=xr[r.charCodeAt(u)]<<2|xr[r.charCodeAt(u+1)]>>4,s[o++]=e&255),n===1&&(e=xr[r.charCodeAt(u)]<<10|xr[r.charCodeAt(u+1)]<<4|xr[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function O8(r){return ii[r>>18&63]+ii[r>>12&63]+ii[r>>6&63]+ii[r&63]}function P8(r,e,t){for(var i,n=[],s=e;sa?a:o+s));return i===1?(e=r[t-1],n.push(ii[e>>2]+ii[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ii[e>>10]+ii[e>>4&63]+ii[e<<2&63]+"=")),n.join("")}});var w0=B(m0=>{f();m0.read=function(r,e,t,i,n){var s,o,a=n*8-i-1,u=(1<>1,p=-7,w=t?n-1:0,N=t?-1:1,O=r[e+w];for(w+=N,s=O&(1<<-p)-1,O>>=-p,p+=a;p>0;s=s*256+r[e+w],w+=N,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+r[e+w],w+=N,p-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(O?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-h}return(O?-1:1)*o*Math.pow(2,s-i)};m0.write=function(r,e,t,i,n,s){var o,a,u,h=s*8-n-1,p=(1<>1,N=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=i?0:s-1,T=i?1:-1,V=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+w>=1?e+=N/u:e+=N*Math.pow(2,1-w),e*u>=2&&(o++,u/=2),o+w>=p?(a=0,o=p):o+w>=1?(a=(e*u-1)*Math.pow(2,n),o=o+w):(a=e*Math.pow(2,w-1)*Math.pow(2,n),o=0));n>=8;r[t+O]=a&255,O+=T,a/=256,n-=8);for(o=o<0;r[t+O]=o&255,O+=T,o/=256,h-=8);r[t+O-T]|=V*128}});var kE=B(Co=>{"use strict";f();var v0=y0(),bo=w0(),RE=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Co.Buffer=oe;Co.SlowBuffer=q8;Co.INSPECT_MAX_BYTES=50;var Ul=2147483647;Co.kMaxLength=Ul;oe.TYPED_ARRAY_SUPPORT=M8();!oe.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 M8(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(oe.prototype,"parent",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.buffer}});Object.defineProperty(oe.prototype,"offset",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.byteOffset}});function Hi(r){if(r>Ul)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,oe.prototype),e}function oe(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _0(r)}return UE(r,e,t)}oe.poolSize=8192;function UE(r,e,t){if(typeof r=="string")return L8(r,e);if(ArrayBuffer.isView(r))return F8(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(ni(r,ArrayBuffer)||r&&ni(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ni(r,SharedArrayBuffer)||r&&ni(r.buffer,SharedArrayBuffer)))return A0(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return oe.from(i,e,t);var n=U8(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return oe.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}oe.from=function(r,e,t){return UE(r,e,t)};Object.setPrototypeOf(oe.prototype,Uint8Array.prototype);Object.setPrototypeOf(oe,Uint8Array);function qE(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function R8(r,e,t){return qE(r),r<=0?Hi(r):e!==void 0?typeof t=="string"?Hi(r).fill(e,t):Hi(r).fill(e):Hi(r)}oe.alloc=function(r,e,t){return R8(r,e,t)};function _0(r){return qE(r),Hi(r<0?0:b0(r)|0)}oe.allocUnsafe=function(r){return _0(r)};oe.allocUnsafeSlow=function(r){return _0(r)};function L8(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!oe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=VE(r,e)|0,i=Hi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function E0(r){for(var e=r.length<0?0:b0(r.length)|0,t=Hi(e),i=0;i=Ul)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ul.toString(16)+" bytes");return r|0}function q8(r){return+r!=r&&(r=0),oe.alloc(+r)}oe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==oe.prototype};oe.compare=function(e,t){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),ni(t,Uint8Array)&&(t=oe.from(t,t.offset,t.byteLength)),!oe.isBuffer(e)||!oe.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);sn.length?oe.from(o).copy(n,s):Uint8Array.prototype.set.call(n,o,s);else if(oe.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function VE(r,e){if(oe.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||ni(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return I0(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return zE(r).length;default:if(n)return i?-1:I0(r).length;e=(""+e).toLowerCase(),n=!0}}oe.byteLength=VE;function V8(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Y8(this,e,t);case"utf8":case"utf-8":return QE(this,e,t);case"ascii":return W8(this,e,t);case"latin1":case"binary":return $8(this,e,t);case"base64":return z8(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J8(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}oe.prototype._isBuffer=!0;function ls(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}oe.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 t=0;tt&&(e+=" ... "),""};RE&&(oe.prototype[RE]=oe.prototype.inspect);oe.prototype.compare=function(e,t,i,n,s){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),!oe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i),w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,C0(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=oe.from(e,i)),oe.isBuffer(e))return e.length===0?-1:LE(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):LE(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function LE(r,e,t,i,n){var s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(O,T){return s===1?O[T]:O.readUInt16BE(T*s)}var h;if(n){var p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){for(var w=!0,N=0;Nn&&(i=n)):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return H8(this,e,t,i);case"utf8":case"utf-8":return Q8(this,e,t,i);case"ascii":case"latin1":case"binary":return j8(this,e,t,i);case"base64":return G8(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K8(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};oe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function z8(r,e,t){return e===0&&t===r.length?v0.fromByteArray(r):v0.fromByteArray(r.slice(e,t))}function QE(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+a<=t){var u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return k8(i)}var FE=4096;function k8(r){var e=r.length;if(e<=FE)return String.fromCharCode.apply(String,r);for(var t="",i=0;ii)&&(t=i);for(var n="",s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}oe.prototype.readUintLE=oe.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n};oe.prototype.readUint8=oe.prototype.readUInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]};oe.prototype.readUint16LE=oe.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]|this[e+1]<<8};oe.prototype.readUint16BE=oe.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]<<8|this[e+1]};oe.prototype.readUint32LE=oe.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};oe.prototype.readUint32BE=oe.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};oe.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o=s&&(n-=Math.pow(2,8*t)),n};oe.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=t,s=1,o=this[e+--n];n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};oe.prototype.readInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};oe.prototype.readInt16LE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt16BE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};oe.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};oe.prototype.readFloatLE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),bo.read(this,e,!0,23,4)};oe.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),bo.read(this,e,!1,23,4)};oe.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),bo.read(this,e,!0,52,8)};oe.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),bo.read(this,e,!1,52,8)};function pr(r,e,t,i,n,s){if(!oe.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}oe.prototype.writeUintLE=oe.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=1,a=0;for(this[t]=e&255;++a>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};oe.prototype.writeUint8=oe.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,255,0),this[t]=e&255,t+1};oe.prototype.writeUint16LE=oe.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeUint16BE=oe.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeUint32LE=oe.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};oe.prototype.writeUint32BE=oe.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};oe.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=0,a=1,u=0;for(this[t]=e&255;++o>0)-u&255;return t+i};oe.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};oe.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};oe.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};oe.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function jE(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function GE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,4,34028234663852886e22,-34028234663852886e22),bo.write(r,e,t,i,23,4),t+4}oe.prototype.writeFloatLE=function(e,t,i){return GE(this,e,t,!0,i)};oe.prototype.writeFloatBE=function(e,t,i){return GE(this,e,t,!1,i)};function KE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,8,17976931348623157e292,-17976931348623157e292),bo.write(r,e,t,i,52,8),t+8}oe.prototype.writeDoubleLE=function(e,t,i){return KE(this,e,t,!0,i)};oe.prototype.writeDoubleBE=function(e,t,i){return KE(this,e,t,!1,i)};oe.prototype.copy=function(e,t,i,n){if(!oe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function eP(r){for(var e=[],t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function zE(r){return v0.toByteArray(Z8(r))}function ql(r,e,t,i){for(var n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ni(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function C0(r){return r!==r}var rP=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)e[i+n]=r[t]+r[n];return e}()});var XE=B((cz,JE)=>{f();var dt=JE.exports={},si,oi;function S0(){throw new Error("setTimeout has not been defined")}function x0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?si=setTimeout:si=S0}catch{si=S0}try{typeof clearTimeout=="function"?oi=clearTimeout:oi=x0}catch{oi=x0}})();function WE(r){if(si===setTimeout)return setTimeout(r,0);if((si===S0||!si)&&setTimeout)return si=setTimeout,setTimeout(r,0);try{return si(r,0)}catch{try{return si.call(null,r,0)}catch{return si.call(this,r,0)}}}function iP(r){if(oi===clearTimeout)return clearTimeout(r);if((oi===x0||!oi)&&clearTimeout)return oi=clearTimeout,clearTimeout(r);try{return oi(r)}catch{try{return oi.call(null,r)}catch{return oi.call(this,r)}}}var Qi=[],So=!1,fs,Vl=-1;function nP(){!So||!fs||(So=!1,fs.length?Qi=fs.concat(Qi):Vl=-1,Qi.length&&$E())}function $E(){if(!So){var r=WE(nP);So=!0;for(var e=Qi.length;e;){for(fs=Qi,Qi=[];++Vl1)for(var t=1;t{y=_e(kE()),_=_e(XE()),sP=function(r){function e(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object),global=sP});var jr=B((ZE,Hl)=>{f();(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],w=1e7,N=1e9;function O(W){var k,R,F,G=l.prototype={constructor:l,toString:null,valueOf:null},ce=new l(1),J=20,X=4,A=-7,c=21,d=-1e7,g=1e7,m=!1,v=1,S=0,D={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz";function l(E,b){var x,L,P,U,q,M,Q,K,H=this;if(!(H instanceof l))return new l(E,b);if(b==null){if(E&&E._isBigNumber===!0){H.s=E.s,!E.c||E.e>g?H.c=H.e=null:E.e=10;q/=10,U++);U>g?H.c=H.e=null:(H.e=U,H.c=[E]);return}K=String(E)}else{if(!t.test(K=String(E)))return F(H,K,M);H.s=K.charCodeAt(0)==45?(K=K.slice(1),-1):1}(U=K.indexOf("."))>-1&&(K=K.replace(".","")),(q=K.search(/e/i))>0?(U<0&&(U=q),U+=+K.slice(q+1),K=K.substring(0,q)):U<0&&(U=K.length)}else{if($(b,2,I.length,"Base"),b==10)return H=new l(E),ee(H,J+H.e+1,X);if(K=String(E),M=typeof E=="number"){if(E*0!=0)return F(H,K,M,b);if(H.s=1/E<0?(K=K.slice(1),-1):1,l.DEBUG&&K.replace(/^0\.0*|\./,"").length>15)throw Error(o+E)}else H.s=K.charCodeAt(0)===45?(K=K.slice(1),-1):1;for(x=I.slice(0,b),U=q=0,Q=K.length;qU){U=Q;continue}}else if(!P&&(K==K.toUpperCase()&&(K=K.toLowerCase())||K==K.toLowerCase()&&(K=K.toUpperCase()))){P=!0,q=-1,U=0;continue}return F(H,String(E),M,b)}M=!1,K=R(K,b,10,H.s),(U=K.indexOf("."))>-1?K=K.replace(".",""):U=K.length}for(q=0;K.charCodeAt(q)===48;q++);for(Q=K.length;K.charCodeAt(--Q)===48;);if(K=K.slice(q,++Q)){if(Q-=q,M&&l.DEBUG&&Q>15&&(E>h||E!==n(E)))throw Error(o+H.s*E);if((U=U-q-1)>g)H.c=H.e=null;else if(U=-N&&P<=N&&P===n(P)){if(L[0]===0){if(P===0&&L.length===1)return!0;break e}if(b=(P+1)%u,b<1&&(b+=u),String(L[0]).length==b){for(b=0;b=a||x!==n(x))break e;if(x!==0)return!0}}}else if(L===null&&P===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+E)},l.maximum=l.max=function(){return Z(arguments,G.lt)},l.minimum=l.min=function(){return Z(arguments,G.gt)},l.random=function(){var E=9007199254740992,b=Math.random()*E&2097151?function(){return n(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var L,P,U,q,M,Q=0,K=[],H=new l(ce);if(x==null?x=J:$(x,0,N),q=i(x/u),m)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(q*=2));Q>>11),M>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),L[Q]=P[0],L[Q+1]=P[1]):(K.push(M%1e14),Q+=2);Q=q/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(q*=7);Q=9e15?crypto.randomBytes(7).copy(L,Q):(K.push(M%1e14),Q+=7);Q=q/7}else throw m=!1,Error(s+"crypto unavailable");if(!m)for(;Q=10;M/=10,Q++);QP-1&&(M[q+1]==null&&(M[q+1]=0),M[q+1]+=M[q]/P|0,M[q]%=P)}return M.reverse()}return function(x,L,P,U,q){var M,Q,K,H,ue,he,de,Me,be=x.indexOf("."),xe=J,Be=X;for(be>=0&&(H=S,S=0,x=x.replace(".",""),Me=new l(L),he=Me.pow(x.length-be),S=H,Me.c=b(j(V(he.c),he.e,"0"),10,P,E),Me.e=Me.c.length),de=b(x,L,P,q?(M=I,E):(M=E,I)),K=H=de.length;de[--H]==0;de.pop());if(!de[0])return M.charAt(0);if(be<0?--K:(he.c=de,he.e=K,he.s=U,he=k(he,Me,xe,Be,P),de=he.c,ue=he.r,K=he.e),Q=K+xe+1,be=de[Q],H=P/2,ue=ue||Q<0||de[Q+1]!=null,ue=Be<4?(be!=null||ue)&&(Be==0||Be==(he.s<0?3:2)):be>H||be==H&&(Be==4||ue||Be==6&&de[Q-1]&1||Be==(he.s<0?8:7)),Q<1||!de[0])x=ue?j(M.charAt(1),-xe,M.charAt(0)):M.charAt(0);else{if(de.length=Q,ue)for(--P;++de[--Q]>P;)de[Q]=0,Q||(++K,de=[1].concat(de));for(H=de.length;!de[--H];);for(be=0,x="";be<=H;x+=M.charAt(de[be++]));x=j(x,K,M.charAt(0))}return x}}(),k=function(){function E(L,P,U){var q,M,Q,K,H=0,ue=L.length,he=P%w,de=P/w|0;for(L=L.slice();ue--;)Q=L[ue]%w,K=L[ue]/w|0,q=de*Q+K*he,M=he*Q+q%w*w+H,H=(M/U|0)+(q/w|0)+de*K,L[ue]=M%U;return H&&(L=[H].concat(L)),L}function b(L,P,U,q){var M,Q;if(U!=q)Q=U>q?1:-1;else for(M=Q=0;MP[M]?1:-1;break}return Q}function x(L,P,U,q){for(var M=0;U--;)L[U]-=M,M=L[U]1;L.splice(0,1));}return function(L,P,U,q,M){var Q,K,H,ue,he,de,Me,be,xe,Be,Ie,Pe,us,Ze,et,Ar,ze,Ue=L.s==P.s?1:-1,jt=L.c,Ce=P.c;if(!jt||!jt[0]||!Ce||!Ce[0])return new l(!L.s||!P.s||(jt?Ce&&jt[0]==Ce[0]:!Ce)?NaN:jt&&jt[0]==0||!Ce?Ue*0:Ue/0);for(be=new l(Ue),xe=be.c=[],K=L.e-P.e,Ue=U+K+1,M||(M=a,K=T(L.e/u)-T(P.e/u),Ue=Ue/u|0),H=0;Ce[H]==(jt[H]||0);H++);if(Ce[H]>(jt[H]||0)&&K--,Ue<0)xe.push(1),ue=!0;else{for(Ze=jt.length,Ar=Ce.length,H=0,Ue+=2,he=n(M/(Ce[0]+1)),he>1&&(Ce=E(Ce,he,M),jt=E(jt,he,M),Ar=Ce.length,Ze=jt.length),us=Ar,Be=jt.slice(0,Ar),Ie=Be.length;Ie=M/2&&et++;do{if(he=0,Q=b(Ce,Be,Ar,Ie),Q<0){if(Pe=Be[0],Ar!=Ie&&(Pe=Pe*M+(Be[1]||0)),he=n(Pe/et),he>1)for(he>=M&&(he=M-1),de=E(Ce,he,M),Me=de.length,Ie=Be.length;b(de,Be,Me,Ie)==1;)he--,x(de,Ar=10;Ue/=10,H++);ee(be,U+(be.e=H+K*u-1)+1,q,ue)}else be.e=K,be.r=+ue;return be}}();function C(E,b,x,L){var P,U,q,M,Q;if(x==null?x=X:$(x,0,8),!E.c)return E.toString();if(P=E.c[0],q=E.e,b==null)Q=V(E.c),Q=L==1||L==2&&(q<=A||q>=c)?Y(Q,q):j(Q,q,"0");else if(E=ee(new l(E),b,x),U=E.e,Q=V(E.c),M=Q.length,L==1||L==2&&(b<=U||U<=A)){for(;MM){if(--b>0)for(Q+=".";b--;Q+="0");}else if(b+=U-M,b>0)for(U+1==M&&(Q+=".");b--;Q+="0");return E.s<0&&P?"-"+Q:Q}function Z(E,b){for(var x,L=1,P=new l(E[0]);L=10;P/=10,L++);return(x=L+x*u-1)>g?E.c=E.e=null:x=10;M/=10,P++);if(U=b-P,U<0)U+=u,q=b,Q=ue[K=0],H=Q/he[P-q-1]%10|0;else if(K=i((U+1)/u),K>=ue.length)if(L){for(;ue.length<=K;ue.push(0));Q=H=0,P=1,U%=u,q=U-u+1}else break e;else{for(Q=M=ue[K],P=1;M>=10;M/=10,P++);U%=u,q=U-u+P,H=q<0?0:Q/he[P-q-1]%10|0}if(L=L||b<0||ue[K+1]!=null||(q<0?Q:Q%he[P-q-1]),L=x<4?(H||L)&&(x==0||x==(E.s<0?3:2)):H>5||H==5&&(x==4||L||x==6&&(U>0?q>0?Q/he[P-q]:0:ue[K-1])%10&1||x==(E.s<0?8:7)),b<1||!ue[0])return ue.length=0,L?(b-=E.e+1,ue[0]=he[(u-b%u)%u],E.e=-b||0):ue[0]=E.e=0,E;if(U==0?(ue.length=K,M=1,K--):(ue.length=K+1,M=he[u-U],ue[K]=q>0?n(Q/he[P-q]%he[q])*M:0),L)for(;;)if(K==0){for(U=1,q=ue[0];q>=10;q/=10,U++);for(q=ue[0]+=M,M=1;q>=10;q/=10,M++);U!=M&&(E.e++,ue[0]==a&&(ue[0]=1));break}else{if(ue[K]+=M,ue[K]!=a)break;ue[K--]=0,M=1}for(U=ue.length;ue[--U]===0;ue.pop());}E.e>g?E.c=E.e=null:E.e=c?Y(b,x):j(b,x,"0"),E.s<0?"-"+b:b)}return G.absoluteValue=G.abs=function(){var E=new l(this);return E.s<0&&(E.s=1),E},G.comparedTo=function(E,b){return z(this,new l(E,b))},G.decimalPlaces=G.dp=function(E,b){var x,L,P,U=this;if(E!=null)return $(E,0,N),b==null?b=X:$(b,0,8),ee(new l(U),E+U.e+1,b);if(!(x=U.c))return null;if(L=((P=x.length-1)-T(this.e/u))*u,P=x[P])for(;P%10==0;P/=10,L--);return L<0&&(L=0),L},G.dividedBy=G.div=function(E,b){return k(this,new l(E,b),J,X)},G.dividedToIntegerBy=G.idiv=function(E,b){return k(this,new l(E,b),0,1)},G.exponentiatedBy=G.pow=function(E,b){var x,L,P,U,q,M,Q,K,H,ue=this;if(E=new l(E),E.c&&!E.isInteger())throw Error(s+"Exponent not an integer: "+ae(E));if(b!=null&&(b=new l(b)),M=E.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!E.c||!E.c[0])return H=new l(Math.pow(+ae(ue),M?2-se(E):+ae(E))),b?H.mod(b):H;if(Q=E.s<0,b){if(b.c?!b.c[0]:!b.s)return new l(NaN);L=!Q&&ue.isInteger()&&b.isInteger(),L&&(ue=ue.mod(b))}else{if(E.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||M&&ue.c[1]>=24e7:ue.c[0]<8e13||M&&ue.c[0]<=9999975e7)))return U=ue.s<0&&se(E)?-0:0,ue.e>-1&&(U=1/U),new l(Q?1/U:U);S&&(U=i(S/u+2))}for(M?(x=new l(.5),Q&&(E.s=1),K=se(E)):(P=Math.abs(+ae(E)),K=P%2),H=new l(ce);;){if(K){if(H=H.times(ue),!H.c)break;U?H.c.length>U&&(H.c.length=U):L&&(H=H.mod(b))}if(P){if(P=n(P/2),P===0)break;K=P%2}else if(E=E.times(x),ee(E,E.e+1,1),E.e>14)K=se(E);else{if(P=+ae(E),P===0)break;K=P%2}ue=ue.times(ue),U?ue.c&&ue.c.length>U&&(ue.c.length=U):L&&(ue=ue.mod(b))}return L?H:(Q&&(H=ce.div(H)),b?H.mod(b):U?ee(H,S,X,q):H)},G.integerValue=function(E){var b=new l(this);return E==null?E=X:$(E,0,8),ee(b,b.e+1,E)},G.isEqualTo=G.eq=function(E,b){return z(this,new l(E,b))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(E,b){return z(this,new l(E,b))>0},G.isGreaterThanOrEqualTo=G.gte=function(E,b){return(b=z(this,new l(E,b)))===1||b===0},G.isInteger=function(){return!!this.c&&T(this.e/u)>this.c.length-2},G.isLessThan=G.lt=function(E,b){return z(this,new l(E,b))<0},G.isLessThanOrEqualTo=G.lte=function(E,b){return(b=z(this,new l(E,b)))===-1||b===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(E,b){var x,L,P,U,q=this,M=q.s;if(E=new l(E,b),b=E.s,!M||!b)return new l(NaN);if(M!=b)return E.s=-b,q.plus(E);var Q=q.e/u,K=E.e/u,H=q.c,ue=E.c;if(!Q||!K){if(!H||!ue)return H?(E.s=-b,E):new l(ue?q:NaN);if(!H[0]||!ue[0])return ue[0]?(E.s=-b,E):new l(H[0]?q:X==3?-0:0)}if(Q=T(Q),K=T(K),H=H.slice(),M=Q-K){for((U=M<0)?(M=-M,P=H):(K=Q,P=ue),P.reverse(),b=M;b--;P.push(0));P.reverse()}else for(L=(U=(M=H.length)<(b=ue.length))?M:b,M=b=0;b0)for(;b--;H[x++]=0);for(b=a-1;L>M;){if(H[--L]=0;){for(x=0,he=Pe[P]%xe,de=Pe[P]/xe|0,q=Q,U=P+q;U>P;)K=Ie[--q]%xe,H=Ie[q]/xe|0,M=de*K+H*he,K=he*K+M%xe*xe+Me[U]+x,x=(K/be|0)+(M/xe|0)+de*H,Me[U--]=K%be;Me[U]=x}return x?++L:Me.splice(0,1),ie(E,Me,L)},G.negated=function(){var E=new l(this);return E.s=-E.s||null,E},G.plus=function(E,b){var x,L=this,P=L.s;if(E=new l(E,b),b=E.s,!P||!b)return new l(NaN);if(P!=b)return E.s=-b,L.minus(E);var U=L.e/u,q=E.e/u,M=L.c,Q=E.c;if(!U||!q){if(!M||!Q)return new l(P/0);if(!M[0]||!Q[0])return Q[0]?E:new l(M[0]?L:P*0)}if(U=T(U),q=T(q),M=M.slice(),P=U-q){for(P>0?(q=U,x=Q):(P=-P,x=M),x.reverse();P--;x.push(0));x.reverse()}for(P=M.length,b=Q.length,P-b<0&&(x=Q,Q=M,M=x,b=P),P=0;b;)P=(M[--b]=M[b]+Q[b]+P)/a|0,M[b]=a===M[b]?0:M[b]%a;return P&&(M=[P].concat(M),++q),ie(E,M,q)},G.precision=G.sd=function(E,b){var x,L,P,U=this;if(E!=null&&E!==!!E)return $(E,1,N),b==null?b=X:$(b,0,8),ee(new l(U),E,b);if(!(x=U.c))return null;if(P=x.length-1,L=P*u+1,P=x[P]){for(;P%10==0;P/=10,L--);for(P=x[0];P>=10;P/=10,L++);}return E&&U.e+1>L&&(L=U.e+1),L},G.shiftedBy=function(E){return $(E,-h,h),this.times("1e"+E)},G.squareRoot=G.sqrt=function(){var E,b,x,L,P,U=this,q=U.c,M=U.s,Q=U.e,K=J+4,H=new l("0.5");if(M!==1||!q||!q[0])return new l(!M||M<0&&(!q||q[0])?NaN:q?U:1/0);if(M=Math.sqrt(+ae(U)),M==0||M==1/0?(b=V(q),(b.length+Q)%2==0&&(b+="0"),M=Math.sqrt(+b),Q=T((Q+1)/2)-(Q<0||Q%2),M==1/0?b="5e"+Q:(b=M.toExponential(),b=b.slice(0,b.indexOf("e")+1)+Q),x=new l(b)):x=new l(M+""),x.c[0]){for(Q=x.e,M=Q+K,M<3&&(M=0);;)if(P=x,x=H.times(P.plus(k(U,P,K,1))),V(P.c).slice(0,M)===(b=V(x.c)).slice(0,M))if(x.e0&&Me>0){for(U=Me%M||M,H=de.substr(0,U);U0&&(H+=K+de.slice(U)),he&&(H="-"+H)}L=ue?H+(x.decimalSeparator||"")+((Q=+x.fractionGroupSize)?ue.replace(new RegExp("\\d{"+Q+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):ue):H}return(x.prefix||"")+L+(x.suffix||"")},G.toFraction=function(E){var b,x,L,P,U,q,M,Q,K,H,ue,he,de=this,Me=de.c;if(E!=null&&(M=new l(E),!M.isInteger()&&(M.c||M.s!==1)||M.lt(ce)))throw Error(s+"Argument "+(M.isInteger()?"out of range: ":"not an integer: ")+ae(M));if(!Me)return new l(de);for(b=new l(ce),K=x=new l(ce),L=Q=new l(ce),he=V(Me),U=b.e=he.length-de.e-1,b.c[0]=p[(q=U%u)<0?u+q:q],E=!E||M.comparedTo(b)>0?U>0?b:K:M,q=g,g=1/0,M=new l(he),Q.c[0]=0;H=k(M,b,0,1),P=x.plus(H.times(L)),P.comparedTo(E)!=1;)x=L,L=P,K=Q.plus(H.times(P=K)),Q=P,b=M.minus(H.times(P=b)),M=P;return P=k(E.minus(x),L,0,1),Q=Q.plus(P.times(K)),x=x.plus(P.times(L)),Q.s=K.s=de.s,U=U*2,ue=k(K,L,U,X).minus(de).abs().comparedTo(k(Q,x,U,X).minus(de).abs())<1?[K,L]:[Q,x],g=q,ue},G.toNumber=function(){return+ae(this)},G.toPrecision=function(E,b){return E!=null&&$(E,1,N),C(this,E,b,2)},G.toString=function(E){var b,x=this,L=x.s,P=x.e;return P===null?L?(b="Infinity",L<0&&(b="-"+b)):b="NaN":(E==null?b=P<=A||P>=c?Y(V(x.c),P):j(V(x.c),P,"0"):E===10?(x=ee(new l(x),J+P+1,X),b=j(V(x.c),x.e,"0")):($(E,2,I.length,"Base"),b=R(j(V(x.c),P,"0"),10,E,L,!0)),L<0&&x.c[0]&&(b="-"+b)),b},G.valueOf=G.toJSON=function(){return ae(this)},G._isBigNumber=!0,W!=null&&l.set(W),l}function T(W){var k=W|0;return W>0||W===k?k:k-1}function V(W){for(var k,R,F=1,G=W.length,ce=W[0]+"";Fc^R?1:-1;for(X=(A=G.length)<(c=ce.length)?A:c,J=0;Jce[J]^R?1:-1;return A==c?0:A>c^R?1:-1}function $(W,k,R,F){if(WR||W!==n(W))throw Error(s+(F||"Argument")+(typeof W=="number"?WR?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function se(W){var k=W.c.length-1;return T(W.e/u)==k&&W.c[k]%2!=0}function Y(W,k){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(k<0?"e":"e+")+k}function j(W,k,R){var F,G;if(k<0){for(G=R+".";++k;G+=R);W=G+W}else if(F=W.length,++k>F){for(G=R,k-=F;--k;G+=R);W+=G}else k{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.ErrGasLimitShouldBe0ForInnerTransaction=ge.ErrInvalidRelayedV2BuilderArguments=ge.ErrInvalidRelayedV1BuilderArguments=ge.ErrNotImplemented=ge.ErrContractInteraction=ge.ErrCodec=ge.ErrCannotParseTransactionOutcome=ge.ErrCannotParseContractResults=ge.ErrMissingFieldOnEnum=ge.ErrMissingFieldOnStruct=ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ge.ErrTypingSystem=ge.ErrMock=ge.ErrContractHasNoAddress=ge.ErrContract=ge.ErrExpectedTransactionEventsNotFound=ge.ErrExpectedTransactionStatusNotReached=ge.ErrTransactionWatcherTimeout=ge.ErrAsyncTimerAborted=ge.ErrAsyncTimerAlreadyRunning=ge.ErrInvalidFunctionName=ge.ErrSignatureCannotCreate=ge.ErrTransactionOptionsInvalid=ge.ErrTransactionVersionInvalid=ge.ErrNonceInvalid=ge.ErrNotEnoughGas=ge.ErrAddressEmpty=ge.ErrAddressBadHrp=ge.ErrAddressCannotCreate=ge.ErrUnexpectedCondition=ge.ErrInvariantFailed=ge.ErrBadType=ge.ErrUnsupportedOperation=ge.ErrInvalidArgument=ge.Err=void 0;var Re=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}};ge.Err=Re;var T0=class extends Re{constructor(e,t){super(`Invalid argument: ${e}`,t)}};ge.ErrInvalidArgument=T0;var N0=class extends Re{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};ge.ErrUnsupportedOperation=N0;var D0=class extends Re{constructor(e,t,i){super(`Bad type of "${e}": ${i}. Expected type: ${t}`)}};ge.ErrBadType=D0;var O0=class extends Re{constructor(e){super(`Invariant failed: [${e}]`)}};ge.ErrInvariantFailed=O0;var P0=class extends Re{constructor(e){super(`Unexpected condition: [${e}]`)}};ge.ErrUnexpectedCondition=P0;var B0=class extends Re{constructor(e,t){let i=`Cannot create address from: ${e}`;super(i,t)}};ge.ErrAddressCannotCreate=B0;var M0=class extends Re{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};ge.ErrAddressBadHrp=M0;var R0=class extends Re{constructor(){super("Address is empty")}};ge.ErrAddressEmpty=R0;var L0=class extends Re{constructor(e){super(`Not enough gas provided: ${e}`)}};ge.ErrNotEnoughGas=L0;var F0=class extends Re{constructor(e){super(`Invalid nonce: ${e}`)}};ge.ErrNonceInvalid=F0;var U0=class extends Re{constructor(e){super(`Invalid transaction version: ${e}`)}};ge.ErrTransactionVersionInvalid=U0;var q0=class extends Re{constructor(e){super(`Invalid transaction options: ${e}`)}};ge.ErrTransactionOptionsInvalid=q0;var V0=class extends Re{constructor(e,t){let i=`Cannot create signature from: ${e}`;super(i,t)}};ge.ErrSignatureCannotCreate=V0;var H0=class extends Re{constructor(){super("Invalid function name")}};ge.ErrInvalidFunctionName=H0;var Q0=class extends Re{constructor(){super("Async timer already running")}};ge.ErrAsyncTimerAlreadyRunning=Q0;var j0=class extends Re{constructor(){super("Async timer aborted")}};ge.ErrAsyncTimerAborted=j0;var G0=class extends Re{constructor(){super("TransactionWatcher has timed out")}};ge.ErrTransactionWatcherTimeout=G0;var K0=class extends Re{constructor(){super("Expected transaction status not reached")}};ge.ErrExpectedTransactionStatusNotReached=K0;var z0=class extends Re{constructor(){super("Expected transaction events not found")}};ge.ErrExpectedTransactionEventsNotFound=z0;var Ql=class extends Re{constructor(e){super(e)}};ge.ErrContract=Ql;var k0=class extends Ql{constructor(){super(` +var A8=Object.create;var Ku=Object.defineProperty,I8=Object.defineProperties,_8=Object.getOwnPropertyDescriptor,b8=Object.getOwnPropertyDescriptors,C8=Object.getOwnPropertyNames,TE=Object.getOwnPropertySymbols,S8=Object.getPrototypeOf,DE=Object.prototype.hasOwnProperty,x8=Object.prototype.propertyIsEnumerable;var NE=(r,e,t)=>e in r?Ku(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bo=(r,e)=>{for(var t in e||={})DE.call(e,t)&&NE(r,t,e[t]);if(TE)for(var t of TE(e))x8.call(e,t)&&NE(r,t,e[t]);return r},OE=(r,e)=>I8(r,b8(e));var PE=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var me=(r,e)=>()=>(r&&(e=r(r=0)),e);var B=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ot=(r,e)=>{for(var t in e)Ku(r,t,{get:e[t],enumerable:!0})},Ll=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C8(e))!DE.call(r,n)&&n!==t&&Ku(r,n,{get:()=>e[n],enumerable:!(i=_8(e,n))||i.enumerable});return r},er=(r,e,t)=>(Ll(r,e,"default"),t&&Ll(t,e,"default")),_e=(r,e,t)=>(t=r!=null?A8(S8(r)):{},Ll(e||!r||!r.__esModule?Ku(t,"default",{value:r,enumerable:!0}):t,r)),at=r=>Ll(Ku({},"__esModule",{value:!0}),r);var Te=(r,e,t)=>new Promise((i,n)=>{var s=u=>{try{a(t.next(u))}catch(h){n(h)}},o=u=>{try{a(t.throw(u))}catch(h){n(h)}},a=u=>u.done?i(u.value):Promise.resolve(u.value).then(s,o);a((t=t.apply(r,e)).next())});var y0=B(Fl=>{"use strict";f();Fl.byteLength=N8;Fl.toByteArray=O8;Fl.fromByteArray=M8;var ii=[],xr=[],T8=typeof Uint8Array<"u"?Uint8Array:Array,g0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(cs=0,BE=g0.length;cs0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function N8(r){var e=ME(r),t=e[0],i=e[1];return(t+i)*3/4-i}function D8(r,e,t){return(e+t)*3/4-t}function O8(r){var e,t=ME(r),i=t[0],n=t[1],s=new T8(D8(r,i,n)),o=0,a=n>0?i-4:i,u;for(u=0;u>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=xr[r.charCodeAt(u)]<<2|xr[r.charCodeAt(u+1)]>>4,s[o++]=e&255),n===1&&(e=xr[r.charCodeAt(u)]<<10|xr[r.charCodeAt(u+1)]<<4|xr[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function P8(r){return ii[r>>18&63]+ii[r>>12&63]+ii[r>>6&63]+ii[r&63]}function B8(r,e,t){for(var i,n=[],s=e;sa?a:o+s));return i===1?(e=r[t-1],n.push(ii[e>>2]+ii[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(ii[e>>10]+ii[e>>4&63]+ii[e<<2&63]+"=")),n.join("")}});var w0=B(m0=>{f();m0.read=function(r,e,t,i,n){var s,o,a=n*8-i-1,u=(1<>1,p=-7,w=t?n-1:0,N=t?-1:1,O=r[e+w];for(w+=N,s=O&(1<<-p)-1,O>>=-p,p+=a;p>0;s=s*256+r[e+w],w+=N,p-=8);for(o=s&(1<<-p)-1,s>>=-p,p+=i;p>0;o=o*256+r[e+w],w+=N,p-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(O?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-h}return(O?-1:1)*o*Math.pow(2,s-i)};m0.write=function(r,e,t,i,n,s){var o,a,u,h=s*8-n-1,p=(1<>1,N=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=i?0:s-1,T=i?1:-1,V=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=p):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+w>=1?e+=N/u:e+=N*Math.pow(2,1-w),e*u>=2&&(o++,u/=2),o+w>=p?(a=0,o=p):o+w>=1?(a=(e*u-1)*Math.pow(2,n),o=o+w):(a=e*Math.pow(2,w-1)*Math.pow(2,n),o=0));n>=8;r[t+O]=a&255,O+=T,a/=256,n-=8);for(o=o<0;r[t+O]=o&255,O+=T,o/=256,h-=8);r[t+O-T]|=V*128}});var kE=B(So=>{"use strict";f();var v0=y0(),Co=w0(),RE=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;So.Buffer=oe;So.SlowBuffer=V8;So.INSPECT_MAX_BYTES=50;var Ul=2147483647;So.kMaxLength=Ul;oe.TYPED_ARRAY_SUPPORT=R8();!oe.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 R8(){try{var r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(oe.prototype,"parent",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.buffer}});Object.defineProperty(oe.prototype,"offset",{enumerable:!0,get:function(){if(oe.isBuffer(this))return this.byteOffset}});function Qi(r){if(r>Ul)throw new RangeError('The value "'+r+'" is invalid for option "size"');var e=new Uint8Array(r);return Object.setPrototypeOf(e,oe.prototype),e}function oe(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _0(r)}return UE(r,e,t)}oe.poolSize=8192;function UE(r,e,t){if(typeof r=="string")return F8(r,e);if(ArrayBuffer.isView(r))return U8(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(ni(r,ArrayBuffer)||r&&ni(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ni(r,SharedArrayBuffer)||r&&ni(r.buffer,SharedArrayBuffer)))return A0(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return oe.from(i,e,t);var n=q8(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return oe.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}oe.from=function(r,e,t){return UE(r,e,t)};Object.setPrototypeOf(oe.prototype,Uint8Array.prototype);Object.setPrototypeOf(oe,Uint8Array);function qE(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function L8(r,e,t){return qE(r),r<=0?Qi(r):e!==void 0?typeof t=="string"?Qi(r).fill(e,t):Qi(r).fill(e):Qi(r)}oe.alloc=function(r,e,t){return L8(r,e,t)};function _0(r){return qE(r),Qi(r<0?0:b0(r)|0)}oe.allocUnsafe=function(r){return _0(r)};oe.allocUnsafeSlow=function(r){return _0(r)};function F8(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!oe.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var t=VE(r,e)|0,i=Qi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function E0(r){for(var e=r.length<0?0:b0(r.length)|0,t=Qi(e),i=0;i=Ul)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ul.toString(16)+" bytes");return r|0}function V8(r){return+r!=r&&(r=0),oe.alloc(+r)}oe.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==oe.prototype};oe.compare=function(e,t){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),ni(t,Uint8Array)&&(t=oe.from(t,t.offset,t.byteLength)),!oe.isBuffer(e)||!oe.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var i=e.length,n=t.length,s=0,o=Math.min(i,n);sn.length?oe.from(o).copy(n,s):Uint8Array.prototype.set.call(n,o,s);else if(oe.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function VE(r,e){if(oe.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||ni(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);var t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return I0(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return zE(r).length;default:if(n)return i?-1:I0(r).length;e=(""+e).toLowerCase(),n=!0}}oe.byteLength=VE;function H8(r,e,t){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return J8(this,e,t);case"utf8":case"utf-8":return QE(this,e,t);case"ascii":return $8(this,e,t);case"latin1":case"binary":return Y8(this,e,t);case"base64":return k8(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X8(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}oe.prototype._isBuffer=!0;function ls(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}oe.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 t=0;tt&&(e+=" ... "),""};RE&&(oe.prototype[RE]=oe.prototype.inspect);oe.prototype.compare=function(e,t,i,n,s){if(ni(e,Uint8Array)&&(e=oe.from(e,e.offset,e.byteLength)),!oe.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;for(var o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i),w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,C0(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=oe.from(e,i)),oe.isBuffer(e))return e.length===0?-1:LE(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):LE(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function LE(r,e,t,i,n){var s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(O,T){return s===1?O[T]:O.readUInt16BE(T*s)}var h;if(n){var p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){for(var w=!0,N=0;Nn&&(i=n)):i=n;var s=e.length;i>s/2&&(i=s/2);for(var o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return Q8(this,e,t,i);case"utf8":case"utf-8":return j8(this,e,t,i);case"ascii":case"latin1":case"binary":return G8(this,e,t,i);case"base64":return K8(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z8(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};oe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k8(r,e,t){return e===0&&t===r.length?v0.fromByteArray(r):v0.fromByteArray(r.slice(e,t))}function QE(r,e,t){t=Math.min(r.length,t);for(var i=[],n=e;n239?4:s>223?3:s>191?2:1;if(n+a<=t){var u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return W8(i)}var FE=4096;function W8(r){var e=r.length;if(e<=FE)return String.fromCharCode.apply(String,r);for(var t="",i=0;ii)&&(t=i);for(var n="",s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}oe.prototype.readUintLE=oe.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n};oe.prototype.readUint8=oe.prototype.readUInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]};oe.prototype.readUint16LE=oe.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]|this[e+1]<<8};oe.prototype.readUint16BE=oe.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||Gt(e,2,this.length),this[e]<<8|this[e+1]};oe.prototype.readUint32LE=oe.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};oe.prototype.readUint32BE=oe.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};oe.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=this[e],s=1,o=0;++o=s&&(n-=Math.pow(2,8*t)),n};oe.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||Gt(e,t,this.length);for(var n=t,s=1,o=this[e+--n];n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};oe.prototype.readInt8=function(e,t){return e=e>>>0,t||Gt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};oe.prototype.readInt16LE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt16BE=function(e,t){e=e>>>0,t||Gt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};oe.prototype.readInt32LE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};oe.prototype.readInt32BE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};oe.prototype.readFloatLE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),Co.read(this,e,!0,23,4)};oe.prototype.readFloatBE=function(e,t){return e=e>>>0,t||Gt(e,4,this.length),Co.read(this,e,!1,23,4)};oe.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),Co.read(this,e,!0,52,8)};oe.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||Gt(e,8,this.length),Co.read(this,e,!1,52,8)};function pr(r,e,t,i,n,s){if(!oe.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}oe.prototype.writeUintLE=oe.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=1,a=0;for(this[t]=e&255;++a>>0,i=i>>>0,!n){var s=Math.pow(2,8*i)-1;pr(this,e,t,i,s,0)}var o=i-1,a=1;for(this[t+o]=e&255;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+i};oe.prototype.writeUint8=oe.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,255,0),this[t]=e&255,t+1};oe.prototype.writeUint16LE=oe.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeUint16BE=oe.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeUint32LE=oe.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};oe.prototype.writeUint32BE=oe.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};oe.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=0,a=1,u=0;for(this[t]=e&255;++o>0)-u&255;return t+i};oe.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){var s=Math.pow(2,8*i-1);pr(this,e,t,i,s-1,-s)}var o=i-1,a=1,u=0;for(this[t+o]=e&255;--o>=0&&(a*=256);)e<0&&u===0&&this[t+o+1]!==0&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+i};oe.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};oe.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};oe.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};oe.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};oe.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||pr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function jE(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function GE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,4,34028234663852886e22,-34028234663852886e22),Co.write(r,e,t,i,23,4),t+4}oe.prototype.writeFloatLE=function(e,t,i){return GE(this,e,t,!0,i)};oe.prototype.writeFloatBE=function(e,t,i){return GE(this,e,t,!1,i)};function KE(r,e,t,i,n){return e=+e,t=t>>>0,n||jE(r,e,t,8,17976931348623157e292,-17976931348623157e292),Co.write(r,e,t,i,52,8),t+8}oe.prototype.writeDoubleLE=function(e,t,i){return KE(this,e,t,!0,i)};oe.prototype.writeDoubleBE=function(e,t,i){return KE(this,e,t,!1,i)};oe.prototype.copy=function(e,t,i,n){if(!oe.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function tP(r){for(var e=[],t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function zE(r){return v0.toByteArray(eP(r))}function ql(r,e,t,i){for(var n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function ni(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function C0(r){return r!==r}var iP=function(){for(var r="0123456789abcdef",e=new Array(256),t=0;t<16;++t)for(var i=t*16,n=0;n<16;++n)e[i+n]=r[t]+r[n];return e}()});var XE=B((lz,JE)=>{f();var dt=JE.exports={},si,oi;function S0(){throw new Error("setTimeout has not been defined")}function x0(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?si=setTimeout:si=S0}catch{si=S0}try{typeof clearTimeout=="function"?oi=clearTimeout:oi=x0}catch{oi=x0}})();function WE(r){if(si===setTimeout)return setTimeout(r,0);if((si===S0||!si)&&setTimeout)return si=setTimeout,setTimeout(r,0);try{return si(r,0)}catch{try{return si.call(null,r,0)}catch{return si.call(this,r,0)}}}function nP(r){if(oi===clearTimeout)return clearTimeout(r);if((oi===x0||!oi)&&clearTimeout)return oi=clearTimeout,clearTimeout(r);try{return oi(r)}catch{try{return oi.call(null,r)}catch{return oi.call(this,r)}}}var ji=[],xo=!1,fs,Vl=-1;function sP(){!xo||!fs||(xo=!1,fs.length?ji=fs.concat(ji):Vl=-1,ji.length&&$E())}function $E(){if(!xo){var r=WE(sP);xo=!0;for(var e=ji.length;e;){for(fs=ji,ji=[];++Vl1)for(var t=1;t{y=_e(kE()),_=_e(XE()),oP=function(r){function e(){var i=this||self;return delete r.prototype.__magic__,i}if(typeof globalThis=="object")return globalThis;if(this)return e();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:e});var t=__magic__;return t}(Object),global=oP});var jr=B((ZE,Hl)=>{f();(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,n=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",a=1e14,u=14,h=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],w=1e7,N=1e9;function O(W){var k,R,F,G=l.prototype={constructor:l,toString:null,valueOf:null},ce=new l(1),J=20,X=4,A=-7,c=21,d=-1e7,g=1e7,m=!1,v=1,S=0,D={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz";function l(E,b){var x,L,P,U,q,M,Q,K,H=this;if(!(H instanceof l))return new l(E,b);if(b==null){if(E&&E._isBigNumber===!0){H.s=E.s,!E.c||E.e>g?H.c=H.e=null:E.e=10;q/=10,U++);U>g?H.c=H.e=null:(H.e=U,H.c=[E]);return}K=String(E)}else{if(!t.test(K=String(E)))return F(H,K,M);H.s=K.charCodeAt(0)==45?(K=K.slice(1),-1):1}(U=K.indexOf("."))>-1&&(K=K.replace(".","")),(q=K.search(/e/i))>0?(U<0&&(U=q),U+=+K.slice(q+1),K=K.substring(0,q)):U<0&&(U=K.length)}else{if($(b,2,I.length,"Base"),b==10)return H=new l(E),ee(H,J+H.e+1,X);if(K=String(E),M=typeof E=="number"){if(E*0!=0)return F(H,K,M,b);if(H.s=1/E<0?(K=K.slice(1),-1):1,l.DEBUG&&K.replace(/^0\.0*|\./,"").length>15)throw Error(o+E)}else H.s=K.charCodeAt(0)===45?(K=K.slice(1),-1):1;for(x=I.slice(0,b),U=q=0,Q=K.length;qU){U=Q;continue}}else if(!P&&(K==K.toUpperCase()&&(K=K.toLowerCase())||K==K.toLowerCase()&&(K=K.toUpperCase()))){P=!0,q=-1,U=0;continue}return F(H,String(E),M,b)}M=!1,K=R(K,b,10,H.s),(U=K.indexOf("."))>-1?K=K.replace(".",""):U=K.length}for(q=0;K.charCodeAt(q)===48;q++);for(Q=K.length;K.charCodeAt(--Q)===48;);if(K=K.slice(q,++Q)){if(Q-=q,M&&l.DEBUG&&Q>15&&(E>h||E!==n(E)))throw Error(o+H.s*E);if((U=U-q-1)>g)H.c=H.e=null;else if(U=-N&&P<=N&&P===n(P)){if(L[0]===0){if(P===0&&L.length===1)return!0;break e}if(b=(P+1)%u,b<1&&(b+=u),String(L[0]).length==b){for(b=0;b=a||x!==n(x))break e;if(x!==0)return!0}}}else if(L===null&&P===null&&(U===null||U===1||U===-1))return!0;throw Error(s+"Invalid BigNumber: "+E)},l.maximum=l.max=function(){return Z(arguments,G.lt)},l.minimum=l.min=function(){return Z(arguments,G.gt)},l.random=function(){var E=9007199254740992,b=Math.random()*E&2097151?function(){return n(Math.random()*E)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(x){var L,P,U,q,M,Q=0,K=[],H=new l(ce);if(x==null?x=J:$(x,0,N),q=i(x/u),m)if(crypto.getRandomValues){for(L=crypto.getRandomValues(new Uint32Array(q*=2));Q>>11),M>=9e15?(P=crypto.getRandomValues(new Uint32Array(2)),L[Q]=P[0],L[Q+1]=P[1]):(K.push(M%1e14),Q+=2);Q=q/2}else if(crypto.randomBytes){for(L=crypto.randomBytes(q*=7);Q=9e15?crypto.randomBytes(7).copy(L,Q):(K.push(M%1e14),Q+=7);Q=q/7}else throw m=!1,Error(s+"crypto unavailable");if(!m)for(;Q=10;M/=10,Q++);QP-1&&(M[q+1]==null&&(M[q+1]=0),M[q+1]+=M[q]/P|0,M[q]%=P)}return M.reverse()}return function(x,L,P,U,q){var M,Q,K,H,ue,he,de,Re,be=x.indexOf("."),xe=J,Be=X;for(be>=0&&(H=S,S=0,x=x.replace(".",""),Re=new l(L),he=Re.pow(x.length-be),S=H,Re.c=b(j(V(he.c),he.e,"0"),10,P,E),Re.e=Re.c.length),de=b(x,L,P,q?(M=I,E):(M=E,I)),K=H=de.length;de[--H]==0;de.pop());if(!de[0])return M.charAt(0);if(be<0?--K:(he.c=de,he.e=K,he.s=U,he=k(he,Re,xe,Be,P),de=he.c,ue=he.r,K=he.e),Q=K+xe+1,be=de[Q],H=P/2,ue=ue||Q<0||de[Q+1]!=null,ue=Be<4?(be!=null||ue)&&(Be==0||Be==(he.s<0?3:2)):be>H||be==H&&(Be==4||ue||Be==6&&de[Q-1]&1||Be==(he.s<0?8:7)),Q<1||!de[0])x=ue?j(M.charAt(1),-xe,M.charAt(0)):M.charAt(0);else{if(de.length=Q,ue)for(--P;++de[--Q]>P;)de[Q]=0,Q||(++K,de=[1].concat(de));for(H=de.length;!de[--H];);for(be=0,x="";be<=H;x+=M.charAt(de[be++]));x=j(x,K,M.charAt(0))}return x}}(),k=function(){function E(L,P,U){var q,M,Q,K,H=0,ue=L.length,he=P%w,de=P/w|0;for(L=L.slice();ue--;)Q=L[ue]%w,K=L[ue]/w|0,q=de*Q+K*he,M=he*Q+q%w*w+H,H=(M/U|0)+(q/w|0)+de*K,L[ue]=M%U;return H&&(L=[H].concat(L)),L}function b(L,P,U,q){var M,Q;if(U!=q)Q=U>q?1:-1;else for(M=Q=0;MP[M]?1:-1;break}return Q}function x(L,P,U,q){for(var M=0;U--;)L[U]-=M,M=L[U]1;L.splice(0,1));}return function(L,P,U,q,M){var Q,K,H,ue,he,de,Re,be,xe,Be,Ie,Pe,us,Ze,et,Ar,ze,Ue=L.s==P.s?1:-1,jt=L.c,Ce=P.c;if(!jt||!jt[0]||!Ce||!Ce[0])return new l(!L.s||!P.s||(jt?Ce&&jt[0]==Ce[0]:!Ce)?NaN:jt&&jt[0]==0||!Ce?Ue*0:Ue/0);for(be=new l(Ue),xe=be.c=[],K=L.e-P.e,Ue=U+K+1,M||(M=a,K=T(L.e/u)-T(P.e/u),Ue=Ue/u|0),H=0;Ce[H]==(jt[H]||0);H++);if(Ce[H]>(jt[H]||0)&&K--,Ue<0)xe.push(1),ue=!0;else{for(Ze=jt.length,Ar=Ce.length,H=0,Ue+=2,he=n(M/(Ce[0]+1)),he>1&&(Ce=E(Ce,he,M),jt=E(jt,he,M),Ar=Ce.length,Ze=jt.length),us=Ar,Be=jt.slice(0,Ar),Ie=Be.length;Ie=M/2&&et++;do{if(he=0,Q=b(Ce,Be,Ar,Ie),Q<0){if(Pe=Be[0],Ar!=Ie&&(Pe=Pe*M+(Be[1]||0)),he=n(Pe/et),he>1)for(he>=M&&(he=M-1),de=E(Ce,he,M),Re=de.length,Ie=Be.length;b(de,Be,Re,Ie)==1;)he--,x(de,Ar=10;Ue/=10,H++);ee(be,U+(be.e=H+K*u-1)+1,q,ue)}else be.e=K,be.r=+ue;return be}}();function C(E,b,x,L){var P,U,q,M,Q;if(x==null?x=X:$(x,0,8),!E.c)return E.toString();if(P=E.c[0],q=E.e,b==null)Q=V(E.c),Q=L==1||L==2&&(q<=A||q>=c)?Y(Q,q):j(Q,q,"0");else if(E=ee(new l(E),b,x),U=E.e,Q=V(E.c),M=Q.length,L==1||L==2&&(b<=U||U<=A)){for(;MM){if(--b>0)for(Q+=".";b--;Q+="0");}else if(b+=U-M,b>0)for(U+1==M&&(Q+=".");b--;Q+="0");return E.s<0&&P?"-"+Q:Q}function Z(E,b){for(var x,L=1,P=new l(E[0]);L=10;P/=10,L++);return(x=L+x*u-1)>g?E.c=E.e=null:x=10;M/=10,P++);if(U=b-P,U<0)U+=u,q=b,Q=ue[K=0],H=Q/he[P-q-1]%10|0;else if(K=i((U+1)/u),K>=ue.length)if(L){for(;ue.length<=K;ue.push(0));Q=H=0,P=1,U%=u,q=U-u+1}else break e;else{for(Q=M=ue[K],P=1;M>=10;M/=10,P++);U%=u,q=U-u+P,H=q<0?0:Q/he[P-q-1]%10|0}if(L=L||b<0||ue[K+1]!=null||(q<0?Q:Q%he[P-q-1]),L=x<4?(H||L)&&(x==0||x==(E.s<0?3:2)):H>5||H==5&&(x==4||L||x==6&&(U>0?q>0?Q/he[P-q]:0:ue[K-1])%10&1||x==(E.s<0?8:7)),b<1||!ue[0])return ue.length=0,L?(b-=E.e+1,ue[0]=he[(u-b%u)%u],E.e=-b||0):ue[0]=E.e=0,E;if(U==0?(ue.length=K,M=1,K--):(ue.length=K+1,M=he[u-U],ue[K]=q>0?n(Q/he[P-q]%he[q])*M:0),L)for(;;)if(K==0){for(U=1,q=ue[0];q>=10;q/=10,U++);for(q=ue[0]+=M,M=1;q>=10;q/=10,M++);U!=M&&(E.e++,ue[0]==a&&(ue[0]=1));break}else{if(ue[K]+=M,ue[K]!=a)break;ue[K--]=0,M=1}for(U=ue.length;ue[--U]===0;ue.pop());}E.e>g?E.c=E.e=null:E.e=c?Y(b,x):j(b,x,"0"),E.s<0?"-"+b:b)}return G.absoluteValue=G.abs=function(){var E=new l(this);return E.s<0&&(E.s=1),E},G.comparedTo=function(E,b){return z(this,new l(E,b))},G.decimalPlaces=G.dp=function(E,b){var x,L,P,U=this;if(E!=null)return $(E,0,N),b==null?b=X:$(b,0,8),ee(new l(U),E+U.e+1,b);if(!(x=U.c))return null;if(L=((P=x.length-1)-T(this.e/u))*u,P=x[P])for(;P%10==0;P/=10,L--);return L<0&&(L=0),L},G.dividedBy=G.div=function(E,b){return k(this,new l(E,b),J,X)},G.dividedToIntegerBy=G.idiv=function(E,b){return k(this,new l(E,b),0,1)},G.exponentiatedBy=G.pow=function(E,b){var x,L,P,U,q,M,Q,K,H,ue=this;if(E=new l(E),E.c&&!E.isInteger())throw Error(s+"Exponent not an integer: "+ae(E));if(b!=null&&(b=new l(b)),M=E.e>14,!ue.c||!ue.c[0]||ue.c[0]==1&&!ue.e&&ue.c.length==1||!E.c||!E.c[0])return H=new l(Math.pow(+ae(ue),M?2-se(E):+ae(E))),b?H.mod(b):H;if(Q=E.s<0,b){if(b.c?!b.c[0]:!b.s)return new l(NaN);L=!Q&&ue.isInteger()&&b.isInteger(),L&&(ue=ue.mod(b))}else{if(E.e>9&&(ue.e>0||ue.e<-1||(ue.e==0?ue.c[0]>1||M&&ue.c[1]>=24e7:ue.c[0]<8e13||M&&ue.c[0]<=9999975e7)))return U=ue.s<0&&se(E)?-0:0,ue.e>-1&&(U=1/U),new l(Q?1/U:U);S&&(U=i(S/u+2))}for(M?(x=new l(.5),Q&&(E.s=1),K=se(E)):(P=Math.abs(+ae(E)),K=P%2),H=new l(ce);;){if(K){if(H=H.times(ue),!H.c)break;U?H.c.length>U&&(H.c.length=U):L&&(H=H.mod(b))}if(P){if(P=n(P/2),P===0)break;K=P%2}else if(E=E.times(x),ee(E,E.e+1,1),E.e>14)K=se(E);else{if(P=+ae(E),P===0)break;K=P%2}ue=ue.times(ue),U?ue.c&&ue.c.length>U&&(ue.c.length=U):L&&(ue=ue.mod(b))}return L?H:(Q&&(H=ce.div(H)),b?H.mod(b):U?ee(H,S,X,q):H)},G.integerValue=function(E){var b=new l(this);return E==null?E=X:$(E,0,8),ee(b,b.e+1,E)},G.isEqualTo=G.eq=function(E,b){return z(this,new l(E,b))===0},G.isFinite=function(){return!!this.c},G.isGreaterThan=G.gt=function(E,b){return z(this,new l(E,b))>0},G.isGreaterThanOrEqualTo=G.gte=function(E,b){return(b=z(this,new l(E,b)))===1||b===0},G.isInteger=function(){return!!this.c&&T(this.e/u)>this.c.length-2},G.isLessThan=G.lt=function(E,b){return z(this,new l(E,b))<0},G.isLessThanOrEqualTo=G.lte=function(E,b){return(b=z(this,new l(E,b)))===-1||b===0},G.isNaN=function(){return!this.s},G.isNegative=function(){return this.s<0},G.isPositive=function(){return this.s>0},G.isZero=function(){return!!this.c&&this.c[0]==0},G.minus=function(E,b){var x,L,P,U,q=this,M=q.s;if(E=new l(E,b),b=E.s,!M||!b)return new l(NaN);if(M!=b)return E.s=-b,q.plus(E);var Q=q.e/u,K=E.e/u,H=q.c,ue=E.c;if(!Q||!K){if(!H||!ue)return H?(E.s=-b,E):new l(ue?q:NaN);if(!H[0]||!ue[0])return ue[0]?(E.s=-b,E):new l(H[0]?q:X==3?-0:0)}if(Q=T(Q),K=T(K),H=H.slice(),M=Q-K){for((U=M<0)?(M=-M,P=H):(K=Q,P=ue),P.reverse(),b=M;b--;P.push(0));P.reverse()}else for(L=(U=(M=H.length)<(b=ue.length))?M:b,M=b=0;b0)for(;b--;H[x++]=0);for(b=a-1;L>M;){if(H[--L]=0;){for(x=0,he=Pe[P]%xe,de=Pe[P]/xe|0,q=Q,U=P+q;U>P;)K=Ie[--q]%xe,H=Ie[q]/xe|0,M=de*K+H*he,K=he*K+M%xe*xe+Re[U]+x,x=(K/be|0)+(M/xe|0)+de*H,Re[U--]=K%be;Re[U]=x}return x?++L:Re.splice(0,1),ie(E,Re,L)},G.negated=function(){var E=new l(this);return E.s=-E.s||null,E},G.plus=function(E,b){var x,L=this,P=L.s;if(E=new l(E,b),b=E.s,!P||!b)return new l(NaN);if(P!=b)return E.s=-b,L.minus(E);var U=L.e/u,q=E.e/u,M=L.c,Q=E.c;if(!U||!q){if(!M||!Q)return new l(P/0);if(!M[0]||!Q[0])return Q[0]?E:new l(M[0]?L:P*0)}if(U=T(U),q=T(q),M=M.slice(),P=U-q){for(P>0?(q=U,x=Q):(P=-P,x=M),x.reverse();P--;x.push(0));x.reverse()}for(P=M.length,b=Q.length,P-b<0&&(x=Q,Q=M,M=x,b=P),P=0;b;)P=(M[--b]=M[b]+Q[b]+P)/a|0,M[b]=a===M[b]?0:M[b]%a;return P&&(M=[P].concat(M),++q),ie(E,M,q)},G.precision=G.sd=function(E,b){var x,L,P,U=this;if(E!=null&&E!==!!E)return $(E,1,N),b==null?b=X:$(b,0,8),ee(new l(U),E,b);if(!(x=U.c))return null;if(P=x.length-1,L=P*u+1,P=x[P]){for(;P%10==0;P/=10,L--);for(P=x[0];P>=10;P/=10,L++);}return E&&U.e+1>L&&(L=U.e+1),L},G.shiftedBy=function(E){return $(E,-h,h),this.times("1e"+E)},G.squareRoot=G.sqrt=function(){var E,b,x,L,P,U=this,q=U.c,M=U.s,Q=U.e,K=J+4,H=new l("0.5");if(M!==1||!q||!q[0])return new l(!M||M<0&&(!q||q[0])?NaN:q?U:1/0);if(M=Math.sqrt(+ae(U)),M==0||M==1/0?(b=V(q),(b.length+Q)%2==0&&(b+="0"),M=Math.sqrt(+b),Q=T((Q+1)/2)-(Q<0||Q%2),M==1/0?b="5e"+Q:(b=M.toExponential(),b=b.slice(0,b.indexOf("e")+1)+Q),x=new l(b)):x=new l(M+""),x.c[0]){for(Q=x.e,M=Q+K,M<3&&(M=0);;)if(P=x,x=H.times(P.plus(k(U,P,K,1))),V(P.c).slice(0,M)===(b=V(x.c)).slice(0,M))if(x.e0&&Re>0){for(U=Re%M||M,H=de.substr(0,U);U0&&(H+=K+de.slice(U)),he&&(H="-"+H)}L=ue?H+(x.decimalSeparator||"")+((Q=+x.fractionGroupSize)?ue.replace(new RegExp("\\d{"+Q+"}\\B","g"),"$&"+(x.fractionGroupSeparator||"")):ue):H}return(x.prefix||"")+L+(x.suffix||"")},G.toFraction=function(E){var b,x,L,P,U,q,M,Q,K,H,ue,he,de=this,Re=de.c;if(E!=null&&(M=new l(E),!M.isInteger()&&(M.c||M.s!==1)||M.lt(ce)))throw Error(s+"Argument "+(M.isInteger()?"out of range: ":"not an integer: ")+ae(M));if(!Re)return new l(de);for(b=new l(ce),K=x=new l(ce),L=Q=new l(ce),he=V(Re),U=b.e=he.length-de.e-1,b.c[0]=p[(q=U%u)<0?u+q:q],E=!E||M.comparedTo(b)>0?U>0?b:K:M,q=g,g=1/0,M=new l(he),Q.c[0]=0;H=k(M,b,0,1),P=x.plus(H.times(L)),P.comparedTo(E)!=1;)x=L,L=P,K=Q.plus(H.times(P=K)),Q=P,b=M.minus(H.times(P=b)),M=P;return P=k(E.minus(x),L,0,1),Q=Q.plus(P.times(K)),x=x.plus(P.times(L)),Q.s=K.s=de.s,U=U*2,ue=k(K,L,U,X).minus(de).abs().comparedTo(k(Q,x,U,X).minus(de).abs())<1?[K,L]:[Q,x],g=q,ue},G.toNumber=function(){return+ae(this)},G.toPrecision=function(E,b){return E!=null&&$(E,1,N),C(this,E,b,2)},G.toString=function(E){var b,x=this,L=x.s,P=x.e;return P===null?L?(b="Infinity",L<0&&(b="-"+b)):b="NaN":(E==null?b=P<=A||P>=c?Y(V(x.c),P):j(V(x.c),P,"0"):E===10?(x=ee(new l(x),J+P+1,X),b=j(V(x.c),x.e,"0")):($(E,2,I.length,"Base"),b=R(j(V(x.c),P,"0"),10,E,L,!0)),L<0&&x.c[0]&&(b="-"+b)),b},G.valueOf=G.toJSON=function(){return ae(this)},G._isBigNumber=!0,W!=null&&l.set(W),l}function T(W){var k=W|0;return W>0||W===k?k:k-1}function V(W){for(var k,R,F=1,G=W.length,ce=W[0]+"";Fc^R?1:-1;for(X=(A=G.length)<(c=ce.length)?A:c,J=0;Jce[J]^R?1:-1;return A==c?0:A>c^R?1:-1}function $(W,k,R,F){if(WR||W!==n(W))throw Error(s+(F||"Argument")+(typeof W=="number"?WR?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function se(W){var k=W.c.length-1;return T(W.e/u)==k&&W.c[k]%2!=0}function Y(W,k){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(k<0?"e":"e+")+k}function j(W,k,R){var F,G;if(k<0){for(G=R+".";++k;G+=R);W=G+W}else if(F=W.length,++k>F){for(G=R,k-=F;--k;G+=R);W+=G}else k{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.ErrGasLimitShouldBe0ForInnerTransaction=ge.ErrInvalidRelayedV2BuilderArguments=ge.ErrInvalidRelayedV1BuilderArguments=ge.ErrNotImplemented=ge.ErrContractInteraction=ge.ErrCodec=ge.ErrCannotParseTransactionOutcome=ge.ErrCannotParseContractResults=ge.ErrMissingFieldOnEnum=ge.ErrMissingFieldOnStruct=ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=ge.ErrTypingSystem=ge.ErrMock=ge.ErrContractHasNoAddress=ge.ErrContract=ge.ErrExpectedTransactionEventsNotFound=ge.ErrExpectedTransactionStatusNotReached=ge.ErrTransactionWatcherTimeout=ge.ErrAsyncTimerAborted=ge.ErrAsyncTimerAlreadyRunning=ge.ErrInvalidFunctionName=ge.ErrSignatureCannotCreate=ge.ErrTransactionOptionsInvalid=ge.ErrTransactionVersionInvalid=ge.ErrNonceInvalid=ge.ErrNotEnoughGas=ge.ErrAddressEmpty=ge.ErrAddressBadHrp=ge.ErrAddressCannotCreate=ge.ErrUnexpectedCondition=ge.ErrInvariantFailed=ge.ErrBadType=ge.ErrUnsupportedOperation=ge.ErrInvalidArgument=ge.Err=void 0;var Le=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}summary(){let e=[];e.push({name:this.name,message:this.message});let t=this.inner;for(;t;)e.push({name:t.name,message:t.message}),t=t.inner;return e}};ge.Err=Le;var T0=class extends Le{constructor(e,t){super(`Invalid argument: ${e}`,t)}};ge.ErrInvalidArgument=T0;var N0=class extends Le{constructor(e,t="not specified"){super(`Operation "${e}" not supported. Reason: ${t}`)}};ge.ErrUnsupportedOperation=N0;var D0=class extends Le{constructor(e,t,i){super(`Bad type of "${e}": ${i}. Expected type: ${t}`)}};ge.ErrBadType=D0;var O0=class extends Le{constructor(e){super(`Invariant failed: [${e}]`)}};ge.ErrInvariantFailed=O0;var P0=class extends Le{constructor(e){super(`Unexpected condition: [${e}]`)}};ge.ErrUnexpectedCondition=P0;var B0=class extends Le{constructor(e,t){let i=`Cannot create address from: ${e}`;super(i,t)}};ge.ErrAddressCannotCreate=B0;var M0=class extends Le{constructor(e,t){super(`Wrong address HRP. Expected: ${e}, got ${t}`)}};ge.ErrAddressBadHrp=M0;var R0=class extends Le{constructor(){super("Address is empty")}};ge.ErrAddressEmpty=R0;var L0=class extends Le{constructor(e){super(`Not enough gas provided: ${e}`)}};ge.ErrNotEnoughGas=L0;var F0=class extends Le{constructor(e){super(`Invalid nonce: ${e}`)}};ge.ErrNonceInvalid=F0;var U0=class extends Le{constructor(e){super(`Invalid transaction version: ${e}`)}};ge.ErrTransactionVersionInvalid=U0;var q0=class extends Le{constructor(e){super(`Invalid transaction options: ${e}`)}};ge.ErrTransactionOptionsInvalid=q0;var V0=class extends Le{constructor(e,t){let i=`Cannot create signature from: ${e}`;super(i,t)}};ge.ErrSignatureCannotCreate=V0;var H0=class extends Le{constructor(){super("Invalid function name")}};ge.ErrInvalidFunctionName=H0;var Q0=class extends Le{constructor(){super("Async timer already running")}};ge.ErrAsyncTimerAlreadyRunning=Q0;var j0=class extends Le{constructor(){super("Async timer aborted")}};ge.ErrAsyncTimerAborted=j0;var G0=class extends Le{constructor(){super("TransactionWatcher has timed out")}};ge.ErrTransactionWatcherTimeout=G0;var K0=class extends Le{constructor(){super("Expected transaction status not reached")}};ge.ErrExpectedTransactionStatusNotReached=K0;var z0=class extends Le{constructor(){super("Expected transaction events not found")}};ge.ErrExpectedTransactionEventsNotFound=z0;var Ql=class extends Le{constructor(e){super(e)}};ge.ErrContract=Ql;var k0=class extends Ql{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). -`)}};ge.ErrContractHasNoAddress=k0;var W0=class extends Re{constructor(e){super(e)}};ge.ErrMock=W0;var jl=class extends Re{constructor(e){super(e)}};ge.ErrTypingSystem=jl;var $0=class extends jl{constructor(e){super(` +`)}};ge.ErrContractHasNoAddress=k0;var W0=class extends Le{constructor(e){super(e)}};ge.ErrMock=W0;var jl=class extends Le{constructor(e){super(e)}};ge.ErrTypingSystem=jl;var $0=class extends jl{constructor(e){super(` argument at position ${e} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input. This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead. Also see https://github.com/multiversx/mx-sdk-js-core/pull/187. -`)}};ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=$0;var Y0=class extends Re{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};ge.ErrMissingFieldOnStruct=Y0;var J0=class extends Re{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};ge.ErrMissingFieldOnEnum=J0;var X0=class extends Re{constructor(e){super(`cannot parse contract results: ${e}`)}};ge.ErrCannotParseContractResults=X0;var Z0=class extends Re{constructor(e,t){super(`cannot parse outcome of transaction ${e}: ${t}`)}};ge.ErrCannotParseTransactionOutcome=Z0;var eg=class extends Re{constructor(e){super(e)}};ge.ErrCodec=eg;var tg=class extends Re{constructor(e){super(e)}};ge.ErrContractInteraction=tg;var rg=class extends Re{constructor(){super("Method not yet implemented")}};ge.ErrNotImplemented=rg;var ig=class extends Re{constructor(){super("invalid arguments for relayed v1 builder")}};ge.ErrInvalidRelayedV1BuilderArguments=ig;var ng=class extends Re{constructor(){super("invalid arguments for relayed v2 builder")}};ge.ErrInvalidRelayedV2BuilderArguments=ng;var sg=class extends Re{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ge.ErrGasLimitShouldBe0ForInnerTransaction=sg});var og=B(xo=>{"use strict";f();var oP=xo&&xo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xo,"__esModule",{value:!0});xo.TokenPayment=void 0;var zu=oP(jr()),aP=Ye(),eA="EGLD",tA=18;zu.default.set({ROUNDING_MODE:1});var Gi=class{constructor(e,t,i,n){let s=new zu.default(i);if(!s.isInteger()||s.isNegative())throw new aP.ErrInvalidArgument(`bad amountAsBigInteger: ${i}`);this.tokenIdentifier=e,this.nonce=t,this.amountAsBigInteger=s,this.numDecimals=n}static egldFromAmount(e){let t=new zu.default(e).shiftedBy(tA).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new Gi(eA,0,e,tA)}static fungibleFromAmount(e,t,i){let n=new zu.default(t).shiftedBy(i).decimalPlaces(0);return this.fungibleFromBigInteger(e,n,i)}static fungibleFromBigInteger(e,t,i=0){return new Gi(e,0,t,i)}static nonFungible(e,t){return new Gi(e,t,1,0)}static semiFungible(e,t,i){return new Gi(e,t,i,0)}static metaEsdtFromAmount(e,t,i,n){let s=new zu.default(i).shiftedBy(n).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,n)}static metaEsdtFromBigInteger(e,t,i,n=0){return new Gi(e,t,i,n)}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toRationalNumber()} ${this.tokenIdentifier}`}toRationalNumber(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==eA}isFungible(){return this.nonce==0}};xo.TokenPayment=Gi});var kl=B((mz,nA)=>{"use strict";f();var Kl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ag={};for(ku=0;ku>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function rA(r){for(var e=1,t=0;t126)return"Invalid prefix ("+r+")";e=To(e)^i>>5}for(e=To(e),t=0;tt)throw new TypeError("Exceeds length limit");r=r.toLowerCase();var i=rA(r);if(typeof i=="string")throw new Error(i);for(var n=r+"1",s=0;s>5)throw new Error("Non 5-bit word");i=To(i)^o,n+=Kl.charAt(o)}for(s=0;s<6;++s)i=To(i);for(i^=1,s=0;s<6;++s){var a=i>>(5-s)*5&31;n+=Kl.charAt(a)}return n}function iA(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var t=r.toLowerCase(),i=r.toUpperCase();if(r!==t&&r!==i)return"Mixed-case string "+r;r=t;var n=r.lastIndexOf("1");if(n===-1)return"No separator character for "+r;if(n===0)return"Missing prefix for "+r;var s=r.slice(0,n),o=r.slice(n+1);if(o.length<6)return"Data too short";var a=rA(s);if(typeof a=="string")return a;for(var u=[],h=0;h=o.length)&&u.push(w)}return a!==1?"Invalid checksum for "+r:{prefix:s,words:u}}function cP(){var r=iA.apply(null,arguments);if(typeof r=="object")return r}function lP(r){var e=iA.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zl(r,e,t,i){for(var n=0,s=0,o=(1<=t;)s-=t,a.push(n>>s&o);if(i)s>0&&a.push(n<=e)return"Excess padding";if(n<{"use strict";f();var gP=ai&&ai.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),yP=ai&&ai.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sA=ai&&ai.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gP(e,r,t);return yP(e,r),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.Address=void 0;var Wl=sA(kl()),No=sA(Ye()),ug="erd",cg=32,mP="0".repeat(16),Kt=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof Kt)return Kt.fromAddress(e);if(e instanceof y.Buffer)return Kt.fromBuffer(e);if(typeof e=="string")return Kt.fromString(e);throw new No.ErrAddressCannotCreate(e)}}static fromAddress(e){return Kt.fromValidHex(e.valueHex)}static fromValidHex(e){let t=new Kt;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=cg)throw new No.ErrAddressCannotCreate(e);return Kt.fromValidHex(e.toString("hex"))}static fromString(e){return Kt.isValidHex(e)?Kt.fromValidHex(e):Kt.fromBech32(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==cg}static fromHex(e){if(!Kt.isValidHex(e))throw new No.ErrAddressCannotCreate(e);return Kt.fromValidHex(e)}static fromBech32(e){let t;try{t=Wl.decode(e)}catch(s){throw new No.ErrAddressCannotCreate(e,s)}let i=t.prefix;if(i!=ug)throw new No.ErrAddressBadHrp(ug,i);let n=y.Buffer.from(Wl.fromWords(t.words));if(n.length!=cg)throw new No.ErrAddressCannotCreate(e);return Kt.fromValidHex(n.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Wl.toWords(this.pubkey());return Wl.encode(ug,e)}pubkey(){return this.isEmpty()?y.Buffer.from([]):y.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 Kt("0".repeat(64))}isContractAddress(){return this.hex().startsWith(mP)}};ai.Address=Kt});var Wu=B(tt=>{"use strict";f();Object.defineProperty(tt,"__esModule",{value:!0});tt.ARGUMENTS_SEPARATOR=tt.ESDT_TRANSFER_VALUE=tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_GAS_LIMIT=tt.TRANSACTION_VERSION_TX_HASH_SIGN=tt.TRANSACTION_VERSION_DEFAULT=tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=tt.TRANSACTION_OPTIONS_DEFAULT=tt.TRANSACTION_MIN_GAS_PRICE=void 0;tt.TRANSACTION_MIN_GAS_PRICE=1e9;tt.TRANSACTION_OPTIONS_DEFAULT=0;tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;tt.TRANSACTION_VERSION_DEFAULT=1;tt.TRANSACTION_VERSION_TX_HASH_SIGN=2;tt.ESDT_TRANSFER_GAS_LIMIT=5e5;tt.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";tt.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";tt.ESDT_TRANSFER_VALUE="0";tt.ARGUMENTS_SEPARATOR="@"});var Tr=B(rt=>{"use strict";f();var wP=rt&&rt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),vP=rt&&rt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),EP=rt&&rt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wP(e,r,t);return vP(e,r),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.isEmpty=rt.guardEmpty=rt.guardNotEmpty=rt.guardLength=rt.guardSameLength=rt.guardValueIsSetWithMessage=rt.guardValueIsSet=rt.guardTrue=void 0;var Do=EP(Ye());function AP(r,e){if(!r)throw new Do.ErrInvariantFailed(`[<${e}>] isn't true`)}rt.guardTrue=AP;function IP(r,e){oA(`${r} isn't set (null or undefined)`,e)}rt.guardValueIsSet=IP;function oA(r,e){if(e==null||e===void 0)throw new Do.ErrInvariantFailed(r)}rt.guardValueIsSetWithMessage=oA;function _P(r,e){if(r=r||[],e=e||[],r.length!=e.length)throw new Do.ErrInvariantFailed("arrays do not have the same length")}rt.guardSameLength=_P;function bP(r,e){let t=r.length||0;if(t!=e)throw new Do.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${t}`)}rt.guardLength=bP;function CP(r,e){if(lg(r))throw new Do.ErrInvariantFailed(`${e} is empty`)}rt.guardNotEmpty=CP;function SP(r,e){if(!lg(r))throw new Do.ErrInvariantFailed(`${e} is not empty`)}rt.guardEmpty=SP;function lg(r){return r.isEmpty?r.isEmpty():r.length===0}rt.isEmpty=lg});var aA=B($l=>{"use strict";f();Object.defineProperty($l,"__esModule",{value:!0});$l.getJavascriptPrototypesInHierarchy=void 0;function xP(r,e){let t=[],i=Object.getPrototypeOf(r);for(;i&&e(i);)t.push(i),i=Object.getPrototypeOf(i);return t}$l.getJavascriptPrototypesInHierarchy=xP});var Ft=B(Lt=>{"use strict";f();Object.defineProperty(Lt,"__esModule",{value:!0});Lt.NullType=Lt.TypePlaceholder=Lt.isTyped=Lt.PrimitiveValue=Lt.TypedValue=Lt.CustomType=Lt.PrimitiveType=Lt.TypeCardinality=Lt.Type=void 0;var fg=aA(),uA=Tr(),Ir=class{constructor(e,t=[],i=Ki.fixed(1)){uA.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=i}getName(){return this.name}getClassName(){return Ir.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(t=>t.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 uA.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(i=>i.toString()).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return Ir.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every((i,n)=>i.equals(t[n]))}static isAssignableFromMany(e,t){return e.every((i,n)=>i.isAssignableFrom(t[n]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!Ir.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let i=this.getFullyQualifiedName();return Ir.getFullyQualifiedNamesInHierarchy(e).includes(i)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return fg.getJavascriptPrototypesInHierarchy(e,n=>n.belongsToTypesystem).map(n=>n.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Lt.Type=Ir;Ir.ClassName="Type";var Ki=class{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new Ki(e,e)}static variable(e){return new Ki(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||Ki.MaxCardinality}};Lt.TypeCardinality=Ki;Ki.MaxCardinality=4096;var Oo=class extends Ir{constructor(e){super(e)}getClassName(){return Oo.ClassName}};Lt.PrimitiveType=Oo;Oo.ClassName="PrimitiveType";var Po=class extends Ir{getClassName(){return Po.ClassName}};Lt.CustomType=Po;Po.ClassName="CustomType";var hs=class{constructor(e){this.type=e}getClassName(){return hs.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Lt.TypedValue=hs;hs.ClassName="TypedValue";var Bo=class extends hs{constructor(e){super(e)}getClassName(){return Bo.ClassName}};Lt.PrimitiveValue=Bo;Bo.ClassName="PrimitiveValue";function TP(r){return r.belongsToTypesystem!==void 0}Lt.isTyped=TP;var Mo=class extends Ir{constructor(){super("...")}getClassName(){return Mo.ClassName}};Lt.TypePlaceholder=Mo;Mo.ClassName="TypePlaceholder";var Ro=class extends Ir{constructor(){super("?")}getClassName(){return Ro.ClassName}};Lt.NullType=Ro;Ro.ClassName="NullType"});var cA=B((Lo,Fo)=>{f();(function(r){var e=typeof Lo=="object"&&Lo&&!Lo.nodeType&&Lo,t=typeof Fo=="object"&&Fo&&!Fo.nodeType&&Fo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var n,s=2147483647,o=36,a=1,u=26,h=38,p=700,w=72,N=128,O="-",T=/^xn--/,V=/[^\x20-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,$={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},se=o-a,Y=Math.floor,j=String.fromCharCode,W;function k(v){throw new RangeError($[v])}function R(v,S){for(var D=v.length,I=[];D--;)I[D]=S(v[D]);return I}function F(v,S){var D=v.split("@"),I="";D.length>1&&(I=D[0]+"@",v=D[1]),v=v.replace(z,".");var l=v.split("."),C=R(l,S).join(".");return I+C}function G(v){for(var S=[],D=0,I=v.length,l,C;D=55296&&l<=56319&&D65535&&(S-=65536,D+=j(S>>>10&1023|55296),S=56320|S&1023),D+=j(S),D}).join("")}function J(v){return v-48<10?v-22:v-65<26?v-65:v-97<26?v-97:o}function X(v,S){return v+22+75*(v<26)-((S!=0)<<5)}function A(v,S,D){var I=0;for(v=D?Y(v/p):v>>1,v+=Y(v/S);v>se*u>>1;I+=o)v=Y(v/se);return Y(I+(se+1)*v/(v+h))}function c(v){var S=[],D=v.length,I,l=0,C=N,Z=w,ie,ee,ae,E,b,x,L,P,U;for(ie=v.lastIndexOf(O),ie<0&&(ie=0),ee=0;ee=128&&k("not-basic"),S.push(v.charCodeAt(ee));for(ae=ie>0?ie+1:0;ae=D&&k("invalid-input"),L=J(v.charCodeAt(ae++)),(L>=o||L>Y((s-l)/b))&&k("overflow"),l+=L*b,P=x<=Z?a:x>=Z+u?u:x-Z,!(LY(s/U)&&k("overflow"),b*=U;I=S.length+1,Z=A(l-E,I,E==0),Y(l/I)>s-C&&k("overflow"),C+=Y(l/I),l%=I,S.splice(l++,0,C)}return ce(S)}function d(v){var S,D,I,l,C,Z,ie,ee,ae,E,b,x=[],L,P,U,q;for(v=G(v),L=v.length,S=N,D=0,C=w,Z=0;Z=S&&bY((s-D)/P)&&k("overflow"),D+=(ie-S)*P,S=ie,Z=0;Zs&&k("overflow"),b==S){for(ee=D,ae=o;E=ae<=C?a:ae>=C+u?u:ae-C,!(ee{"use strict";f();var fA=cA();function NP(r,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=r}function hg(r){return r>="0"&&r<="7"}function DP(r){return r>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F"}function lA(r){return r=parseInt(r,16),fA.ucs2.encode([r])}function hA(r,e,t){var i=!1,n=[];function s(u){var h=r[u];if(!DP(h))throw new NP(u,"Unexpected token ILLEGAL");return h}for(;e{f();var yA=dA();vA.exports={validate:OP,parse:PP};function OP(r,e){var t;if(e=e||!1,typeof r!="string")t="Input must be a string";else try{Yl(r,0,e,!1)}catch(i){t=i.message}return t}function PP(r,e){if(typeof r!="string")throw new Error("Input must be a string");e=e||!1;var t=Yl(r,0,e,!0);return t.value}function mA(r,e){for(var t=r.length,i=e,n,s=e;s-1&&r[t]==="\\";)i++,t--;return i%2===0}function LP(r,e,t,i){for(var n=e,s=",",o=[],a=e;ds(r[a]);)a++;if(r[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Yl(r,n,t,i),h=mA(r,u.end);i&&o.push(u.value),n=h.end,s=h.value}return{start:e,end:n,value:o}}function FP(r,e){return r.substr(e,4)==="true"}function UP(r,e){return r.substr(e,5)==="false"}function qP(r,e){return r.substr(e,4)==="null"}var VP=new RegExp(/^\s$/);function ds(r){return VP.test(r)}var HP=new RegExp(/^\d$/);function pA(r){return HP.test(r)}function zi(r,e,t){var i=10,n;r.length{"use strict";f();var QP=ui&&ui.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),jP=ui&&ui.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),GP=ui&&ui.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&QP(e,r,t);return jP(e,r),e};Object.defineProperty(ui,"__esModule",{value:!0});ui.TypeExpressionParser=void 0;var AA=GP(Ye()),KP=Ft(),zP=EA(),pg=class{parse(e){let t=this.doParse(e),i=Object.keys(t);if(i.length!=1)throw new AA.ErrTypingSystem(`bad type expression: ${e}`);let n=i[0];return this.nodeToType(n,t[n])}doParse(e){let t=this.getJsonedString(e);try{return zP.parse(t)}catch{throw new AA.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${t}.`)}}getJsonedString(e){let t="";for(var i=0;i"?a!=">"?t+=": {} }":t+="}":o==","?u==">"||(a==">"?t+=",":t+=": {},"):t+=o}let n=/(:|\{|\}|,|\s)/,s=t.replace(/utf\-8\sstring/ig,"utf-8-string").split(n).filter(o=>o);return t=s.map(o=>n.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${t}: {}}`:`{${t}}`}nodeToType(e,t){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let i=Object.keys(t).map(n=>this.nodeToType(n,t[n]));return new KP.Type(e,i)}};ui.TypeExpressionParser=pg});var Zl=B(hn=>{"use strict";f();Object.defineProperty(hn,"__esModule",{value:!0});hn.EndpointParameterDefinition=hn.EndpointModifiers=hn.EndpointDefinition=void 0;var kP=Jl(),IA="?",WP="N / A",$u=class{constructor(e,t,i,n){this.input=[],this.output=[],this.name=e,this.input=t||[],this.output=i||[],this.modifiers=n}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?IA:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let t=e.inputs.map(s=>ps.fromJSON(s)),i=e.outputs.map(s=>ps.fromJSON(s)),n=new Xl(e.mutability,e.payableInTokens);return new $u(e.name,t,i,n)}};hn.EndpointDefinition=$u;var Xl=class{constructor(e,t){this.mutability=e||"",this.payableInTokens=t||[]}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"}};hn.EndpointModifiers=Xl;var ps=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new kP.TypeExpressionParser().parse(e.type);return new ps(e.name||IA,e.description||WP,t)}};hn.EndpointParameterDefinition=ps});var gg=B(ef=>{"use strict";f();Object.defineProperty(ef,"__esModule",{value:!0});ef.ContractInterface=void 0;var $P=Tr(),_A=Zl(),YP="?",Yu=class{constructor(e,t,i){this.endpoints=[],this.name=e,this.constructorDefinition=t,this.endpoints=i}static fromJSON(e){e.name=e.name||YP,e.endpoints=e.endpoints||[];let t=JP(e),i=e.endpoints.map(n=>_A.EndpointDefinition.fromJSON(n));return new Yu(e.name,t,i)}getConstructorDefinition(){return this.constructorDefinition}getEndpoint(e){let t=this.endpoints.find(i=>i.name==e);return $P.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}};ef.ContractInterface=Yu;function JP(r){if(r.constructor.inputs===void 0||r.constructor.outputs===void 0)return null;let e=Object.assign({name:"constructor"},r.constructor);return _A.EndpointDefinition.fromJSON(e)}});var Uo=B(gr=>{"use strict";f();var XP=gr&&gr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),ZP=gr&&gr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),eB=gr&&gr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&XP(e,r,t);return ZP(e,r),e};Object.defineProperty(gr,"__esModule",{value:!0});gr.Fields=gr.Field=gr.FieldDefinition=void 0;var yg=eB(Ye()),tB=Jl(),Ju=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new tB.TypeExpressionParser().parse(e.type);return new Ju(e.name,e.description,t)}};gr.FieldDefinition=Ju;var mg=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){let t=this.value.getType();if(!t.equals(e.type))throw new yg.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new yg.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};gr.Field=mg;var wg=class{static checkTyping(e,t){if(e.length!=t.length)throw new yg.ErrTypingSystem("fields length vs. field definitions length");for(let i=0;i{"use strict";f();Object.defineProperty(pn,"__esModule",{value:!0});pn.EnumValue=pn.EnumVariantDefinition=pn.EnumType=void 0;var rB=Ye(),vg=Tr(),tf=Uo(),CA=Ft(),bA=256,gs=class extends CA.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return gs.ClassName}static fromJSON(e){let t=(e.variants||[]).map(i=>qo.fromJSON(i));return new gs(e.name,t)}getVariantByDiscriminant(e){let t=this.variants.find(i=>i.discriminant==e);return vg.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find(i=>i.name==e);return vg.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){let e=[];for(let t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}};pn.EnumType=gs;gs.ClassName="EnumType";var qo=class{constructor(e,t,i=[]){this.fieldsDefinitions=[],vg.guardTrue(ttf.FieldDefinition.fromJSON(i));return new qo(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return tf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};pn.EnumVariantDefinition=qo;var dn=class extends CA.TypedValue{constructor(e,t,i){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=i,this.fieldsByName=new Map(i.map(s=>[s.name,s]));let n=t.getFieldsDefinitions();tf.Fields.checkTyping(this.fields,n)}getClassName(){return dn.ClassName}static fromName(e,t){let i=e.getVariantByName(t);return new dn(e,i,[])}static fromDiscriminant(e,t){let i=e.getVariantByDiscriminant(t);return new dn(e,i,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields(),n=this.name==e.name,s=this.discriminant==e.discriminant,o=tf.Fields.equals(t,i);return n&&s&&o}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new rB.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(t=>e.fields[t.name]=t.value.valueOf()),e}};pn.EnumValue=dn;dn.ClassName="EnumValue"});var ms=B(Ho=>{"use strict";f();Object.defineProperty(Ho,"__esModule",{value:!0});Ho.Struct=Ho.StructType=void 0;var iB=Ye(),rf=Uo(),SA=Ft(),ys=class extends SA.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return ys.ClassName}static fromJSON(e){let t=(e.fields||[]).map(i=>rf.FieldDefinition.fromJSON(i));return new ys(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return rf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Ho.StructType=ys;ys.ClassName="StructType";var Vo=class extends SA.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map(i=>[i.name,i])),this.checkTyping()}getClassName(){return Vo.ClassName}checkTyping(){let t=this.getType().getFieldsDefinitions();rf.Fields.checkTyping(this.fields,t)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new iB.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields();return rf.Fields.equals(t,i)}};Ho.Struct=Vo;Vo.ClassName="Struct"});var Go=B(jo=>{"use strict";f();Object.defineProperty(jo,"__esModule",{value:!0});jo.AddressValue=jo.AddressType=void 0;var nB=Gr(),xA=Ft(),ws=class extends xA.PrimitiveType{constructor(){super("Address")}getClassName(){return ws.ClassName}};jo.AddressType=ws;ws.ClassName="AddressType";var Qo=class extends xA.PrimitiveValue{constructor(e){super(new ws),this.value=new nB.Address(e.bech32())}getClassName(){return Qo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};jo.AddressValue=Qo;Qo.ClassName="AddressValue"});var nf=B(Ko=>{"use strict";f();Object.defineProperty(Ko,"__esModule",{value:!0});Ko.OptionalValue=Ko.OptionalType=void 0;var sB=Tr(),Zu=Ft(),gn=class extends Zu.Type{constructor(e){super("Optional",[e],Zu.TypeCardinality.variable(1))}getClassName(){return gn.ClassName}isAssignableFrom(e){if(!e.hasExactClass(gn.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(Zu.NullType.ClassName);return t||i}};Ko.OptionalType=gn;gn.ClassName="OptionalType";var vs=class extends Zu.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return vs.ClassName}static newMissing(){let e=new gn(new Zu.NullType);return new vs(e)}isSet(){return!!this.value}getTypedValue(){return sB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};Ko.OptionalValue=vs;vs.ClassName="OptionalValue"});var ec=B(ko=>{"use strict";f();Object.defineProperty(ko,"__esModule",{value:!0});ko.BooleanValue=ko.BooleanType=void 0;var TA=Ft(),Es=class extends TA.PrimitiveType{constructor(){super("bool")}getClassName(){return Es.ClassName}};ko.BooleanType=Es;Es.ClassName="BooleanType";var zo=class extends TA.PrimitiveValue{constructor(e){super(new Es),this.value=e}getClassName(){return zo.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};ko.BooleanValue=zo;zo.ClassName="BooleanValue"});var mn=B(Wo=>{"use strict";f();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.BytesValue=Wo.BytesType=void 0;var NA=Ft(),As=class extends NA.PrimitiveType{constructor(){super("bytes")}getClassName(){return As.ClassName}};Wo.BytesType=As;As.ClassName="BytesType";var yn=class extends NA.PrimitiveValue{constructor(e){super(new As),this.value=e}getClassName(){return yn.ClassName}static fromUTF8(e){let t=y.Buffer.from(e,"utf-8");return new yn(t)}static fromHex(e){let t=y.Buffer.from(e,"hex");return new yn(t)}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()}};Wo.BytesValue=yn;yn.ClassName="BytesValue"});var OA=B($o=>{"use strict";f();Object.defineProperty($o,"__esModule",{value:!0});$o.CodeMetadataValue=$o.CodeMetadataType=void 0;var DA=Ft(),sf=class extends DA.PrimitiveType{constructor(){super("CodeMetadata")}};$o.CodeMetadataType=sf;var Eg=class extends DA.PrimitiveValue{constructor(e){super(new sf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};$o.CodeMetadataValue=Eg});var of=B(Yo=>{"use strict";f();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.CompositeValue=Yo.CompositeType=void 0;var oB=Tr(),Ag=Ft(),Is=class extends Ag.Type{constructor(...e){super("Composite",e,Ag.TypeCardinality.variable(e.length))}getClassName(){return Is.ClassName}};Yo.CompositeType=Is;Is.ClassName="CompositeType";var _s=class extends Ag.TypedValue{constructor(e,t){super(e),oB.guardLength(t,e.getTypeParameters().length),this.items=t}getClassName(){return _s.ClassName}static fromItems(...e){let t=e.map(n=>n.getType()),i=new Is(...t);return new _s(i,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 t=0;t{"use strict";f();Object.defineProperty(af,"__esModule",{value:!0});af.CollectionOfTypedValues=void 0;var Ig=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 t=0;t{"use strict";f();Object.defineProperty(ci,"__esModule",{value:!0});ci.List=ci.OptionValue=ci.ListType=ci.OptionType=void 0;var aB=Tr(),uB=_g(),bs=Ft(),li=class extends bs.Type{constructor(e){super("Option",[e])}getClassName(){return li.ClassName}isAssignableFrom(e){if(!e.hasExactClass(li.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(bs.NullType.ClassName);return t||i}};ci.OptionType=li;li.ClassName="OptionType";var Cs=class extends bs.Type{constructor(e){super("List",[e])}getClassName(){return Cs.ClassName}};ci.ListType=Cs;Cs.ClassName="ListType";var ki=class extends bs.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return ki.ClassName}static newMissing(){let e=new li(new bs.NullType);return new ki(e)}static newMissingTyped(e){return new ki(new li(e))}static newProvided(e){let t=new li(e.getType());return new ki(t,e)}isSet(){return!!this.value}getTypedValue(){return aB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ci.OptionValue=ki;ki.ClassName="OptionValue";var wn=class extends bs.TypedValue{constructor(e,t){super(e),this.backingCollection=new uB.CollectionOfTypedValues(t)}getClassName(){return wn.ClassName}static fromItems(e){if(e.length==0)return new wn(new bs.TypePlaceholder,[]);let t=e[0].getType(),i=new Cs(t);return new wn(i,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ci.List=wn;wn.ClassName="List"});var uf=B(Zo=>{"use strict";f();Object.defineProperty(Zo,"__esModule",{value:!0});Zo.ArrayVec=Zo.ArrayVecType=void 0;var PA=Tr(),cB=_g(),BA=Ft(),Jo=class extends BA.Type{constructor(e,t){super("Array",[t]),PA.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return Jo.ClassName}};Zo.ArrayVecType=Jo;Jo.ClassName="ArrayVecType";var Xo=class extends BA.TypedValue{constructor(e,t){super(e),PA.guardLength(t,e.length),this.backingCollection=new cB.CollectionOfTypedValues(t)}getClassName(){return Xo.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};Zo.ArrayVec=Xo;Xo.ClassName="ArrayVec"});var rc=B(ta=>{"use strict";f();Object.defineProperty(ta,"__esModule",{value:!0});ta.H256Value=ta.H256Type=void 0;var MA=Ft(),Ss=class extends MA.PrimitiveType{constructor(){super("H256")}getClassName(){return Ss.ClassName}};ta.H256Type=Ss;Ss.ClassName="H256Type";var ea=class extends MA.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return ea.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ta.H256Value=ea;ea.ClassName="H256Value"});var cf=B(ia=>{"use strict";f();Object.defineProperty(ia,"__esModule",{value:!0});ia.NothingValue=ia.NothingType=void 0;var RA=Ft(),xs=class extends RA.PrimitiveType{constructor(){super("nothing")}getClassName(){return xs.ClassName}};ia.NothingType=xs;xs.ClassName="NothingType";var ra=class extends RA.PrimitiveValue{constructor(){super(new xs)}getClassName(){return ra.ClassName}equals(e){return!1}valueOf(){return{}}};ia.NothingValue=ra;ra.ClassName="NothingValue"});var ic=B(Ae=>{"use strict";f();var lB=Ae&&Ae.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),fB=Ae&&Ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),hB=Ae&&Ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&lB(e,r,t);return fB(e,r),e},dB=Ae&&Ae.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var LA=hB(Ye()),FA=Ft(),Us=dB(jr()),ir=class extends FA.PrimitiveType{constructor(e,t,i){super(e),this.sizeInBytes=t,this.withSign=i}getClassName(){return ir.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=ir;ir.ClassName="NumericalType";var Ts=class extends ir{constructor(){super("u8",1,!1)}getClassName(){return Ts.ClassName}};Ae.U8Type=Ts;Ts.ClassName="U8Type";var Ns=class extends ir{constructor(){super("i8",1,!0)}getClassName(){return Ns.ClassName}};Ae.I8Type=Ns;Ns.ClassName="I8Type";var Ds=class extends ir{constructor(){super("u16",2,!1)}getClassName(){return Ds.ClassName}};Ae.U16Type=Ds;Ds.ClassName="U16Type";var Os=class extends ir{constructor(){super("i16",2,!0)}getClassName(){return Os.ClassName}};Ae.I16Type=Os;Os.ClassName="I16Type";var Ps=class extends ir{constructor(){super("u32",4,!1)}getClassName(){return Ps.ClassName}};Ae.U32Type=Ps;Ps.ClassName="U32Type";var Bs=class extends ir{constructor(){super("i32",4,!0)}getClassName(){return Bs.ClassName}};Ae.I32Type=Bs;Bs.ClassName="I32Type";var Ms=class extends ir{constructor(){super("u64",8,!1)}getClassName(){return Ms.ClassName}};Ae.U64Type=Ms;Ms.ClassName="U64Type";var Rs=class extends ir{constructor(){super("i64",8,!0)}getClassName(){return Rs.ClassName}};Ae.I64Type=Rs;Rs.ClassName="I64Type";var Ls=class extends ir{constructor(){super("BigUint",0,!1)}getClassName(){return Ls.ClassName}};Ae.BigUIntType=Ls;Ls.ClassName="BigUIntType";var Fs=class extends ir{constructor(){super("Bigint",0,!0)}getClassName(){return Fs.ClassName}};Ae.BigIntType=Fs;Fs.ClassName="BigIntType";var nr=class extends FA.PrimitiveValue{constructor(e,t){if(super(e),this.value=new Us.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new LA.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new LA.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return nr.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=nr;nr.ClassName="NumericalValue";var na=class extends nr{constructor(e){super(new Ts,new Us.default(e))}getClassName(){return na.ClassName}};Ae.U8Value=na;na.ClassName="U8Value";var sa=class extends nr{constructor(e){super(new Ns,new Us.default(e))}getClassName(){return sa.ClassName}};Ae.I8Value=sa;sa.ClassName="I8Value";var oa=class extends nr{constructor(e){super(new Ds,new Us.default(e))}getClassName(){return oa.ClassName}};Ae.U16Value=oa;oa.ClassName="U16Value";var aa=class extends nr{constructor(e){super(new Os,new Us.default(e))}getClassName(){return aa.ClassName}};Ae.I16Value=aa;aa.ClassName="I16Value";var ua=class extends nr{constructor(e){super(new Ps,new Us.default(e))}getClassName(){return ua.ClassName}};Ae.U32Value=ua;ua.ClassName="U32Value";var ca=class extends nr{constructor(e){super(new Bs,new Us.default(e))}getClassName(){return ca.ClassName}};Ae.I32Value=ca;ca.ClassName="I32Value";var la=class extends nr{constructor(e){super(new Ms,e)}getClassName(){return la.ClassName}};Ae.U64Value=la;la.ClassName="U64Value";var fa=class extends nr{constructor(e){super(new Rs,e)}getClassName(){return fa.ClassName}};Ae.I64Value=fa;fa.ClassName="I64Value";var ha=class extends nr{constructor(e){super(new Ls,e)}getClassName(){return ha.ClassName}};Ae.BigUIntValue=ha;ha.ClassName="BigUIntValue";var da=class extends nr{constructor(e){super(new Fs,e)}getClassName(){return da.ClassName}};Ae.BigIntValue=da;da.ClassName="BigIntValue"});var lf=B(pa=>{"use strict";f();Object.defineProperty(pa,"__esModule",{value:!0});pa.StringValue=pa.StringType=void 0;var UA=Ft(),qs=class extends UA.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return qs.ClassName}};pa.StringType=qs;qs.ClassName="StringType";var vn=class extends UA.PrimitiveValue{constructor(e){super(new qs),this.value=e}getClassName(){return vn.ClassName}static fromUTF8(e){return new vn(e)}static fromHex(e){let t=y.Buffer.from(e,"hex").toString();return new vn(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};pa.StringValue=vn;vn.ClassName="StringValue"});var ya=B(ga=>{"use strict";f();Object.defineProperty(ga,"__esModule",{value:!0});ga.TokenIdentifierValue=ga.TokenIdentifierType=void 0;var qA=Ft(),pB="EGLD",Vs=class extends qA.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Vs.ClassName}};ga.TokenIdentifierType=Vs;Vs.ClassName="TokenIdentifierType";var En=class extends qA.PrimitiveValue{constructor(e){super(new Vs),this.value=e}static egld(){return new En(pB)}static esdtTokenIdentifier(e){return new En(e)}getClassName(){return En.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()}};ga.TokenIdentifierValue=En;En.ClassName="TokenIdentifierValue"});var ff=B(Nr=>{"use strict";f();var gB=Nr&&Nr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),yB=Nr&&Nr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),mB=Nr&&Nr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gB(e,r,t);return yB(e,r),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.Tuple=Nr.TupleType=void 0;var wB=mB(Ye()),vB=ms(),VA=Uo(),EB=ms(),Wi=class extends EB.StructType{constructor(...e){super(Wi.prepareName(e),Wi.prepareFieldDefinitions(e))}getClassName(){return Wi.ClassName}static prepareName(e){let t=e.map(n=>n.toString()).join(", ");return`tuple${t.length}<${t}>`}static prepareFieldDefinitions(e){return e.map((i,n)=>new VA.FieldDefinition(HA(n),"anonymous tuple field",i))}};Nr.TupleType=Wi;Wi.ClassName="TupleType";function HA(r){return`field${r}`}var Hs=class extends vB.Struct{constructor(e,t){super(e,t)}getClassName(){return Hs.ClassName}static fromItems(e){if(e.length<1)throw new wB.ErrTypingSystem("bad tuple items");let t=e.map(s=>s.getType()),i=new Wi(...t),n=e.map((s,o)=>new VA.Field(s,HA(o)));return new Hs(i,n)}};Nr.Tuple=Hs;Hs.ClassName="Tuple"});var df=B(ma=>{"use strict";f();Object.defineProperty(ma,"__esModule",{value:!0});ma.VariadicValue=ma.VariadicType=void 0;var hf=Ft(),In=class extends hf.Type{constructor(e){super("Variadic",[e],hf.TypeCardinality.variable())}getClassName(){return In.ClassName}};ma.VariadicType=In;In.ClassName="VariadicType";var An=class extends hf.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return An.ClassName}static fromItems(...e){if(e.length==0)return new An(new In(new hf.TypePlaceholder),[]);let t=e[0].getType();return new An(new In(t),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 t=0;t{"use strict";f();var AB=fi&&fi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),IB=fi&&fi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),_B=fi&&fi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&AB(e,r,t);return IB(e,r),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.TypeMapper=void 0;var QA=_B(Ye()),bB=Go(),bg=nf(),CB=ec(),SB=mn(),xB=OA(),pf=of(),Cg=Xu(),TB=Uo(),jA=tc(),gf=uf(),NB=rc(),GA=cf(),Dr=ic(),DB=lf(),KA=ms(),zA=ya(),_n=ff(),Sg=df(),xg=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...t)=>new jA.OptionType(t[0])],["List",(...t)=>new jA.ListType(t[0])],["VarArgs",(...t)=>new Sg.VariadicType(t[0])],["MultiResultVec",(...t)=>new Sg.VariadicType(t[0])],["variadic",(...t)=>new Sg.VariadicType(t[0])],["OptionalArg",(...t)=>new bg.OptionalType(t[0])],["optional",(...t)=>new bg.OptionalType(t[0])],["OptionalResult",(...t)=>new bg.OptionalType(t[0])],["multi",(...t)=>new pf.CompositeType(...t)],["MultiArg",(...t)=>new pf.CompositeType(...t)],["MultiResult",(...t)=>new pf.CompositeType(...t)],["multi",(...t)=>new pf.CompositeType(...t)],["tuple",(...t)=>new _n.TupleType(...t)],["tuple2",(...t)=>new _n.TupleType(...t)],["tuple3",(...t)=>new _n.TupleType(...t)],["tuple4",(...t)=>new _n.TupleType(...t)],["tuple5",(...t)=>new _n.TupleType(...t)],["tuple6",(...t)=>new _n.TupleType(...t)],["tuple7",(...t)=>new _n.TupleType(...t)],["tuple8",(...t)=>new _n.TupleType(...t)],["array20",(...t)=>new gf.ArrayVecType(20,t[0])],["array32",(...t)=>new gf.ArrayVecType(32,t[0])],["array46",(...t)=>new gf.ArrayVecType(46,t[0])],["array64",(...t)=>new gf.ArrayVecType(64,t[0])]]),this.closedTypesMap=new Map([["u8",new Dr.U8Type],["u16",new Dr.U16Type],["u32",new Dr.U32Type],["u64",new Dr.U64Type],["U64",new Dr.U64Type],["BigUint",new Dr.BigUIntType],["i8",new Dr.I8Type],["i16",new Dr.I16Type],["i32",new Dr.I32Type],["i64",new Dr.I64Type],["Bigint",new Dr.BigIntType],["BigInt",new Dr.BigIntType],["bool",new CB.BooleanType],["bytes",new SB.BytesType],["Address",new bB.AddressType],["H256",new NB.H256Type],["utf-8 string",new DB.StringType],["TokenIdentifier",new zA.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new zA.TokenIdentifierType],["CodeMetadata",new xB.CodeMetadataType],["nothing",new GA.NothingType],["AsyncCall",new GA.NothingType]]),this.learnedTypesMap=new Map;for(let t of e)this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapTypeRecursively(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new QA.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let t=e.isGenericType(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let n=this.closedTypesMap.get(e.getName());return n||(e.hasExactClass(Cg.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(KA.StructType.ClassName)?this.mapStructType(e):t?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new KA.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map(n=>new Cg.EnumVariantDefinition(n.name,n.discriminant,this.mappedFields(n.getFieldsDefinitions())));return new Cg.EnumType(e.getName(),t)}mappedFields(e){return e.map(t=>new TB.FieldDefinition(t.name,t.description,this.mapType(t.type)))}mapGenericType(e){let i=e.getTypeParameters().map(s=>this.mapType(s)),n=this.openTypesFactories.get(e.getName());if(!n)throw new QA.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return n(...i)}};fi.TypeMapper=xg});var XA=B(hi=>{"use strict";f();var OB=hi&&hi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),PB=hi&&hi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),BB=hi&&hi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&OB(e,r,t);return PB(e,r),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.AbiRegistry=void 0;var kA=BB(Ye()),Ng=Tr(),WA=gg(),Dg=Zl(),$A=Xu(),YA=ms(),MB=Tg(),wa=class{constructor(){this.interfaces=[],this.customTypes=[]}static create(e){return new wa().extend(e).remapToKnownTypes()}extend(e){e.types=e.types||{};let t=WA.ContractInterface.fromJSON(e);this.interfaces.push(t);for(let i in e.types){let n=e.types[i],s=n.type;n.name=i;let o=this.createCustomType(s,n);this.customTypes.push(o)}return this}createCustomType(e,t){if(e=="struct")return YA.StructType.fromJSON(t);if(e=="enum")return $A.EnumType.fromJSON(t);throw new kA.ErrTypingSystem(`Unknown type discriminant: ${e}`)}getInterface(e){let t=this.interfaces.find(i=>i.name==e);return Ng.guardValueIsSetWithMessage(`interface [${e}] not found`,t),t}getInterfaces(e){return e.map(t=>this.getInterface(t))}getStruct(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(YA.StructType.ClassName));return Ng.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map(t=>this.getStruct(t))}getEnum(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass($A.EnumType.ClassName));return Ng.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map(t=>this.getEnum(t))}remapToKnownTypes(){let e=new MB.TypeMapper([]),t=[],i=[];for(let s of this.customTypes)this.mapCustomTypeDepthFirst(s,this.customTypes,e,t);if(this.customTypes.length!=t.length)throw new kA.ErrTypingSystem("Did not re-map all custom types");for(let s of this.interfaces){let o=[];for(let u of s.endpoints)o.push(JA(u,e));let a=s.constructorDefinition?JA(s.constructorDefinition,e):null;i.push(new WA.ContractInterface(s.name,a,o))}let n=new wa;return n.customTypes.push(...t),n.interfaces.push(...i),n}mapCustomTypeDepthFirst(e,t,i,n){if(n.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=t.find(h=>h.getName()==a);u&&this.mapCustomTypeDepthFirst(u,t,i,n)}let o=i.mapType(e);n.push(o)}};hi.AbiRegistry=wa;function JA(r,e){let t=r.input.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type))),i=r.output.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type)));return new Dg.EndpointDefinition(r.name,t,i,r.modifiers)}});var eI=B(va=>{"use strict";f();Object.defineProperty(va,"__esModule",{value:!0});va.createListOfTokenIdentifiers=va.createListOfAddresses=void 0;var RB=Go(),ZA=tc(),LB=ya();function FB(r){let e=r.map(i=>new RB.AddressValue(i));return ZA.List.fromItems(e)}va.createListOfAddresses=FB;function UB(r){let e=r.map(i=>new LB.TokenIdentifierValue(i));return ZA.List.fromItems(e)}va.createListOfTokenIdentifiers=UB});var pI=B(sr=>{"use strict";f();var qB=sr&&sr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),VB=sr&&sr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),HB=sr&&sr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&qB(e,r,t);return VB(e,r),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.onPrimitiveTypeSelect=sr.onPrimitiveValueSelect=sr.onTypedValueSelect=sr.onTypeSelect=void 0;var mf=HB(Ye()),tI=Go(),rI=ec(),iI=mn(),nI=Xu(),yf=tc(),sI=rc(),oI=ic(),aI=cf(),uI=ms(),cI=ya(),lI=ff(),fI=Ft(),hI=uf(),dI=lf();function QB(r,e){if(r.hasExactClass(yf.OptionType.ClassName))return e.onOption();if(r.hasExactClass(yf.ListType.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVecType.ClassName))return e.onArray();if(r.hasClassOrSuperclass(fI.PrimitiveType.ClassName))return e.onPrimitive();if(r.hasExactClass(uI.StructType.ClassName))return e.onStruct();if(r.hasExactClass(lI.TupleType.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't known: ${r}`)}sr.onTypeSelect=QB;function jB(r,e){if(r.hasClassOrSuperclass(fI.PrimitiveValue.ClassName))return e.onPrimitive();if(r.hasExactClass(yf.OptionValue.ClassName))return e.onOption();if(r.hasExactClass(yf.List.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVec.ClassName))return e.onArray();if(r.hasExactClass(uI.Struct.ClassName))return e.onStruct();if(r.hasExactClass(lI.Tuple.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't typed: ${r}`)}sr.onTypedValueSelect=jB;function GB(r,e){if(r.hasExactClass(rI.BooleanValue.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalValue.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressValue.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesValue.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringValue.ClassName))return e.onString();if(r.hasExactClass(sI.H256Value.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(r.hasExactClass(aI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't a primitive: ${r.getType()}`)}sr.onPrimitiveValueSelect=GB;function KB(r,e){if(r.hasExactClass(rI.BooleanType.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalType.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressType.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesType.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringType.ClassName))return e.onString();if(r.hasExactClass(sI.H256Type.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(r.hasExactClass(aI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't a known primitive: ${r}`)}sr.onPrimitiveTypeSelect=KB});var or=B(Ve=>{"use strict";f();var zB=Ve&&Ve.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),Je=Ve&&Ve.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&zB(e,r,t)};Object.defineProperty(Ve,"__esModule",{value:!0});Je(XA(),Ve);Je(Go(),Ve);Je(nf(),Ve);Je(ec(),Ve);Je(mn(),Ve);Je(of(),Ve);Je(gg(),Ve);Je(Zl(),Ve);Je(Xu(),Ve);Je(eI(),Ve);Je(Uo(),Ve);Je(tc(),Ve);Je(uf(),Ve);Je(rc(),Ve);Je(pI(),Ve);Je(cf(),Ve);Je(ic(),Ve);Je(lf(),Ve);Je(ms(),Ve);Je(ff(),Ve);Je(ya(),Ve);Je(Jl(),Ve);Je(Tg(),Ve);Je(Ft(),Ve);Je(df(),Ve)});var yI=B(di=>{"use strict";f();var kB=di&&di.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),WB=di&&di.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),$B=di&&di.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&kB(e,r,t);return WB(e,r),e};Object.defineProperty(di,"__esModule",{value:!0});di.OptionValueBinaryCodec=void 0;var gI=$B(Ye()),wf=or(),Og=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(e[0]==0)return[wf.OptionValue.newMissingTyped(t),1];if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return[wf.OptionValue.newProvided(i),n+1]}decodeTopLevel(e,t){if(e.length==0)return new wf.OptionValue(t);if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return new wf.OptionValue(t,i)}encodeNested(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([])}};di.OptionValueBinaryCodec=Og});var mI=B(vf=>{"use strict";f();Object.defineProperty(vf,"__esModule",{value:!0});vf.AddressBinaryCodec=void 0;var YB=Gr(),JB=or(),Pg=class{decodeNested(e){let t=e.slice(0,32),i=new YB.Address(t);return[new JB.AddressValue(i),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};vf.AddressBinaryCodec=Pg});var vI=B(pi=>{"use strict";f();var XB=pi&&pi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),ZB=pi&&pi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),eM=pi&&pi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&XB(e,r,t);return ZB(e,r),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.BooleanBinaryCodec=void 0;var tM=eM(Ye()),wI=or(),Kr=class{decodeNested(e){let t=e.readUInt8(0);return[new wI.BooleanValue(t==Kr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new tM.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new wI.BooleanValue(t==Kr.TRUE)}encodeNested(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([Kr.FALSE])}encodeTopLevel(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([])}};pi.BooleanBinaryCodec=Kr;Kr.TRUE=1;Kr.FALSE=0});var Af=B(Ef=>{"use strict";f();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.SizeOfU32=void 0;Ef.SizeOfU32=4});var AI=B(gi=>{"use strict";f();var rM=gi&&gi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(gi,"__esModule",{value:!0});gi.zeroPadStringIfOddLength=gi.isPaddedHex=gi.numberToPaddedHex=void 0;var iM=rM(jr());function nM(r){let e=new iM.default(r).toString(16);return EI(e)}gi.numberToPaddedHex=nM;function sM(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}gi.isPaddedHex=sM;function EI(r){return r=r||"",r.length%2==1?"0"+r:r}gi.zeroPadStringIfOddLength=EI});var Mg=B(Ut=>{"use strict";f();var oM=Ut&&Ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.prependByteToBuffer=Ut.flipBufferBitsInPlace=Ut.getHexMagnitudeOfBigInt=Ut.bigIntToBuffer=Ut.bufferToBigInt=Ut.cloneBuffer=Ut.isMsbZero=Ut.isMsbOne=void 0;var Bg=oM(jr()),aM=AI();function II(r,e=0){return r[e]>>7==1}Ut.isMsbOne=II;function uM(r,e=0){return!II(r,e)}Ut.isMsbZero=uM;function cM(r){let e=y.Buffer.alloc(r.length);return r.copy(e),e}Ut.cloneBuffer=cM;function lM(r){let e=r.toString("hex");return new Bg.default(`0x${e}`,16)}Ut.bufferToBigInt=lM;function fM(r){let e=_I(r);return y.Buffer.from(e,"hex")}Ut.bigIntToBuffer=fM;function _I(r){return r=new Bg.default(r),r?(r.isNegative()&&(r=r.multipliedBy(new Bg.default(-1))),aM.numberToPaddedHex(r)):""}Ut.getHexMagnitudeOfBigInt=_I;function hM(r){for(let e=0;e{"use strict";f();var pM=Ea&&Ea.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.NumericalBinaryCodec=void 0;var nc=pM(jr()),Rg=or(),bI=Af(),pt=Mg(),Lg=class{decodeNested(e,t){let i=0,n=t.sizeInBytes;n||(i=bI.SizeOfU32,n=e.readUInt32BE(0));let s=e.slice(i,i+n),o=this.decodeTopLevel(s,t),a=n+i;return[o,a]}decodeTopLevel(e,t){let i=pt.cloneBuffer(e);if(e.length==0)return new Rg.NumericalValue(t,new nc.default(0));if(!t.withSign||pt.isMsbZero(i)){let h=pt.bufferToBigInt(i);return new Rg.NumericalValue(t,h)}pt.flipBufferBitsInPlace(i);let u=pt.bufferToBigInt(i).multipliedBy(new nc.default(-1)).minus(new nc.default(1));return new Rg.NumericalValue(t,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),i=y.Buffer.alloc(bI.SizeOfU32);return i.writeUInt32BE(t.length),y.Buffer.concat([i,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return y.Buffer.alloc(t,0);if(!e.withSign){let o=pt.bigIntToBuffer(e.value),a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}if(e.value.isPositive()){let o=pt.bigIntToBuffer(e.value);pt.isMsbOne(o)&&(o=pt.prependByteToBuffer(o,0));let a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}let i=e.value.plus(new nc.default(1)),n=pt.bigIntToBuffer(i);pt.flipBufferBitsInPlace(n),pt.isMsbZero(n)&&(n=pt.prependByteToBuffer(n,255));let s=y.Buffer.alloc(t-n.length,255);return y.Buffer.concat([s,n])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?y.Buffer.alloc(0):t?this.encodePrimitive(e):pt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let n=pt.bigIntToBuffer(e.value);return pt.isMsbOne(n)&&(n=pt.prependByteToBuffer(n,0)),n}let t=e.value.plus(new nc.default(1)),i=pt.bigIntToBuffer(t);return pt.flipBufferBitsInPlace(i),pt.isMsbZero(i)&&(i=pt.prependByteToBuffer(i,255)),i}};Ea.NumericalBinaryCodec=Lg});var SI=B(If=>{"use strict";f();Object.defineProperty(If,"__esModule",{value:!0});If.H256BinaryCodec=void 0;var gM=rc(),Fg=class{decodeNested(e){let t=e.slice(0,32);return[new gM.H256Value(t),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};If.H256BinaryCodec=Fg});var Cf=B(bf=>{"use strict";f();Object.defineProperty(bf,"__esModule",{value:!0});bf.BytesBinaryCodec=void 0;var xI=mn(),_f=Af(),Ug=class{decodeNested(e){let t=e.readUInt32BE(0),i=e.slice(_f.SizeOfU32,_f.SizeOfU32+t);return[new xI.BytesValue(i),_f.SizeOfU32+t]}decodeTopLevel(e){return new xI.BytesValue(e)}encodeNested(e){let t=y.Buffer.alloc(_f.SizeOfU32);return t.writeUInt32BE(e.getLength()),y.Buffer.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};bf.BytesBinaryCodec=Ug});var NI=B(Sf=>{"use strict";f();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.TokenIdentifierCodec=void 0;var yM=mn(),TI=ya(),mM=Cf(),qg=class{constructor(){this.bytesCodec=new mM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesCodec.decodeNested(e);return[new TI.TokenIdentifierValue(t.toString()),i]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new TI.TokenIdentifierValue(t.toString())}encodeNested(e){let t=yM.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Sf.TokenIdentifierCodec=qg});var OI=B(xf=>{"use strict";f();Object.defineProperty(xf,"__esModule",{value:!0});xf.NothingCodec=void 0;var DI=or(),Vg=class{decodeNested(){return[new DI.NothingValue,0]}decodeTopLevel(){return new DI.NothingValue}encodeNested(){return y.Buffer.from([])}encodeTopLevel(){return y.Buffer.from([])}};xf.NothingCodec=Vg});var BI=B(Tf=>{"use strict";f();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.StringBinaryCodec=void 0;var PI=or(),wM=mn(),vM=Cf(),Hg=class{constructor(){this.bytesBinaryCodec=new vM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesBinaryCodec.decodeNested(e);return[new PI.StringValue(t.valueOf().toString()),i]}decodeTopLevel(e){return new PI.StringValue(e.toString())}encodeNested(e){let t=wM.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Tf.StringBinaryCodec=Hg});var MI=B(Df=>{"use strict";f();Object.defineProperty(Df,"__esModule",{value:!0});Df.PrimitiveBinaryCodec=void 0;var Nf=or(),EM=mI(),AM=vI(),IM=CI(),_M=SI(),bM=Cf(),CM=NI(),SM=OI(),xM=BI(),Qg=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new AM.BooleanBinaryCodec,this.numericalCodec=new IM.NumericalBinaryCodec,this.addressCodec=new EM.AddressBinaryCodec,this.h256Codec=new _M.H256BinaryCodec,this.bytesCodec=new bM.BytesBinaryCodec,this.stringCodec=new xM.StringBinaryCodec,this.tokenIdentifierCodec=new CM.TokenIdentifierCodec,this.nothingCodec=new SM.NothingCodec}decodeNested(e,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),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,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),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 Nf.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 Nf.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()})}};Df.PrimitiveBinaryCodec=Qg});var FI=B(Of=>{"use strict";f();Object.defineProperty(Of,"__esModule",{value:!0});Of.ListBinaryCodec=void 0;var RI=or(),LI=Af(),jg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.getFirstTypeParameter(),n=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=LI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,i);n.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(n.length)}return new RI.List(t,n)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=y.Buffer.alloc(LI.SizeOfU32);t.writeUInt32BE(e.getLength());let i=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);i.push(o)}return y.Buffer.concat([t,...i])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(let n of e.getItems()){let s=this.binaryCodec.encodeNested(n);t.push(s)}return y.Buffer.concat(t)}};Of.ListBinaryCodec=jg});var Kg=B(Pf=>{"use strict";f();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.FieldsBinaryCodec=void 0;var TM=or(),Gg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=[],n=0;for(let s of t){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),n+=a;let u=new TM.Field(o,s.name);i.push(u)}return[i,n]}encodeNested(e){let t=[];for(let i of e){let n=this.binaryCodec.encodeNested(i.value);t.push(n)}return y.Buffer.concat(t)}};Pf.FieldsBinaryCodec=Gg});var kg=B(Bf=>{"use strict";f();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.StructBinaryCodec=void 0;var NM=or(),DM=Kg(),zg=class{constructor(e){this.fieldsCodec=new DM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let i=t.getFieldsDefinitions(),[n,s]=this.fieldsCodec.decodeNested(e,i);return[new NM.Struct(t,n),s]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}};Bf.StructBinaryCodec=zg});var UI=B(Rf=>{"use strict";f();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.EnumBinaryCodec=void 0;var Mf=or(),OM=Kg(),Wg=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new OM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let[i,n]=this.readDiscriminant(e);e=e.slice(n);let s=t.getVariantByDiscriminant(i),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Mf.EnumValue(t,s,a),n+u]}readDiscriminant(e){let[t,i]=this.binaryCodec.decodeNested(e,new Mf.U8Type);return[t.valueOf(),i]}encodeNested(e){let t=new Mf.U8Value(e.discriminant),i=this.binaryCodec.encodeNested(t),n=e.getFields(),s=this.fieldsCodec.encodeNested(n);return y.Buffer.concat([i,s])}encodeTopLevel(e){let t=e.getFields(),i=t.length>0,n=this.fieldsCodec.encodeNested(t),s=new Mf.U8Value(e.discriminant),o=i?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return y.Buffer.concat([o,n])}};Rf.EnumBinaryCodec=Wg});var qI=B(Lf=>{"use strict";f();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.TupleBinaryCodec=void 0;var PM=kg(),$g=class{constructor(e){this.structCodec=new PM.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Lf.TupleBinaryCodec=$g});var VI=B(Ff=>{"use strict";f();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.ArrayVecBinaryCodec=void 0;var BM=or(),Yg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.length,n=t.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";f();var MM=Or&&Or.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),RM=Or&&Or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),LM=Or&&Or.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&MM(e,r,t);return RM(e,r),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.BinaryCodecConstraints=Or.BinaryCodec=void 0;var HI=LM(Ye()),Uf=or(),QI=Tr(),FM=yI(),UM=MI(),qM=FI(),VM=kg(),HM=UI(),QM=qI(),jM=VI(),Jg=class{constructor(e=null){this.constraints=e||new qf,this.optionCodec=new FM.OptionValueBinaryCodec(this),this.listCodec=new qM.ListBinaryCodec(this),this.arrayCodec=new jM.ArrayVecBinaryCodec(this),this.primitiveCodec=new UM.PrimitiveBinaryCodec(this),this.structCodec=new VM.StructBinaryCodec(this),this.tupleCodec=new QM.TupleBinaryCodec(this),this.enumCodec=new HM.EnumBinaryCodec(this)}decodeTopLevel(e,t){return this.constraints.checkBufferLength(e),Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[i,n]=Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t)});return[i,n]}encodeNested(e){return QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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 QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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)})}};Or.BinaryCodec=Jg;var qf=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||40960,this.maxListLength=e?.maxListLength||8192}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new HI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new HI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Or.BinaryCodecConstraints=qf});var jI=B(Pr=>{"use strict";f();var GM=Pr&&Pr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.decodeBigNumber=Pr.decodeString=Pr.decodeBool=Pr.decodeUnsignedNumber=void 0;var KM=GM(jr()),Vf=or(),zM=Xg(),Hf=new zM.BinaryCodec;function kM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return Number(e.valueOf())}Pr.decodeUnsignedNumber=kM;function WM(r){let e=Hf.decodeTopLevel(r,new Vf.BooleanType);return Boolean(e.valueOf())}Pr.decodeBool=WM;function $M(r){let e=Hf.decodeTopLevel(r,new Vf.BytesType);return String(e.valueOf())}Pr.decodeString=$M;function YM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return new KM.default(e.valueOf())}Pr.decodeBigNumber=YM});var KI=B(bn=>{"use strict";f();var JM=bn&&bn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),GI=bn&&bn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&JM(e,r,t)};Object.defineProperty(bn,"__esModule",{value:!0});GI(Xg(),bn);GI(jI(),bn)});var jf=B(Qf=>{"use strict";f();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ArgSerializer=void 0;var zI=Wu(),XM=KI(),Zg=nf(),ey=of(),ty=df(),ZM={codec:new XM.BinaryCodec},ry=class{constructor(e){e=Object.assign(Object.assign({},ZM),e),this.codec=e.codec}stringToValues(e,t){let i=this.stringToBuffers(e);return this.buffersToValues(i,t)}stringToBuffers(e){return e.split(zI.ARGUMENTS_SEPARATOR).map(t=>y.Buffer.from(t,"hex"))}buffersToValues(e,t){let i=this;e=e||[];let n=[],s=0,o=e.length;for(let p=0;p=o}return n}valuesToString(e){let t=this.valuesToStrings(e),i=t.join(zI.ARGUMENTS_SEPARATOR),n=t.length;return{argumentsString:i,count:n}}valuesToStrings(e){return this.valuesToBuffers(e).map(n=>n.toString("hex"))}valuesToBuffers(e){let t=this,i=[];for(let s of e)n(s);function n(s){if(s.hasExactClass(Zg.OptionalValue.ClassName)){let o=s;o.isSet()&&n(o.getTypedValue())}else if(s.hasExactClass(ty.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else if(s.hasExactClass(ey.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else{let o=t.codec.encodeTopLevel(s);i.push(o)}}return i}};Qf.ArgSerializer=ry});var cy=B(zr=>{"use strict";f();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var oy=sc(),ay=Tr(),eR=jf();zr.ArwenVirtualMachine="0500";var iy=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`${e}@${zr.ArwenVirtualMachine}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractDeployPayloadBuilder=iy;var ny=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`upgradeContract@${e}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractUpgradePayloadBuilder=ny;var sy=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(){ay.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=uy(e,this.arguments),new oy.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=sy;function uy(r,e){let{argumentsString:t,count:i}=new eR.ArgSerializer().valuesToString(e);return i==0?r:`${r}@${t}`}});var sc=B(Gf=>{"use strict";f();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.TransactionPayload=void 0;var ly=cy(),Aa=class{constructor(e){this.data=y.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Aa("");let t=y.Buffer.from(e,"base64").toString();return new Aa(t)}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=>y.Buffer.from(e,"hex"))}length(){return y.Buffer.from(this.data).length}static contractDeploy(){return new ly.ContractDeployPayloadBuilder}static contractUpgrade(){return new ly.ContractUpgradePayloadBuilder}static contractCall(){return new ly.ContractCallPayloadBuilder}};Gf.TransactionPayload=Aa});var $I=B(Cn=>{"use strict";f();Object.defineProperty(Cn,"__esModule",{value:!0});Cn.MultiESDTNFTTransferPayloadBuilder=Cn.ESDTNFTTransferPayloadBuilder=Cn.ESDTTransferPayloadBuilder=void 0;var kI=Gr(),py=jf(),kr=or(),WI=og(),gy=sc(),fy=class{constructor(){this.payment=WI.TokenPayment.fungibleFromAmount("","0",0)}setPayment(e){return this.payment=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.BigUIntValue(this.payment.valueOf())],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTTransfer@${t}`;return new gy.TransactionPayload(i)}};Cn.ESDTTransferPayloadBuilder=fy;var hy=class{constructor(){this.payment=WI.TokenPayment.nonFungible("",0),this.destination=new kI.Address("")}setPayment(e){return this.payment=e,this}setDestination(e){return this.destination=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.U64Value(this.payment.nonce),new kr.BigUIntValue(this.payment.valueOf()),new kr.AddressValue(this.destination)],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Cn.ESDTNFTTransferPayloadBuilder=hy;var dy=class{constructor(){this.payments=[],this.destination=new kI.Address("")}setPayments(e){return this.payments=e,this}setDestination(e){return this.destination=e,this}build(){let e=[new kr.AddressValue(this.destination),new kr.U16Value(this.payments.length)];for(let n of this.payments)e.push(kr.BytesValue.fromUTF8(n.tokenIdentifier),new kr.U64Value(n.nonce),new kr.BigUIntValue(n.valueOf()));let{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`MultiESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Cn.MultiESDTNFTTransferPayloadBuilder=dy});var zf=B(Kf=>{"use strict";f();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.Account=void 0;var tR=Gr(),yy=class{constructor(e){this.address=new tR.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()}}};Kf.Account=yy});var YI=B(yi=>{"use strict";f();var rR=yi&&yi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),iR=yi&&yi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),nR=yi&&yi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&rR(e,r,t);return iR(e,r),e};Object.defineProperty(yi,"__esModule",{value:!0});yi.Hash=void 0;var sR=nR(Ye()),oc=class{constructor(e){if(!e)this.hash=y.Buffer.from([]);else if(e instanceof y.Buffer)this.hash=e;else if(typeof e=="string")this.hash=y.Buffer.from(e,"hex");else throw new sR.ErrBadType("hash","buffer | string",e)}static empty(){return new oc(y.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};yi.Hash=oc});var XI=B(Br=>{"use strict";f();var oR=Br&&Br.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),aR=Br&&Br.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),uR=Br&&Br.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&oR(e,r,t);return aR(e,r),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionOptions=Br.TransactionVersion=void 0;var JI=uR(Ye()),kf=Wu(),Ia=class{constructor(e){if(e=Number(e),e<1)throw new JI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new Ia(kf.TRANSACTION_VERSION_DEFAULT)}static withTxHashSignVersion(){return new Ia(kf.TRANSACTION_VERSION_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionVersion=Ia;var _a=class{constructor(e){if(e=Number(e),e<0)throw new JI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new _a(kf.TRANSACTION_OPTIONS_DEFAULT)}static withTxHashSignOptions(){return new _a(kf.TRANSACTION_OPTIONS_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionOptions=_a});var e_=B((UW,ZI)=>{"use strict";f();ZI.exports=cR;function cR(r,e){for(var t=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";f();var Wf=i_;Wf.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&e.charAt(t)==="=";)++i;return Math.ceil(e.length*3)/4-i};var ba=new Array(64),r_=new Array(123);for(Wr=0;Wr<64;)r_[ba[Wr]=Wr<26?Wr+65:Wr<52?Wr+71:Wr<62?Wr-4:Wr-59|43]=Wr++;var Wr;Wf.encode=function(e,t,i){for(var n=null,s=[],o=0,a=0,u;t>2],u=(h&3)<<4,a=1;break;case 1:s[o++]=ba[u|h>>4],u=(h&15)<<2,a=2;break;case 2:s[o++]=ba[u|h>>6],s[o++]=ba[h&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=ba[u],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var t_="invalid encoding";Wf.decode=function(e,t,i){for(var n=i,s=0,o,a=0;a1)break;if((u=r_[u])===void 0)throw Error(t_);switch(s){case 0:o=u,s=1;break;case 1:t[i++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[i++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[i++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(t_);return i-n};Wf.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var o_=B((QW,s_)=>{"use strict";f();s_.exports=$f;function $f(){this._listeners={}}$f.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this};$f.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";f();h_.exports=a_(a_);function a_(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),i=t[3]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3]}function s(u,h,p){e[0]=u,h[p]=t[3],h[p+1]=t[2],h[p+2]=t[1],h[p+3]=t[0]}r.writeFloatLE=i?n:s,r.writeFloatBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],e[0]}function a(u,h){return t[3]=u[h],t[2]=u[h+1],t[1]=u[h+2],t[0]=u[h+3],e[0]}r.readFloatLE=i?o:a,r.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(n)/Math.LN2),h=Math.round(n*Math.pow(2,-u)*8388608)&8388607;i((a<<31|u+127<<23|h)>>>0,s,o)}}r.writeFloatLE=e.bind(null,u_),r.writeFloatBE=e.bind(null,c_);function t(i,n,s){var o=i(n,s),a=(o>>31)*2+1,u=o>>>23&255,h=o&8388607;return u===255?h?NaN:a*(1/0):u===0?a*1401298464324817e-60*h:a*Math.pow(2,u-150)*(h+8388608)}r.readFloatLE=t.bind(null,l_),r.readFloatBE=t.bind(null,f_)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),i=t[7]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3],h[p+4]=t[4],h[p+5]=t[5],h[p+6]=t[6],h[p+7]=t[7]}function s(u,h,p){e[0]=u,h[p]=t[7],h[p+1]=t[6],h[p+2]=t[5],h[p+3]=t[4],h[p+4]=t[3],h[p+5]=t[2],h[p+6]=t[1],h[p+7]=t[0]}r.writeDoubleLE=i?n:s,r.writeDoubleBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],t[4]=u[h+4],t[5]=u[h+5],t[6]=u[h+6],t[7]=u[h+7],e[0]}function a(u,h){return t[7]=u[h],t[6]=u[h+1],t[5]=u[h+2],t[4]=u[h+3],t[3]=u[h+4],t[2]=u[h+5],t[1]=u[h+6],t[0]=u[h+7],e[0]}r.readDoubleLE=i?o:a,r.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,u){var h=o<0?1:0;if(h&&(o=-o),o===0)i(0,a,u+n),i(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))i(0,a,u+n),i(2146959360,a,u+s);else if(o>17976931348623157e292)i(0,a,u+n),i((h<<31|2146435072)>>>0,a,u+s);else{var p;if(o<22250738585072014e-324)p=o/5e-324,i(p>>>0,a,u+n),i((h<<31|p/4294967296)>>>0,a,u+s);else{var w=Math.floor(Math.log(o)/Math.LN2);w===1024&&(w=1023),p=o*Math.pow(2,-w),i(p*4503599627370496>>>0,a,u+n),i((h<<31|w+1023<<20|p*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,u_,0,4),r.writeDoubleBE=e.bind(null,c_,4,0);function t(i,n,s,o,a){var u=i(o,a+n),h=i(o,a+s),p=(h>>31)*2+1,w=h>>>20&2047,N=4294967296*(h&1048575)+u;return w===2047?N?NaN:p*(1/0):w===0?p*5e-324*N:p*Math.pow(2,w-1075)*(N+4503599627370496)}r.readDoubleLE=t.bind(null,l_,0,4),r.readDoubleBE=t.bind(null,f_,4,0)}(),r}function u_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function c_(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function l_(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function f_(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var p_=B((exports,module)=>{"use strict";f();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(r){}return null}});var y_=B(g_=>{"use strict";f();var my=g_;my.length=function(e){for(var t=0,i=0,n=0;n191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&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))};my.write=function(e,t,i){for(var n=i,s,o,a=0;a>6|192,t[i++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128);return i-n}});var w_=B(($W,m_)=>{"use strict";f();m_.exports=lR;function lR(r,e,t){var i=t||8192,n=i>>>1,s=null,o=i;return function(u){if(u<1||u>n)return r(u);o+u>i&&(s=r(i),o=0);var h=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),h}}});var E_=B((JW,v_)=>{"use strict";f();v_.exports=zt;var ac=xn();function zt(r,e){this.lo=r>>>0,this.hi=e>>>0}var Qs=zt.zero=new zt(0,0);Qs.toNumber=function(){return 0};Qs.zzEncode=Qs.zzDecode=function(){return this};Qs.length=function(){return 1};var fR=zt.zeroHash="\0\0\0\0\0\0\0\0";zt.fromNumber=function(e){if(e===0)return Qs;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new zt(i,n)};zt.from=function(e){if(typeof e=="number")return zt.fromNumber(e);if(ac.isString(e))if(ac.Long)e=ac.Long.fromString(e);else return zt.fromNumber(parseInt(e,10));return e.low||e.high?new zt(e.low>>>0,e.high>>>0):Qs};zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+i*4294967296)}return this.lo+this.hi*4294967296};zt.prototype.toLong=function(e){return ac.Long?new ac.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Sn=String.prototype.charCodeAt;zt.fromHash=function(e){return e===fR?Qs:new zt((Sn.call(e,0)|Sn.call(e,1)<<8|Sn.call(e,2)<<16|Sn.call(e,3)<<24)>>>0,(Sn.call(e,4)|Sn.call(e,5)<<8|Sn.call(e,6)<<16|Sn.call(e,7)<<24)>>>0)};zt.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)};zt.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};zt.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};zt.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}});var xn=B(wy=>{"use strict";f();var we=wy;we.asPromise=e_();we.base64=n_();we.EventEmitter=o_();we.float=d_();we.inquire=p_();we.utf8=y_();we.pool=w_();we.LongBits=E_();we.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);we.global=we.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||wy;we.emptyArray=Object.freeze?Object.freeze([]):[];we.emptyObject=Object.freeze?Object.freeze({}):{};we.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};we.isString=function(e){return typeof e=="string"||e instanceof String};we.isObject=function(e){return e&&typeof e=="object"};we.isset=we.isSet=function(e,t){var i=e[t];return i!=null&&e.hasOwnProperty(t)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};we.Buffer=function(){try{var r=we.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();we._Buffer_from=null;we._Buffer_allocUnsafe=null;we.newBuffer=function(e){return typeof e=="number"?we.Buffer?we._Buffer_allocUnsafe(e):new we.Array(e):we.Buffer?we._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};we.Array=typeof Uint8Array<"u"?Uint8Array:Array;we.Long=we.global.dcodeIO&&we.global.dcodeIO.Long||we.global.Long||we.inquire("long");we.key2Re=/^true|false|0|1$/;we.key32Re=/^-?(?:0|[1-9][0-9]*)$/;we.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;we.longToHash=function(e){return e?we.LongBits.from(e).toHash():we.LongBits.zeroHash};we.longFromHash=function(e,t){var i=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))};function A_(r,e,t){for(var i=Object.keys(e),n=0;n-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};we.oneOfSetter=function(e){return function(t){for(var i=0;i{"use strict";f();S_.exports=qe;var Mr=xn(),vy,Yf=Mr.LongBits,__=Mr.base64,b_=Mr.utf8;function uc(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Ay(){}function hR(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function qe(){this.len=0,this.head=new uc(Ay,0,0),this.tail=this.head,this.states=null}var C_=function(){return Mr.Buffer?function(){return(qe.create=function(){return new vy})()}:function(){return new qe}};qe.create=C_();qe.alloc=function(e){return new Mr.Array(e)};Mr.Array!==Array&&(qe.alloc=Mr.pool(qe.alloc,Mr.Array.prototype.subarray));qe.prototype._push=function(e,t,i){return this.tail=this.tail.next=new uc(e,t,i),this.len+=t,this};function Iy(r,e,t){e[t]=r&255}function dR(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function _y(r,e){this.len=r,this.next=void 0,this.val=e}_y.prototype=Object.create(uc.prototype);_y.prototype.fn=dR;qe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new _y((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};qe.prototype.int32=function(e){return e<0?this._push(by,10,Yf.fromNumber(e)):this.uint32(e)};qe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function by(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}qe.prototype.uint64=function(e){var t=Yf.from(e);return this._push(by,t.length(),t)};qe.prototype.int64=qe.prototype.uint64;qe.prototype.sint64=function(e){var t=Yf.from(e).zzEncode();return this._push(by,t.length(),t)};qe.prototype.bool=function(e){return this._push(Iy,1,e?1:0)};function Ey(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}qe.prototype.fixed32=function(e){return this._push(Ey,4,e>>>0)};qe.prototype.sfixed32=qe.prototype.fixed32;qe.prototype.fixed64=function(e){var t=Yf.from(e);return this._push(Ey,4,t.lo)._push(Ey,4,t.hi)};qe.prototype.sfixed64=qe.prototype.fixed64;qe.prototype.float=function(e){return this._push(Mr.float.writeFloatLE,4,e)};qe.prototype.double=function(e){return this._push(Mr.float.writeDoubleLE,8,e)};var pR=Mr.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(Iy,1,0);if(Mr.isString(e)){var i=qe.alloc(t=__.length(e));__.decode(e,i,0),e=i}return this.uint32(t)._push(pR,t,e)};qe.prototype.string=function(e){var t=b_.length(e);return t?this.uint32(t)._push(b_.write,t,e):this._push(Iy,1,0)};qe.prototype.fork=function(){return this.states=new hR(this),this.head=this.tail=new uc(Ay,0,0),this.len=0,this};qe.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 uc(Ay,0,0),this.len=0),this};qe.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this};qe.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t};qe._configure=function(r){vy=r,qe.create=C_(),vy._configure()}});var N_=B((i$,T_)=>{"use strict";f();T_.exports=mi;var x_=Cy();(mi.prototype=Object.create(x_.prototype)).constructor=mi;var Tn=xn();function mi(){x_.call(this)}mi._configure=function(){mi.alloc=Tn._Buffer_allocUnsafe,mi.writeBytesBuffer=Tn.Buffer&&Tn.Buffer.prototype instanceof Uint8Array&&Tn.Buffer.prototype.set.name==="set"?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(mi.writeBytesBuffer,t,e),this};function gR(r,e,t){r.length<40?Tn.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}mi.prototype.string=function(e){var t=Tn.Buffer.byteLength(e);return this.uint32(t),t&&this._push(gR,t,e),this};mi._configure()});var Ty=B((s$,M_)=>{"use strict";f();M_.exports=gt;var wi=xn(),xy,P_=wi.LongBits,yR=wi.utf8;function $r(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function gt(r){this.buf=r,this.pos=0,this.len=r.length}var D_=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new gt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new gt(e);throw Error("illegal buffer")},B_=function(){return wi.Buffer?function(t){return(gt.create=function(n){return wi.Buffer.isBuffer(n)?new xy(n):D_(n)})(t)}:D_};gt.create=B_();gt.prototype._slice=wi.Array.prototype.subarray||wi.Array.prototype.slice;gt.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}}();gt.prototype.int32=function(){return this.uint32()|0};gt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Sy(){var r=new P_(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}gt.prototype.bool=function(){return this.uint32()!==0};function Jf(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}gt.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)};gt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)|0};function O_(){if(this.pos+8>this.len)throw $r(this,8);return new P_(Jf(this.buf,this.pos+=4),Jf(this.buf,this.pos+=4))}gt.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=wi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};gt.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=wi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};gt.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)};gt.prototype.string=function(){var e=this.bytes();return yR.read(e,0,e.length)};gt.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};gt.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};gt._configure=function(r){xy=r,gt.create=B_(),xy._configure();var e=wi.Long?"toLong":"toNumber";wi.merge(gt.prototype,{int64:function(){return Sy.call(this)[e](!1)},uint64:function(){return Sy.call(this)[e](!0)},sint64:function(){return Sy.call(this).zzDecode()[e](!1)},fixed64:function(){return O_.call(this)[e](!0)},sfixed64:function(){return O_.call(this)[e](!1)}})}});var U_=B((a$,F_)=>{"use strict";f();F_.exports=js;var L_=Ty();(js.prototype=Object.create(L_.prototype)).constructor=js;var R_=xn();function js(r){L_.call(this,r)}js._configure=function(){R_.Buffer&&(js.prototype._slice=R_.Buffer.prototype.slice)};js.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))};js._configure()});var V_=B((c$,q_)=>{"use strict";f();q_.exports=cc;var Ny=xn();(cc.prototype=Object.create(Ny.EventEmitter.prototype)).constructor=cc;function cc(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Ny.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}cc.prototype.rpcCall=function r(e,t,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Ny.asPromise(r,o,e,t,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(u,h){if(u)return o.emit("error",u,e),s(u);if(h===null){o.end(!0);return}if(!(h instanceof i))try{h=i[o.responseDelimited?"decodeDelimited":"decode"](h)}catch(p){return o.emit("error",p,e),s(p)}return o.emit("data",h,e),s(null,h)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};cc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Q_=B(H_=>{"use strict";f();var mR=H_;mR.Service=V_()});var G_=B((d$,j_)=>{"use strict";f();j_.exports={}});var k_=B(z_=>{"use strict";f();var yr=z_;yr.build="minimal";yr.Writer=Cy();yr.BufferWriter=N_();yr.Reader=Ty();yr.BufferReader=U_();yr.util=xn();yr.rpc=Q_();yr.roots=G_();yr.configure=K_;function K_(){yr.util._configure(),yr.Writer._configure(yr.BufferWriter),yr.Reader._configure(yr.BufferReader)}K_()});var $_=B((m$,W_)=>{"use strict";f();W_.exports=k_()});var J_=B((v$,Y_)=>{"use strict";f();var Ca=$_(),Xf=Ca.Reader,wR=Ca.Writer,le=Ca.util,lc=Ca.roots.default||(Ca.roots.default={});lc.proto=function(){var r={};return r.Transaction=function(){function e(t){if(t)for(var i=Object.keys(t),n=0;n>>3){case 1:o.Nonce=i.uint64();break;case 2:o.Value=i.bytes();break;case 3:o.RcvAddr=i.bytes();break;case 4:o.RcvUserName=i.bytes();break;case 5:o.SndAddr=i.bytes();break;case 6:o.SndUserName=i.bytes();break;case 7:o.GasPrice=i.uint64();break;case 8:o.GasLimit=i.uint64();break;case 9:o.Data=i.bytes();break;case 10:o.ChainID=i.bytes();break;case 11:o.Version=i.uint32();break;case 12:o.Signature=i.bytes();break;case 13:o.Options=i.uint32();break;default:i.skipType(a&7);break}}return o},e.decodeDelimited=function(i){return i instanceof Xf||(i=new Xf(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.Nonce!=null&&i.hasOwnProperty("Nonce")&&!le.isInteger(i.Nonce)&&!(i.Nonce&&le.isInteger(i.Nonce.low)&&le.isInteger(i.Nonce.high))?"Nonce: integer|Long expected":i.Value!=null&&i.hasOwnProperty("Value")&&!(i.Value&&typeof i.Value.length=="number"||le.isString(i.Value))?"Value: buffer expected":i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&!(i.RcvAddr&&typeof i.RcvAddr.length=="number"||le.isString(i.RcvAddr))?"RcvAddr: buffer expected":i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&!(i.RcvUserName&&typeof i.RcvUserName.length=="number"||le.isString(i.RcvUserName))?"RcvUserName: buffer expected":i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&!(i.SndAddr&&typeof i.SndAddr.length=="number"||le.isString(i.SndAddr))?"SndAddr: buffer expected":i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&!(i.SndUserName&&typeof i.SndUserName.length=="number"||le.isString(i.SndUserName))?"SndUserName: buffer expected":i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&!le.isInteger(i.GasPrice)&&!(i.GasPrice&&le.isInteger(i.GasPrice.low)&&le.isInteger(i.GasPrice.high))?"GasPrice: integer|Long expected":i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&!le.isInteger(i.GasLimit)&&!(i.GasLimit&&le.isInteger(i.GasLimit.low)&&le.isInteger(i.GasLimit.high))?"GasLimit: integer|Long expected":i.Data!=null&&i.hasOwnProperty("Data")&&!(i.Data&&typeof i.Data.length=="number"||le.isString(i.Data))?"Data: buffer expected":i.ChainID!=null&&i.hasOwnProperty("ChainID")&&!(i.ChainID&&typeof i.ChainID.length=="number"||le.isString(i.ChainID))?"ChainID: buffer expected":i.Version!=null&&i.hasOwnProperty("Version")&&!le.isInteger(i.Version)?"Version: integer expected":i.Signature!=null&&i.hasOwnProperty("Signature")&&!(i.Signature&&typeof i.Signature.length=="number"||le.isString(i.Signature))?"Signature: buffer expected":i.Options!=null&&i.hasOwnProperty("Options")&&!le.isInteger(i.Options)?"Options: integer expected":null},e.fromObject=function(i){if(i instanceof lc.proto.Transaction)return i;var n=new lc.proto.Transaction;return i.Nonce!=null&&(le.Long?(n.Nonce=le.Long.fromValue(i.Nonce)).unsigned=!0:typeof i.Nonce=="string"?n.Nonce=parseInt(i.Nonce,10):typeof i.Nonce=="number"?n.Nonce=i.Nonce:typeof i.Nonce=="object"&&(n.Nonce=new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0))),i.Value!=null&&(typeof i.Value=="string"?le.base64.decode(i.Value,n.Value=le.newBuffer(le.base64.length(i.Value)),0):i.Value.length&&(n.Value=i.Value)),i.RcvAddr!=null&&(typeof i.RcvAddr=="string"?le.base64.decode(i.RcvAddr,n.RcvAddr=le.newBuffer(le.base64.length(i.RcvAddr)),0):i.RcvAddr.length&&(n.RcvAddr=i.RcvAddr)),i.RcvUserName!=null&&(typeof i.RcvUserName=="string"?le.base64.decode(i.RcvUserName,n.RcvUserName=le.newBuffer(le.base64.length(i.RcvUserName)),0):i.RcvUserName.length&&(n.RcvUserName=i.RcvUserName)),i.SndAddr!=null&&(typeof i.SndAddr=="string"?le.base64.decode(i.SndAddr,n.SndAddr=le.newBuffer(le.base64.length(i.SndAddr)),0):i.SndAddr.length&&(n.SndAddr=i.SndAddr)),i.SndUserName!=null&&(typeof i.SndUserName=="string"?le.base64.decode(i.SndUserName,n.SndUserName=le.newBuffer(le.base64.length(i.SndUserName)),0):i.SndUserName.length&&(n.SndUserName=i.SndUserName)),i.GasPrice!=null&&(le.Long?(n.GasPrice=le.Long.fromValue(i.GasPrice)).unsigned=!0:typeof i.GasPrice=="string"?n.GasPrice=parseInt(i.GasPrice,10):typeof i.GasPrice=="number"?n.GasPrice=i.GasPrice:typeof i.GasPrice=="object"&&(n.GasPrice=new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0))),i.GasLimit!=null&&(le.Long?(n.GasLimit=le.Long.fromValue(i.GasLimit)).unsigned=!0:typeof i.GasLimit=="string"?n.GasLimit=parseInt(i.GasLimit,10):typeof i.GasLimit=="number"?n.GasLimit=i.GasLimit:typeof i.GasLimit=="object"&&(n.GasLimit=new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0))),i.Data!=null&&(typeof i.Data=="string"?le.base64.decode(i.Data,n.Data=le.newBuffer(le.base64.length(i.Data)),0):i.Data.length&&(n.Data=i.Data)),i.ChainID!=null&&(typeof i.ChainID=="string"?le.base64.decode(i.ChainID,n.ChainID=le.newBuffer(le.base64.length(i.ChainID)),0):i.ChainID.length&&(n.ChainID=i.ChainID)),i.Version!=null&&(n.Version=i.Version>>>0),i.Signature!=null&&(typeof i.Signature=="string"?le.base64.decode(i.Signature,n.Signature=le.newBuffer(le.base64.length(i.Signature)),0):i.Signature.length&&(n.Signature=i.Signature)),i.Options!=null&&(n.Options=i.Options>>>0),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(le.Long){var o=new le.Long(0,0,!0);s.Nonce=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.Nonce=n.longs===String?"0":0;if(n.bytes===String?s.Value="":(s.Value=[],n.bytes!==Array&&(s.Value=le.newBuffer(s.Value))),n.bytes===String?s.RcvAddr="":(s.RcvAddr=[],n.bytes!==Array&&(s.RcvAddr=le.newBuffer(s.RcvAddr))),n.bytes===String?s.RcvUserName="":(s.RcvUserName=[],n.bytes!==Array&&(s.RcvUserName=le.newBuffer(s.RcvUserName))),n.bytes===String?s.SndAddr="":(s.SndAddr=[],n.bytes!==Array&&(s.SndAddr=le.newBuffer(s.SndAddr))),n.bytes===String?s.SndUserName="":(s.SndUserName=[],n.bytes!==Array&&(s.SndUserName=le.newBuffer(s.SndUserName))),le.Long){var o=new le.Long(0,0,!0);s.GasPrice=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasPrice=n.longs===String?"0":0;if(le.Long){var o=new le.Long(0,0,!0);s.GasLimit=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasLimit=n.longs===String?"0":0;n.bytes===String?s.Data="":(s.Data=[],n.bytes!==Array&&(s.Data=le.newBuffer(s.Data))),n.bytes===String?s.ChainID="":(s.ChainID=[],n.bytes!==Array&&(s.ChainID=le.newBuffer(s.ChainID))),s.Version=0,n.bytes===String?s.Signature="":(s.Signature=[],n.bytes!==Array&&(s.Signature=le.newBuffer(s.Signature))),s.Options=0}return i.Nonce!=null&&i.hasOwnProperty("Nonce")&&(typeof i.Nonce=="number"?s.Nonce=n.longs===String?String(i.Nonce):i.Nonce:s.Nonce=n.longs===String?le.Long.prototype.toString.call(i.Nonce):n.longs===Number?new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0):i.Nonce),i.Value!=null&&i.hasOwnProperty("Value")&&(s.Value=n.bytes===String?le.base64.encode(i.Value,0,i.Value.length):n.bytes===Array?Array.prototype.slice.call(i.Value):i.Value),i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&(s.RcvAddr=n.bytes===String?le.base64.encode(i.RcvAddr,0,i.RcvAddr.length):n.bytes===Array?Array.prototype.slice.call(i.RcvAddr):i.RcvAddr),i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&(s.RcvUserName=n.bytes===String?le.base64.encode(i.RcvUserName,0,i.RcvUserName.length):n.bytes===Array?Array.prototype.slice.call(i.RcvUserName):i.RcvUserName),i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&(s.SndAddr=n.bytes===String?le.base64.encode(i.SndAddr,0,i.SndAddr.length):n.bytes===Array?Array.prototype.slice.call(i.SndAddr):i.SndAddr),i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&(s.SndUserName=n.bytes===String?le.base64.encode(i.SndUserName,0,i.SndUserName.length):n.bytes===Array?Array.prototype.slice.call(i.SndUserName):i.SndUserName),i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&(typeof i.GasPrice=="number"?s.GasPrice=n.longs===String?String(i.GasPrice):i.GasPrice:s.GasPrice=n.longs===String?le.Long.prototype.toString.call(i.GasPrice):n.longs===Number?new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0):i.GasPrice),i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&(typeof i.GasLimit=="number"?s.GasLimit=n.longs===String?String(i.GasLimit):i.GasLimit:s.GasLimit=n.longs===String?le.Long.prototype.toString.call(i.GasLimit):n.longs===Number?new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0):i.GasLimit),i.Data!=null&&i.hasOwnProperty("Data")&&(s.Data=n.bytes===String?le.base64.encode(i.Data,0,i.Data.length):n.bytes===Array?Array.prototype.slice.call(i.Data):i.Data),i.ChainID!=null&&i.hasOwnProperty("ChainID")&&(s.ChainID=n.bytes===String?le.base64.encode(i.ChainID,0,i.ChainID.length):n.bytes===Array?Array.prototype.slice.call(i.ChainID):i.ChainID),i.Version!=null&&i.hasOwnProperty("Version")&&(s.Version=i.Version),i.Signature!=null&&i.hasOwnProperty("Signature")&&(s.Signature=n.bytes===String?le.base64.encode(i.Signature,0,i.Signature.length):n.bytes===Array?Array.prototype.slice.call(i.Signature):i.Signature),i.Options!=null&&i.hasOwnProperty("Options")&&(s.Options=i.Options),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Ca.util.toJSONOptions)},e}(),r}();Y_.exports=lc});var eb=B(Rr=>{"use strict";f();var vR=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),ER=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AR=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&vR(e,r,t);return ER(e,r),e},IR=Rr&&Rr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var _R=IR(jr()),X_=Gr(),bR=Wu(),CR=AR(Ye()),SR=Mg(),Z_=J_(),Dy=class{serializeTransaction(e){let t=new X_.Address(e.getReceiver().bech32()).pubkey(),i=new X_.Address(e.getSender().bech32()).pubkey(),n=new Z_.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:t,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:y.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:y.Buffer.from(e.getSignature().hex(),"hex")});e.getOptions().valueOf()!==bR.TRANSACTION_OPTIONS_DEFAULT&&(n.Options=e.getOptions().valueOf());let s=Z_.proto.Transaction.encode(n).finish();return y.Buffer.from(s)}serializeTransactionValue(e){let t=new _R.default(e.toString());if(t.isZero())return y.Buffer.from([0,0]);let i=SR.bigIntToBuffer(t);return i=y.Buffer.concat([y.Buffer.from([0]),i]),i}deserializeTransaction(e){throw new CR.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=Dy});var tb=B(Gs=>{"use strict";f();var xR=Gs&&Gs.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),TR=Gs&&Gs.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&xR(e,r,t)};Object.defineProperty(Gs,"__esModule",{value:!0});TR(eb(),Gs)});var nb=B(vi=>{"use strict";f();var NR=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),DR=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),OR=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&NR(e,r,t);return DR(e,r),e};Object.defineProperty(vi,"__esModule",{value:!0});vi.Signature=void 0;var rb=OR(Ye()),ib=64,Yr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Yr.fromHex(e);if(e instanceof y.Buffer)return Yr.fromBuffer(e)}}static empty(){return new Yr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Yr.isValidHex(e))throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==ib}static fromValidHex(e){let t=new Yr;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=ib)throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};vi.Signature=Yr});var Oy=B((x$,sb)=>{f();$i.notEqual=BR;$i.notOk=MR;$i.equal=PR;$i.ok=$i;sb.exports=$i;function PR(r,e,t){$i(r==e,t)}function BR(r,e,t){$i(r!=e,t)}function MR(r,e){$i(!r,e)}function $i(r,e){if(!r)throw new Error(e||"AssertionError")}});var Ib=B(Na=>{"use strict";f();var Py=y0(),xa=w0(),ob=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Na.Buffer=ne;Na.SlowBuffer=VR;Na.INSPECT_MAX_BYTES=50;var Zf=2147483647;Na.kMaxLength=Zf;ne.TYPED_ARRAY_SUPPORT=RR();!ne.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 RR(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(ne.prototype,"parent",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.buffer}});Object.defineProperty(ne.prototype,"offset",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.byteOffset}});function Yi(r){if(r>Zf)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,ne.prototype),e}function ne(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ly(r)}return lb(r,e,t)}ne.poolSize=8192;function lb(r,e,t){if(typeof r=="string")return FR(r,e);if(ArrayBuffer.isView(r))return UR(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Ei(r,ArrayBuffer)||r&&Ei(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ei(r,SharedArrayBuffer)||r&&Ei(r.buffer,SharedArrayBuffer)))return My(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return ne.from(i,e,t);let n=qR(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return ne.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}ne.from=function(r,e,t){return lb(r,e,t)};Object.setPrototypeOf(ne.prototype,Uint8Array.prototype);Object.setPrototypeOf(ne,Uint8Array);function fb(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function LR(r,e,t){return fb(r),r<=0?Yi(r):e!==void 0?typeof t=="string"?Yi(r).fill(e,t):Yi(r).fill(e):Yi(r)}ne.alloc=function(r,e,t){return LR(r,e,t)};function Ly(r){return fb(r),Yi(r<0?0:Fy(r)|0)}ne.allocUnsafe=function(r){return Ly(r)};ne.allocUnsafeSlow=function(r){return Ly(r)};function FR(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ne.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=hb(r,e)|0,i=Yi(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function By(r){let e=r.length<0?0:Fy(r.length)|0,t=Yi(e);for(let i=0;i=Zf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zf.toString(16)+" bytes");return r|0}function VR(r){return+r!=r&&(r=0),ne.alloc(+r)}ne.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ne.prototype};ne.compare=function(e,t){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),Ei(t,Uint8Array)&&(t=ne.from(t,t.offset,t.byteLength)),!ne.isBuffer(e)||!ne.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let s=0,o=Math.min(i,n);sn.length?(ne.isBuffer(o)||(o=ne.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(ne.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function hb(r,e){if(ne.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Ei(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Ry(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ab(r).length;default:if(n)return i?-1:Ry(r).length;e=(""+e).toLowerCase(),n=!0}}ne.byteLength=hb;function HR(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return JR(this,e,t);case"utf8":case"utf-8":return pb(this,e,t);case"ascii":return $R(this,e,t);case"latin1":case"binary":return YR(this,e,t);case"base64":return kR(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return XR(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}ne.prototype._isBuffer=!0;function Ks(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}ne.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 t=0;tt&&(e+=" ... "),""};ob&&(ne.prototype[ob]=ne.prototype.inspect);ne.prototype.compare=function(e,t,i,n,s){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),!ne.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i);for(let w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,qy(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=ne.from(e,i)),ne.isBuffer(e))return e.length===0?-1:ab(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):ab(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function ab(r,e,t,i,n){let s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(p,w){return s===1?p[w]:p.readUInt16BE(w*s)}let h;if(n){let p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){let p=!0;for(let w=0;wn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return QR(this,e,t,i);case"utf8":case"utf-8":return jR(this,e,t,i);case"ascii":case"latin1":case"binary":return GR(this,e,t,i);case"base64":return KR(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zR(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function kR(r,e,t){return e===0&&t===r.length?Py.fromByteArray(r):Py.fromByteArray(r.slice(e,t))}function pb(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+a<=t){let u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return WR(i)}var ub=4096;function WR(r){let e=r.length;if(e<=ub)return String.fromCharCode.apply(String,r);let t="",i=0;for(;ii)&&(t=i);let n="";for(let s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}ne.prototype.readUintLE=ne.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};ne.prototype.readUint8=ne.prototype.readUInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]};ne.prototype.readUint16LE=ne.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]|this[e+1]<<8};ne.prototype.readUint16BE=ne.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]<<8|this[e+1]};ne.prototype.readUint32LE=ne.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ne.prototype.readUint32BE=ne.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ne.prototype.readBigUInt64LE=Nn(function(e){e=e>>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t*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+i;return(BigInt(n)<>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*t)),n};ne.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};ne.prototype.readInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ne.prototype.readInt16LE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt16BE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ne.prototype.readInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ne.prototype.readBigInt64LE=Nn(function(e){e=e>>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Ta(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,t||kt(e,4,this.length),xa.read(this,e,!0,23,4)};ne.prototype.readFloatBE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),xa.read(this,e,!1,23,4)};ne.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),xa.read(this,e,!0,52,8)};ne.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),xa.read(this,e,!1,52,8)};function mr(r,e,t,i,n,s){if(!ne.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}ne.prototype.writeUintLE=ne.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=i-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+i};ne.prototype.writeUint8=ne.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,255,0),this[t]=e&255,t+1};ne.prototype.writeUint16LE=ne.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeUint16BE=ne.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeUint32LE=ne.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};ne.prototype.writeUint32BE=ne.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function gb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function yb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}ne.prototype.writeBigUInt64LE=Nn(function(e,t=0){return gb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeBigUInt64BE=Nn(function(e,t=0){return yb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=0,o=1,a=0;for(this[t]=e&255;++s>0)-a&255;return t+i};ne.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=i-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i};ne.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};ne.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};ne.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};ne.prototype.writeBigInt64LE=Nn(function(e,t=0){return gb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ne.prototype.writeBigInt64BE=Nn(function(e,t=0){return yb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mb(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function wb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,4,34028234663852886e22,-34028234663852886e22),xa.write(r,e,t,i,23,4),t+4}ne.prototype.writeFloatLE=function(e,t,i){return wb(this,e,t,!0,i)};ne.prototype.writeFloatBE=function(e,t,i){return wb(this,e,t,!1,i)};function vb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,8,17976931348623157e292,-17976931348623157e292),xa.write(r,e,t,i,52,8),t+8}ne.prototype.writeDoubleLE=function(e,t,i){return vb(this,e,t,!0,i)};ne.prototype.writeDoubleBE=function(e,t,i){return vb(this,e,t,!1,i)};ne.prototype.copy=function(e,t,i,n){if(!ne.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s2**32?n=cb(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=cb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function cb(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function ZR(r,e,t){Ta(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&fc(e,r.length-(t+1))}function Eb(r,e,t,i,n,s){if(r>t||r3?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 <= ${t}${o}`,new Sa.ERR_OUT_OF_RANGE("value",a,r)}ZR(i,n,s)}function Ta(r,e){if(typeof r!="number")throw new Sa.ERR_INVALID_ARG_TYPE(e,"number",r)}function fc(r,e,t){throw Math.floor(r)!==r?(Ta(r,t),new Sa.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Sa.ERR_BUFFER_OUT_OF_BOUNDS:new Sa.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var eL=/[^+/0-9A-Za-z-_]/g;function tL(r){if(r=r.split("=")[0],r=r.trim().replace(eL,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Ry(r,e){e=e||1/0;let t,i=r.length,n=null,s=[];for(let o=0;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function rL(r){let e=[];for(let t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function Ab(r){return Py.toByteArray(tL(r))}function eh(r,e,t,i){let n;for(n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function Ei(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function qy(r){return r!==r}var nL=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function Nn(r){return typeof BigInt>"u"?sL:r}function sL(){throw new Error("BigInt not supported")}});var bb=B((P$,_b)=>{f();_b.exports=Vy;Vy.supported=typeof WebAssembly<"u";function Vy(r){if(!Vy.supported)return null;var e=r&&r.imports,t=oL("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"),i=null,n={buffer:t,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),n;function s(u){n.exports.memory.grow(Math.ceil(Math.abs(u-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function o(u){if(n.exports)return u();if(i){i.then(u.bind(null,null)).catch(u);return}try{if(r&&r.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{i=WebAssembly.instantiate(t,e).then(a)}o(u)}function a(u){n.exports=u.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function oL(r){return typeof atob=="function"?new Uint8Array(atob(r).split("").map(aL)):new(Ib()).Buffer(r,"base64")}function aL(r){return r.charCodeAt(0)}});var Ob=B((L$,Ii)=>{f();var Ai=Oy(),ke=bb()(),Ji=64,th=[];Ii.exports=Lr;var Cb=Ii.exports.BYTES_MIN=16,Sb=Ii.exports.BYTES_MAX=64,M$=Ii.exports.BYTES=32,xb=Ii.exports.KEYBYTES_MIN=16,Tb=Ii.exports.KEYBYTES_MAX=64,R$=Ii.exports.KEYBYTES=32,Nb=Ii.exports.SALTBYTES=16,Db=Ii.exports.PERSONALBYTES=16;function Lr(r,e,t,i,n){if(!(this instanceof Lr))return new Lr(r,e,t,i,n);if(!(ke&&ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");r||(r=32),n!==!0&&(Ai(r>=Cb,"digestLength must be at least "+Cb+", was given "+r),Ai(r<=Sb,"digestLength must be at most "+Sb+", was given "+r),e!=null&&Ai(e.length>=xb,"key must be at least "+xb+", was given "+e.length),e!=null&&Ai(e.length<=Tb,"key must be at least "+Tb+", was given "+e.length),t!=null&&Ai(t.length===Nb,"salt must be exactly "+Nb+", was given "+t.length),i!=null&&Ai(i.length===Db,"personal must be exactly "+Db+", was given "+i.length)),th.length||(th.push(Ji),Ji+=216),this.digestLength=r,this.finalized=!1,this.pointer=th.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,t&&ke.memory.set(t,32),i&&ke.memory.set(i,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,Ji,Ji+e.length),ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(r){return Ai(this.finalized===!1,"Hash instance finalized"),Ai(r,"input must be TypedArray or Buffer"),Ji+r.length>ke.memory.length&&ke.realloc(Ji+r.length),ke.memory.set(r,Ji),ke.exports.blake2b_update(this.pointer,Ji,Ji+r.length),this};Lr.prototype.digest=function(r){if(Ai(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,th.push(this.pointer),ke.exports.blake2b_final(this.pointer),!r||r==="binary")return ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(r==="hex")return cL(ke.memory,this.pointer+128,this.digestLength);Ai(r.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{f();var Pn=Oy(),dc=Ob();function rh(r,e,t){var i=r[e]+r[t],n=r[e+1]+r[t+1];i>=4294967296&&n++,r[e]=i,r[e+1]=n}function Pb(r,e,t,i){var n=r[e]+t;t<0&&(n+=4294967296);var s=r[e+1]+i;n>=4294967296&&s++,r[e]=n,r[e+1]=s}function qb(r,e){return r[e]^r[e+1]<<8^r[e+2]<<16^r[e+3]<<24}function Dn(r,e,t,i,n,s){var o=hc[n],a=hc[n+1],u=hc[s],h=hc[s+1];rh(Se,r,e),Pb(Se,r,o,a);var p=Se[i]^Se[r],w=Se[i+1]^Se[r+1];Se[i]=w,Se[i+1]=p,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=p>>>24^w<<8,Se[e+1]=w>>>24^p<<8,rh(Se,r,e),Pb(Se,r,u,h),p=Se[i]^Se[r],w=Se[i+1]^Se[r+1],Se[i]=p>>>16^w<<16,Se[i+1]=w>>>16^p<<16,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=w>>>31^p<<1,Se[e+1]=p>>>31^w<<1}var Vb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),fL=[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],ar=new Uint8Array(fL.map(function(r){return r*2})),Se=new Uint32Array(32),hc=new Uint32Array(32);function Hb(r,e){var t=0;for(t=0;t<16;t++)Se[t]=r.h[t],Se[t+16]=Vb[t];for(Se[24]=Se[24]^r.t,Se[25]=Se[25]^r.t/4294967296,e&&(Se[28]=~Se[28],Se[29]=~Se[29]),t=0;t<32;t++)hc[t]=qb(r.b,4*t);for(t=0;t<12;t++)Dn(0,8,16,24,ar[t*16+0],ar[t*16+1]),Dn(2,10,18,26,ar[t*16+2],ar[t*16+3]),Dn(4,12,20,28,ar[t*16+4],ar[t*16+5]),Dn(6,14,22,30,ar[t*16+6],ar[t*16+7]),Dn(0,10,20,30,ar[t*16+8],ar[t*16+9]),Dn(2,12,22,24,ar[t*16+10],ar[t*16+11]),Dn(4,14,16,26,ar[t*16+12],ar[t*16+13]),Dn(6,8,18,28,ar[t*16+14],ar[t*16+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^Se[t]^Se[t+16]}var On=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 Da(r,e,t,i){On.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=r,On[0]=r,e&&(On[1]=e.length),On[2]=1,On[3]=1,t&&On.set(t,32),i&&On.set(i,48);for(var n=0;n<16;n++)this.h[n]=Vb[n]^qb(On,n*4);e&&(Qb(this,e),this.c=128)}Da.prototype.update=function(r){return Pn(r!=null,"input must be Uint8Array or Buffer"),Qb(this,r),this};Da.prototype.digest=function(r){var e=!r||r==="binary"||r==="hex"?new Uint8Array(this.outlen):r;return Pn(e.length>=this.outlen,"out must have at least outlen bytes of space"),hL(this,e),r==="hex"?dL(e):e};Da.prototype.final=Da.prototype.digest;Da.ready=function(r){dc.ready(function(){r()})};function Qb(r,e){for(var t=0;t>2]>>8*(t&3);return e}function dL(r){for(var e="",t=0;t=Bb,"outlen must be at least "+Bb+", was given "+e),Pn(e<=Mb,"outlen must be at most "+Mb+", was given "+e),t!=null&&Pn(t.length>=Rb,"key must be at least "+Rb+", was given "+t.length),t!=null&&Pn(t.length<=Lb,"key must be at most "+Lb+", was given "+t.length),i!=null&&Pn(i.length===Fb,"salt must be exactly "+Fb+", was given "+i.length),n!=null&&Pn(n.length===Ub,"personal must be exactly "+Ub+", was given "+n.length)),new jb(e,t,i,n)};wr.exports.ready=function(r){dc.ready(function(){r()})};wr.exports.WASM_SUPPORTED=dc.SUPPORTED;wr.exports.WASM_LOADED=!1;var Bb=wr.exports.BYTES_MIN=16,Mb=wr.exports.BYTES_MAX=64,U$=wr.exports.BYTES=32,Rb=wr.exports.KEYBYTES_MIN=16,Lb=wr.exports.KEYBYTES_MAX=64,q$=wr.exports.KEYBYTES=32,Fb=wr.exports.SALTBYTES=16,Ub=wr.exports.PERSONALBYTES=16;dc.ready(function(r){r||(wr.exports.WASM_LOADED=!0,jb=dc)})});var jy=B(Fr=>{"use strict";f();var gL=Fr&&Fr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),yL=Fr&&Fr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),mL=Fr&&Fr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gL(e,r,t);return yL(e,r),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var Oa=jr(),Hy=Gr(),wL=Wu(),vL=mL(Ye()),EL=YI(),Qy=XI(),AL=tb(),Kb=nb(),zb=sc(),IL=Tr(),_L=Gb(),bL=32,pc=class{constructor({nonce:e,value:t,receiver:i,sender:n,gasPrice:s,gasLimit:o,data:a,chainID:u,version:h,options:p}){this.nonce=e||0,this.value=t?new Oa.BigNumber(t.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.gasPrice=s||wL.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new zb.TransactionPayload,this.chainID=u,this.version=h||Qy.TransactionVersion.withDefaultVersion(),this.options=p||Qy.TransactionOptions.withDefaultOptions(),this.signature=Kb.Signature.empty(),this.hash=zs.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}getReceiver(){return this.receiver}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}getOptions(){return this.options}getSignature(){return this.signature}getHash(){return IL.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(e){let t=this.toPlainObject(e);t.signature&&delete t.signature;let i=JSON.stringify(t);return y.Buffer.from(i)}toPlainObject(e){return{nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:e?e.bech32():this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),signature:this.signature.hex()?this.signature.hex():void 0}}static fromPlainObject(e){let t=new pc({nonce:Number(e.nonce),value:new Oa.BigNumber(e.value).toFixed(0),receiver:Hy.Address.fromString(e.receiver),sender:Hy.Address.fromString(e.sender),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new zb.TransactionPayload(y.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Qy.TransactionVersion(e.version)});return e.signature&&t.applySignature(new Kb.Signature(e.signature),Hy.Address.fromString(e.sender)),t}applySignature(e,t){this.signature=e,this.sender=t,this.hash=zs.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let t=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(t>this.gasLimit.valueOf())throw new vL.ErrNotEnoughGas(this.gasLimit.valueOf());let i=new Oa.BigNumber(this.gasPrice.valueOf()),n=new Oa.BigNumber(t).multipliedBy(i);if(t===this.gasLimit.valueOf())return n;let s=new Oa.BigNumber(this.gasLimit.valueOf()-t),o=i.multipliedBy(new Oa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return n.plus(a)}};Fr.Transaction=pc;var zs=class extends EL.Hash{constructor(e){super(e)}static compute(e){let i=new AL.ProtoSerializer().serializeTransaction(e),n=_L(bL).update(i).digest("hex");return new zs(n)}};Fr.TransactionHash=zs});var Gy=B(Ws=>{"use strict";f();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Logger=Ws.LogLevel=void 0;var ks;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warn=3]="Warn",r[r.Error=4]="Error",r[r.None=5]="None"})(ks=Ws.LogLevel||(Ws.LogLevel={}));var Jr=class{static setLevel(e){Jr.logLevel=e}static trace(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static debug(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static info(e,...t){Jr.logLevel>=ks.Info||console.log(e,t)}static warn(e,...t){Jr.logLevel>=ks.Warn||console.warn(e,t)}static error(e,...t){Jr.logLevel>=ks.Error||console.error(e,t)}};Ws.Logger=Jr;Jr.logLevel=ks.Debug});var kb=B(_i=>{"use strict";f();var CL=_i&&_i.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),SL=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),xL=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&CL(e,r,t);return SL(e,r),e};Object.defineProperty(_i,"__esModule",{value:!0});_i.AsyncTimer=void 0;var TL=xL(Ye()),NL=Ye(),Ky=Gy(),zy=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new TL.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((t,i)=>{this.rejectionFunc=i;let n=()=>{this.rejectionFunc=null,this.stop(),t()};this.timeoutHandle=setTimeout(n,e)})}abort(){Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new NL.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_i.AsyncTimer=zy});var Wy=B(Ba=>{"use strict";f();var Ur=Ba&&Ba.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Ba,"__esModule",{value:!0});Ba.TransactionWatcher=void 0;var Wb=kb(),$b=Gy(),Pa=Ye(),bi=class{constructor(e,t=bi.DefaultPollingInterval,i=bi.DefaultTimeout){this.fetcher=new ky(e),this.pollingInterval=t,this.timeout=i}awaitPending(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.status.isPending(),i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Pa.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitCompleted(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.isCompleted,i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Pa.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitAllEvents(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.every(h=>a.includes(h))},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Pa.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitAnyEvent(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.find(h=>a.includes(h))!=null},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Pa.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitOnCondition(e,t){return Ur(this,void 0,void 0,function*(){let i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Pa.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitConditionally(e,t,i){return Ur(this,void 0,void 0,function*(){let n=new Wb.AsyncTimer("watcher:periodic"),s=new Wb.AsyncTimer("watcher:timeout"),o=!1,a,u=!1;for(s.start(this.timeout).finally(()=>{s.stop(),o=!0});!o;){yield n.start(this.pollingInterval);try{if(a=yield t(),u=e(a),u||o)break}catch(h){if($b.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(h instanceof Pa.Err))throw h}}if(s.isStopped()||s.stop(),!a||!u)throw i();return a})}getAllTransactionEvents(e){let t=[...e.logs.events];for(let i of e.contractResults.items)t.push(...i.logs.events);return t}};Ba.TransactionWatcher=bi;bi.DefaultPollingInterval=6e3;bi.DefaultTimeout=bi.DefaultPollingInterval*15;bi.NoopOnStatusReceived=r=>{};var ky=class{constructor(e){this.fetcher=e}getTransaction(e){return Ur(this,void 0,void 0,function*(){return $b.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var Yb=B(Ci=>{"use strict";f();var DL=Ci&&Ci.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),OL=Ci&&Ci.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),PL=Ci&&Ci.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&DL(e,r,t);return OL(e,r),e};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ContractFunction=void 0;var BL=PL(Ye()),gc=class{constructor(e){if(this.name=e,e==null)throw new BL.ErrInvalidFunctionName}static none(){return new gc("untitled")}toString(){return this.name}valueOf(){return this.name}equals(e){return e?this.name==e.name:!1}};Ci.ContractFunction=gc});var Jb=B(Ma=>{"use strict";f();Object.defineProperty(Ma,"__esModule",{value:!0});Ma.Signature=Ma.Address=void 0;var $y=class{constructor(e){this.value=e}bech32(){return this.value}};Ma.Address=$y;var Yy=class{constructor(e){this.value=e}hex(){return this.value}};Ma.Signature=Yy});var Xb=B(yc=>{"use strict";f();Object.defineProperty(yc,"__esModule",{value:!0});yc.Operation=void 0;var ML;(function(r){r.Connect="connect",r.Logout="logout",r.SignTransactions="signTransactions",r.SignMessage="signMessage",r.CancelAction="cancelAction"})(ML=yc.Operation||(yc.Operation={}))});var Zb=B(Bn=>{"use strict";f();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.ErrAccountNotConnected=Bn.ErrCannotSignSingleTransaction=Bn.Err=void 0;var mc=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Bn.Err=mc;var Jy=class extends mc{constructor(){super("Cannot sign single transaction.")}};Bn.ErrCannotSignSingleTransaction=Jy;var Xy=class extends mc{constructor(){super("Account is not connected.")}};Bn.ErrAccountNotConnected=Xy});var Zy=B(Ra=>{"use strict";f();var Mn=Ra&&Ra.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Ra,"__esModule",{value:!0});Ra.ExtensionProvider=void 0;var ih=Jb(),wc=Xb(),eC=Zb(),Si=class{constructor(){if(this.account={address:""},this.initialized=!1,Si._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");Si._instance=this}static getInstance(){return Si._instance}setAddress(e){return this.account.address=e,Si._instance}init(){return Mn(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Mn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:t}=e,i=t||"";return yield this.startBgrMsgChannel(wc.Operation.Connect,i),this.account.address})}logout(){return Mn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(wc.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 Mn(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 Mn(this,void 0,void 0,function*(){return Boolean(this.account.address)})}signTransaction(e){return Mn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.signTransactions([e]);if(t.length!=1)throw new eC.ErrCannotSignSingleTransaction;return t[0]})}ensureConnected(){if(!this.account.address)throw new eC.ErrAccountNotConnected}signTransactions(e){return Mn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.startBgrMsgChannel(wc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(i=>i.toPlainObject())});try{for(let i=0;i{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);let n=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&Boolean(s.data.data.address)&&(this.account=s.data.data),window.removeEventListener("message",n),i(s.data.data)):(window.removeEventListener("message",n),i(s.data.data)))};window.addEventListener("message",n,!1)})}};Ra.ExtensionProvider=Si;Si._instance=new Si});var oC=B((gY,sC)=>{"use strict";f();function RL(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}sC.exports=LL;function LL(r,e,t){var i=t&&t.stringify||RL,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var a=1;a-1?w:0,r.charCodeAt(O+1)){case 100:case 102:if(p>=u||e[p]==null)break;w=u||e[p]==null)break;w=u||e[p]===void 0)break;w",w=O+2,O++;break}h+=i(e[p]),w=O+2,O++;break;case 115:if(p>=u)break;w{"use strict";f();var aC=oC();lC.exports=Ti;var vc=zL().console||{},FL={mapHttpRequest:uh,mapHttpResponse:uh,wrapRequestSerializer:em,wrapResponseSerializer:em,wrapErrorSerializer:em,req:uh,res:uh,err:QL};function UL(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Ti(r){r=r||{},r.browser=r.browser||{};let e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let t=r.browser.write||vc;r.browser.write&&(r.browser.asObject=!0);let i=r.serializers||{},n=UL(r.browser.serialize,i),s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");let a=r.level||"info",u=Object.create(t);u.log||(u.log=Ec),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:w,set:N});let h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:jL(r)};u.levels=Ti.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=Ec,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=O,e&&(u._logEvent=tm());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function N(T){if(T!=="silent"&&!this.levels.values[T])throw Error("unknown level "+T);this._level=T,La(h,u,"error","log"),La(h,u,"fatal","error"),La(h,u,"warn","error"),La(h,u,"info","log"),La(h,u,"debug","log"),La(h,u,"trace","log")}function O(T,V){if(!T)throw new Error("missing bindings for child Pino");V=V||{},n&&T.serializers&&(V.serializers=T.serializers);let z=V.serializers;if(n&&z){var $=Object.assign({},i,z),se=r.browser.serialize===!0?Object.keys($):n;delete T.serializers,ch([T],se,$,this._stdErrSerialize)}function Y(j){this._childLevel=(j._childLevel|0)+1,this.error=Fa(j,T,"error"),this.fatal=Fa(j,T,"fatal"),this.warn=Fa(j,T,"warn"),this.info=Fa(j,T,"info"),this.debug=Fa(j,T,"debug"),this.trace=Fa(j,T,"trace"),$&&(this.serializers=$,this._serialize=se),e&&(this._logEvent=tm([].concat(j._logEvent.bindings,T)))}return Y.prototype=this,new Y(this)}return u}Ti.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"}};Ti.stdSerializers=FL;Ti.stdTimeFunctions=Object.assign({},{nullTime:uC,epochTime:cC,unixTime:GL,isoTime:KL});function La(r,e,t,i){let n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Ec:n[t]?n[t]:vc[t]||vc[i]||Ec,qL(r,e,t)}function qL(r,e,t){!r.transmit&&e[t]===Ec||(e[t]=function(i){return function(){let s=r.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vc?vc:this;for(var u=0;u-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Fa(r,e,t){return function(){let i=new Array(1+arguments.length);i[0]=e;for(var n=1;n{"use strict";f();var Ua=typeof Reflect=="object"?Reflect:null,fC=Ua&&typeof Ua.apply=="function"?Ua.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},fh;Ua&&typeof Ua.ownKeys=="function"?fh=Ua.ownKeys:Object.getOwnPropertySymbols?fh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:fh=function(e){return Object.getOwnPropertyNames(e)};function kL(r){console&&console.warn&&console.warn(r)}var dC=Number.isNaN||function(e){return e!==e};function je(){je.init.call(this)}rm.exports=je;rm.exports.once=JL;je.EventEmitter=je;je.prototype._events=void 0;je.prototype._eventsCount=0;je.prototype._maxListeners=void 0;var hC=10;function hh(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return hC},set:function(r){if(typeof r!="number"||r<0||dC(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");hC=r}});je.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};je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dC(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 pC(r){return r._maxListeners===void 0?je.defaultMaxListeners:r._maxListeners}je.prototype.getMaxListeners=function(){return pC(this)};je.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[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")fC(u,this,t);else for(var h=u.length,p=vC(u,h),i=0;i0&&o.length>n&&!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=r,a.type=e,a.count=o.length,kL(a)}return r}je.prototype.addListener=function(e,t){return gC(this,e,t,!1)};je.prototype.on=je.prototype.addListener;je.prototype.prependListener=function(e,t){return gC(this,e,t,!0)};function WL(){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 yC(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=WL.bind(i);return n.listener=t,i.wrapFn=n,n}je.prototype.once=function(e,t){return hh(t),this.on(e,yC(this,e,t)),this};je.prototype.prependOnceListener=function(e,t){return hh(t),this.prependListener(e,yC(this,e,t)),this};je.prototype.removeListener=function(e,t){var i,n,s,o,a;if(hh(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():$L(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};je.prototype.off=je.prototype.removeListener;je.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function mC(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?YL(n):vC(n,n.length)}je.prototype.listeners=function(e){return mC(this,e,!0)};je.prototype.rawListeners=function(e){return mC(this,e,!1)};je.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):wC.call(r,e)};je.prototype.listenerCount=wC;function wC(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}je.prototype.eventNames=function(){return this._eventsCount>0?fh(this._events):[]};function vC(r,e){for(var t=new Array(e),i=0;inm,__asyncDelegator:()=>f5,__asyncGenerator:()=>l5,__asyncValues:()=>h5,__await:()=>Ac,__awaiter:()=>n5,__classPrivateFieldGet:()=>y5,__classPrivateFieldSet:()=>m5,__createBinding:()=>o5,__decorate:()=>t5,__exportStar:()=>a5,__extends:()=>ZL,__generator:()=>s5,__importDefault:()=>g5,__importStar:()=>p5,__makeTemplateObject:()=>d5,__metadata:()=>i5,__param:()=>r5,__read:()=>AC,__rest:()=>e5,__spread:()=>u5,__spreadArrays:()=>c5,__values:()=>sm});function ZL(r,e){im(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function e5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n=0;a--)(o=r[a])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function r5(r,e){return function(t,i){e(t,i,r)}}function i5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function n5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})}function s5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,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(h){return function(p){return u([h,p])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=h[0]&2?n.return:h[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,h[1])).done)return s;switch(n=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,n=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function AC(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function u5(){for(var r=[],e=0;e1||a(N,O)})})}function a(N,O){try{u(i[N](O))}catch(T){w(s[0][3],T)}}function u(N){N.value instanceof Ac?Promise.resolve(N.value.v).then(h,p):w(s[0][2],N)}function h(N){a("next",N)}function p(N){a("throw",N)}function w(N,O){N(O),s.shift(),s.length&&a(s[0][0],s[0][1])}}function f5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(o){return(t=!t)?{value:Ac(r[n](o)),done:n==="return"}:s?s(o):o}:s}}function h5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof sm=="function"?sm(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(o){return new Promise(function(a,u){o=r[s](o),n(a,u,o.done,o.value)})}}function n(s,o,a,u){Promise.resolve(u).then(function(h){s({value:h,done:a})},o)}}function d5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function p5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function g5(r){return r&&r.__esModule?r:{default:r}}function y5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function m5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var im,nm,br=me(()=>{f();im=function(r,e){return im=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},im(r,e)};nm=function(){return nm=Object.assign||function(e){for(var t,i=1,n=arguments.length;i{"use strict";f();Object.defineProperty(dh,"__esModule",{value:!0});function w5(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}dh.safeJsonParse=w5;function v5(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}dh.safeJsonStringify=v5});var IC=B((bY,ph)=>{"use strict";f();(function(){"use strict";let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){let t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?ph.exports=global.localStorage:typeof window<"u"&&window.localStorage?ph.exports=window.localStorage:ph.exports=new e})()});var _C=B(gh=>{"use strict";f();Object.defineProperty(gh,"__esModule",{value:!0});gh.IKeyValueStorage=void 0;var am=class{};gh.IKeyValueStorage=am});var bC=B(yh=>{"use strict";f();Object.defineProperty(yh,"__esModule",{value:!0});yh.parseEntry=void 0;var E5=om();function A5(r){var e;return[r[0],E5.safeJsonParse((e=r[1])!==null&&e!==void 0?e:"")]}yh.parseEntry=A5});var SC=B(mh=>{"use strict";f();Object.defineProperty(mh,"__esModule",{value:!0});var CC=(br(),at(_r));CC.__exportStar(_C(),mh);CC.__exportStar(bC(),mh)});var TC=B(Ic=>{"use strict";f();Object.defineProperty(Ic,"__esModule",{value:!0});Ic.KeyValueStorage=void 0;var qa=(br(),at(_r)),xC=om(),I5=qa.__importDefault(IC()),_5=SC(),wh=class{constructor(){this.localStorage=I5.default}getKeys(){return qa.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return qa.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(_5.parseEntry)})}getItem(e){return qa.__awaiter(this,void 0,void 0,function*(){let t=this.localStorage.getItem(e);if(t!==null)return xC.safeJsonParse(t)})}setItem(e,t){return qa.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,xC.safeJsonStringify(t))})}removeItem(e){return qa.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Ic.KeyValueStorage=wh;Ic.default=wh});var NC=B(vh=>{"use strict";f();Object.defineProperty(vh,"__esModule",{value:!0});vh.delay=void 0;function b5(r){return new Promise(e=>{setTimeout(()=>{e(!0)},r)})}vh.delay=b5});var DC=B(Va=>{"use strict";f();Object.defineProperty(Va,"__esModule",{value:!0});Va.ONE_THOUSAND=Va.ONE_HUNDRED=void 0;Va.ONE_HUNDRED=100;Va.ONE_THOUSAND=1e3});var OC=B(ye=>{"use strict";f();Object.defineProperty(ye,"__esModule",{value:!0});ye.ONE_YEAR=ye.FOUR_WEEKS=ye.THREE_WEEKS=ye.TWO_WEEKS=ye.ONE_WEEK=ye.THIRTY_DAYS=ye.SEVEN_DAYS=ye.FIVE_DAYS=ye.THREE_DAYS=ye.ONE_DAY=ye.TWENTY_FOUR_HOURS=ye.TWELVE_HOURS=ye.SIX_HOURS=ye.THREE_HOURS=ye.ONE_HOUR=ye.SIXTY_MINUTES=ye.THIRTY_MINUTES=ye.TEN_MINUTES=ye.FIVE_MINUTES=ye.ONE_MINUTE=ye.SIXTY_SECONDS=ye.THIRTY_SECONDS=ye.TEN_SECONDS=ye.FIVE_SECONDS=ye.ONE_SECOND=void 0;ye.ONE_SECOND=1;ye.FIVE_SECONDS=5;ye.TEN_SECONDS=10;ye.THIRTY_SECONDS=30;ye.SIXTY_SECONDS=60;ye.ONE_MINUTE=ye.SIXTY_SECONDS;ye.FIVE_MINUTES=ye.ONE_MINUTE*5;ye.TEN_MINUTES=ye.ONE_MINUTE*10;ye.THIRTY_MINUTES=ye.ONE_MINUTE*30;ye.SIXTY_MINUTES=ye.ONE_MINUTE*60;ye.ONE_HOUR=ye.SIXTY_MINUTES;ye.THREE_HOURS=ye.ONE_HOUR*3;ye.SIX_HOURS=ye.ONE_HOUR*6;ye.TWELVE_HOURS=ye.ONE_HOUR*12;ye.TWENTY_FOUR_HOURS=ye.ONE_HOUR*24;ye.ONE_DAY=ye.TWENTY_FOUR_HOURS;ye.THREE_DAYS=ye.ONE_DAY*3;ye.FIVE_DAYS=ye.ONE_DAY*5;ye.SEVEN_DAYS=ye.ONE_DAY*7;ye.THIRTY_DAYS=ye.ONE_DAY*30;ye.ONE_WEEK=ye.SEVEN_DAYS;ye.TWO_WEEKS=ye.ONE_WEEK*2;ye.THREE_WEEKS=ye.ONE_WEEK*3;ye.FOUR_WEEKS=ye.ONE_WEEK*4;ye.ONE_YEAR=ye.ONE_DAY*365});var um=B(Eh=>{"use strict";f();Object.defineProperty(Eh,"__esModule",{value:!0});var PC=(br(),at(_r));PC.__exportStar(DC(),Eh);PC.__exportStar(OC(),Eh)});var MC=B(Ha=>{"use strict";f();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.fromMiliseconds=Ha.toMiliseconds=void 0;var BC=um();function C5(r){return r*BC.ONE_THOUSAND}Ha.toMiliseconds=C5;function S5(r){return Math.floor(r/BC.ONE_THOUSAND)}Ha.fromMiliseconds=S5});var LC=B(Ah=>{"use strict";f();Object.defineProperty(Ah,"__esModule",{value:!0});var RC=(br(),at(_r));RC.__exportStar(NC(),Ah);RC.__exportStar(MC(),Ah)});var FC=B(_c=>{"use strict";f();Object.defineProperty(_c,"__esModule",{value:!0});_c.Watch=void 0;var Ih=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 t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let i=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:i})}get(e){let t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};_c.Watch=Ih;_c.default=Ih});var UC=B(_h=>{"use strict";f();Object.defineProperty(_h,"__esModule",{value:!0});_h.IWatch=void 0;var cm=class{};_h.IWatch=cm});var qC=B(lm=>{"use strict";f();Object.defineProperty(lm,"__esModule",{value:!0});var x5=(br(),at(_r));x5.__exportStar(UC(),lm)});var Ys=B(Qa=>{"use strict";f();Object.defineProperty(Qa,"__esModule",{value:!0});var bh=(br(),at(_r));bh.__exportStar(LC(),Qa);bh.__exportStar(FC(),Qa);bh.__exportStar(qC(),Qa);bh.__exportStar(um(),Qa)});var fm,VC=me(()=>{f();fm=class{}});var hm={};ot(hm,{IEvents:()=>fm});var dm=me(()=>{f();VC()});var HC=B(Ch=>{"use strict";f();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.IHeartBeat=void 0;var T5=(dm(),at(hm)),pm=class extends T5.IEvents{constructor(e){super()}};Ch.IHeartBeat=pm});var ym=B(gm=>{"use strict";f();Object.defineProperty(gm,"__esModule",{value:!0});var N5=(br(),at(_r));N5.__exportStar(HC(),gm)});var QC=B(ja=>{"use strict";f();Object.defineProperty(ja,"__esModule",{value:!0});ja.HEARTBEAT_EVENTS=ja.HEARTBEAT_INTERVAL=void 0;var D5=Ys();ja.HEARTBEAT_INTERVAL=D5.FIVE_SECONDS;ja.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var wm=B(mm=>{"use strict";f();Object.defineProperty(mm,"__esModule",{value:!0});var O5=(br(),at(_r));O5.__exportStar(QC(),mm)});var jC=B(Sh=>{"use strict";f();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.HeartBeat=void 0;var vm=(br(),at(_r)),P5=$s(),B5=Ys(),M5=ym(),Em=wm(),bc=class extends M5.IHeartBeat{constructor(e){super(e),this.events=new P5.EventEmitter,this.interval=Em.HEARTBEAT_INTERVAL,this.interval=e?.interval||Em.HEARTBEAT_INTERVAL}static init(e){return vm.__awaiter(this,void 0,void 0,function*(){let t=new bc(e);return yield t.init(),t})}init(){return vm.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return vm.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),B5.toMiliseconds(this.interval))})}pulse(){this.events.emit(Em.HEARTBEAT_EVENTS.pulse)}};Sh.HeartBeat=bc});var GC=B(Cc=>{"use strict";f();Object.defineProperty(Cc,"__esModule",{value:!0});var Am=(br(),at(_r));Am.__exportStar(jC(),Cc);Am.__exportStar(ym(),Cc);Am.__exportStar(wm(),Cc)});var Im=B(Ga=>{"use strict";f();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.PINO_CUSTOM_CONTEXT_KEY=Ga.PINO_LOGGER_DEFAULTS=void 0;Ga.PINO_LOGGER_DEFAULTS={level:"info"};Ga.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var $C=B(vr=>{"use strict";f();Object.defineProperty(vr,"__esModule",{value:!0});vr.generateChildLogger=vr.formatChildLoggerContext=vr.getLoggerContext=vr.setBrowserLoggerContext=vr.getBrowserLoggerContext=vr.getDefaultLoggerOptions=void 0;var Ka=Im();function R5(r){return Object.assign(Object.assign({},r),{level:r?.level||Ka.PINO_LOGGER_DEFAULTS.level})}vr.getDefaultLoggerOptions=R5;function KC(r,e=Ka.PINO_CUSTOM_CONTEXT_KEY){return r[e]||""}vr.getBrowserLoggerContext=KC;function zC(r,e,t=Ka.PINO_CUSTOM_CONTEXT_KEY){return r[t]=e,r}vr.setBrowserLoggerContext=zC;function kC(r,e=Ka.PINO_CUSTOM_CONTEXT_KEY){let t="";return typeof r.bindings>"u"?t=KC(r,e):t=r.bindings().context||"",t}vr.getLoggerContext=kC;function WC(r,e,t=Ka.PINO_CUSTOM_CONTEXT_KEY){let i=kC(r,t);return i.trim()?`${i}/${e}`:e}vr.formatChildLoggerContext=WC;function L5(r,e,t=Ka.PINO_CUSTOM_CONTEXT_KEY){let i=WC(r,e,t),n=r.child({context:i});return zC(n,i,t)}vr.generateChildLogger=L5});var bm=B(za=>{"use strict";f();Object.defineProperty(za,"__esModule",{value:!0});za.pino=void 0;var _m=(br(),at(_r)),F5=_m.__importDefault(lh());Object.defineProperty(za,"pino",{enumerable:!0,get:function(){return F5.default}});_m.__exportStar(Im(),za);_m.__exportStar($C(),za)});var Hm=B(Wt=>{"use strict";f();Object.defineProperty(Wt,"__esModule",{value:!0});var ka=(dm(),at(hm)),YC=$s();function U5(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var q5=U5(YC),Cm=class extends ka.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Sm=class{constructor(e,t,i){this.core=e,this.logger=t}},xm=class extends ka.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Tm=class{constructor(e,t){this.logger=e,this.core=t}},Nm=class extends ka.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Dm=class extends ka.IEvents{constructor(e){super()}},Om=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},Pm=class{constructor(){this.map=new Map}},Bm=class extends ka.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Mm=class{constructor(e,t){this.core=e,this.logger=t}},Rm=class extends ka.IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},Lm=class{constructor(e,t){this.logger=e,this.core=t}},Fm=class extends q5.default{constructor(){super()}},Um=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qm=class extends YC.EventEmitter{constructor(){super()}},Vm=class{constructor(e){this.client=e}};Wt.ICore=Cm,Wt.ICrypto=Sm,Wt.IEngine=Vm,Wt.IEngineEvents=qm,Wt.IExpirer=Rm,Wt.IJsonRpcHistory=xm,Wt.IKeyChain=Mm,Wt.IMessageTracker=Tm,Wt.IPairing=Lm,Wt.IPublisher=Nm,Wt.IRelayer=Dm,Wt.ISignClient=Um,Wt.ISignClientEvents=Fm,Wt.IStore=Om,Wt.ISubscriber=Bm,Wt.ISubscriberTopicMap=Pm});var JC={};ot(JC,{safeJsonParse:()=>Sc,safeJsonStringify:()=>xc});function Sc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}function xc(r){return typeof r=="string"?r:JSON.stringify(r)}var xh=me(()=>{f()});var ZC=B(Th=>{"use strict";f();Object.defineProperty(Th,"__esModule",{value:!0});Th.BrowserRandomSource=void 0;var XC=65536,Qm=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 t=new Uint8Array(e);for(let i=0;i{"use strict";f();Object.defineProperty(jm,"__esModule",{value:!0});function V5(r){for(var e=0;e{f()});var tS=B(Nh=>{"use strict";f();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.NodeRandomSource=void 0;var H5=qr(),Gm=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof PE<"u"){let e=eS();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 t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let i=new Uint8Array(e);for(let n=0;n{"use strict";f();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.SystemRandomSource=void 0;var Q5=ZC(),j5=tS(),Km=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new Q5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new j5.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)}};Dh.SystemRandomSource=Km});var iS=B(Cr=>{"use strict";f();Object.defineProperty(Cr,"__esModule",{value:!0});function G5(r,e){var t=r>>>16&65535,i=r&65535,n=e>>>16&65535,s=e&65535;return i*s+(t*s+i*n<<16>>>0)|0}Cr.mul=Math.imul||G5;function K5(r,e){return r+e|0}Cr.add=K5;function z5(r,e){return r-e|0}Cr.sub=z5;function k5(r,e){return r<>>32-e}Cr.rotl=k5;function W5(r,e){return r<<32-e|r>>>e}Cr.rotr=W5;function $5(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}Cr.isInteger=Number.isInteger||$5;Cr.MAX_SAFE_INTEGER=9007199254740991;Cr.isSafeInteger=function(r){return Cr.isInteger(r)&&r>=-Cr.MAX_SAFE_INTEGER&&r<=Cr.MAX_SAFE_INTEGER}});var Wa=B(Oe=>{"use strict";f();Object.defineProperty(Oe,"__esModule",{value:!0});var nS=iS();function Y5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Oe.readInt16BE=Y5;function J5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Oe.readUint16BE=J5;function X5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Oe.readInt16LE=X5;function Z5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Oe.readUint16LE=Z5;function sS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Oe.writeUint16BE=sS;Oe.writeInt16BE=sS;function oS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Oe.writeUint16LE=oS;Oe.writeInt16LE=oS;function zm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Oe.readInt32BE=zm;function km(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Oe.readUint32BE=km;function Wm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Oe.readInt32LE=Wm;function $m(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Oe.readUint32LE=$m;function Oh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Oe.writeUint32BE=Oh;Oe.writeInt32BE=Oh;function Ph(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Oe.writeUint32LE=Ph;Oe.writeInt32LE=Ph;function eF(r,e){e===void 0&&(e=0);var t=zm(r,e),i=zm(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Oe.readInt64BE=eF;function tF(r,e){e===void 0&&(e=0);var t=km(r,e),i=km(r,e+4);return t*4294967296+i}Oe.readUint64BE=tF;function rF(r,e){e===void 0&&(e=0);var t=Wm(r,e),i=Wm(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Oe.readInt64LE=rF;function iF(r,e){e===void 0&&(e=0);var t=$m(r,e),i=$m(r,e+4);return i*4294967296+t}Oe.readUint64LE=iF;function aS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Oh(r/4294967296>>>0,e,t),Oh(r>>>0,e,t+4),e}Oe.writeUint64BE=aS;Oe.writeInt64BE=aS;function uS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Ph(r>>>0,e,t),Ph(r/4294967296>>>0,e,t+4),e}Oe.writeUint64LE=uS;Oe.writeInt64LE=uS;function nF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Oe.readUintBE=nF;function sF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s=i;s--)t[s]=e/n&255,n*=256;return t}Oe.writeUintBE=oF;function aF(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nS.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s{"use strict";f();Object.defineProperty(ur,"__esModule",{value:!0});ur.randomStringForEntropy=ur.randomString=ur.randomUint32=ur.randomBytes=ur.defaultRandomSource=void 0;var yF=rS(),mF=Wa(),cS=qr();ur.defaultRandomSource=new yF.SystemRandomSource;function Ym(r,e=ur.defaultRandomSource){return e.randomBytes(r)}ur.randomBytes=Ym;function wF(r=ur.defaultRandomSource){let e=Ym(4,r),t=(0,mF.readUint32LE)(e);return(0,cS.wipe)(e),t}ur.randomUint32=wF;var lS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function fS(r,e=lS,t=ur.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 i="",n=e.length,s=256-256%n;for(;r>0;){let o=Ym(Math.ceil(r*256/s),t);for(let a=0;a0;a++){let u=o[a];u{"use strict";f();Object.defineProperty(Xi,"__esModule",{value:!0});var Ya=Wa(),$a=qr();Xi.DIGEST_LENGTH=64;Xi.BLOCK_SIZE=128;var dS=function(){function r(){this.digestLength=Xi.DIGEST_LENGTH,this.blockSize=Xi.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){$a.wipe(this._buffer),$a.wipe(this._tempHi),$a.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){$a.wipe(e.stateHi),$a.wipe(e.stateLo),e.buffer&&$a.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Xi.SHA512=dS;var hS=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 Jm(r,e,t,i,n,s,o){for(var a=t[0],u=t[1],h=t[2],p=t[3],w=t[4],N=t[5],O=t[6],T=t[7],V=i[0],z=i[1],$=i[2],se=i[3],Y=i[4],j=i[5],W=i[6],k=i[7],R,F,G,ce,J,X,A,c;o>=128;){for(var d=0;d<16;d++){var g=8*d+s;r[d]=Ya.readUint32BE(n,g),e[d]=Ya.readUint32BE(n,g+4)}for(var d=0;d<80;d++){var m=a,v=u,S=h,D=p,I=w,l=N,C=O,Z=T,ie=V,ee=z,ae=$,E=se,b=Y,x=j,L=W,P=k;if(R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(w>>>14|Y<<32-14)^(w>>>18|Y<<32-18)^(Y>>>41-32|w<<32-(41-32)),F=(Y>>>14|w<<32-14)^(Y>>>18|w<<32-18)^(w>>>41-32|Y<<32-(41-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=w&N^~w&O,F=Y&j^~Y&W,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=hS[d*2],F=hS[d*2+1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=r[d%16],F=e[d%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,G=A&65535|c<<16,ce=J&65535|X<<16,R=G,F=ce,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(a>>>28|V<<32-28)^(V>>>34-32|a<<32-(34-32))^(V>>>39-32|a<<32-(39-32)),F=(V>>>28|a<<32-28)^(a>>>34-32|V<<32-(34-32))^(a>>>39-32|V<<32-(39-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=a&u^a&h^u&h,F=V&z^V&$^z&$,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,Z=A&65535|c<<16,P=J&65535|X<<16,R=D,F=E,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=G,F=ce,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,D=A&65535|c<<16,E=J&65535|X<<16,u=m,h=v,p=S,w=D,N=I,O=l,T=C,a=Z,z=ie,$=ee,se=ae,Y=E,j=b,W=x,k=L,V=P,d%16===15)for(var g=0;g<16;g++)R=r[g],F=e[g],J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=r[(g+9)%16],F=e[(g+9)%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+1)%16],ce=e[(g+1)%16],R=(G>>>1|ce<<32-1)^(G>>>8|ce<<32-8)^G>>>7,F=(ce>>>1|G<<32-1)^(ce>>>8|G<<32-8)^(ce>>>7|G<<32-7),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+14)%16],ce=e[(g+14)%16],R=(G>>>19|ce<<32-19)^(ce>>>61-32|G<<32-(61-32))^G>>>6,F=(ce>>>19|G<<32-19)^(G>>>61-32|ce<<32-(61-32))^(ce>>>6|G<<32-6),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,r[g]=A&65535|c<<16,e[g]=J&65535|X<<16}R=a,F=V,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[0],F=i[0],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[0]=a=A&65535|c<<16,i[0]=V=J&65535|X<<16,R=u,F=z,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[1],F=i[1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[1]=u=A&65535|c<<16,i[1]=z=J&65535|X<<16,R=h,F=$,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[2],F=i[2],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[2]=h=A&65535|c<<16,i[2]=$=J&65535|X<<16,R=p,F=se,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[3],F=i[3],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[3]=p=A&65535|c<<16,i[3]=se=J&65535|X<<16,R=w,F=Y,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[4],F=i[4],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[4]=w=A&65535|c<<16,i[4]=Y=J&65535|X<<16,R=N,F=j,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[5],F=i[5],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[5]=N=A&65535|c<<16,i[5]=j=J&65535|X<<16,R=O,F=W,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[6],F=i[6],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[6]=O=A&65535|c<<16,i[6]=W=J&65535|X<<16,R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[7],F=i[7],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[7]=T=A&65535|c<<16,i[7]=k=J&65535|X<<16,s+=128,o-=128}return s}function EF(r){var e=new dS;e.update(r);var t=e.digest();return e.clean(),t}Xi.hash=EF});var TS=B(He=>{"use strict";f();Object.defineProperty(He,"__esModule",{value:!0});He.convertSecretKeyToX25519=He.convertPublicKeyToX25519=He.verify=He.sign=He.extractPublicKeyFromSecretKey=He.generateKeyPair=He.generateKeyPairFromSeed=He.SEED_LENGTH=He.SECRET_KEY_LENGTH=He.PUBLIC_KEY_LENGTH=He.SIGNATURE_LENGTH=void 0;var AF=Tc(),Nc=pS(),vS=qr();He.SIGNATURE_LENGTH=64;He.PUBLIC_KEY_LENGTH=32;He.SECRET_KEY_LENGTH=64;He.SEED_LENGTH=32;function ve(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,ES(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function AS(r,e){let t=0;for(let i=0;i<32;i++)t|=r[i]^e[i];return(1&t-1>>>8)-1}function mS(r,e){let t=new Uint8Array(32),i=new Uint8Array(32);return Dc(t,r),Dc(i,e),AS(t,i)}function IS(r){let e=new Uint8Array(32);return Dc(e,r),e[0]&1}function SF(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function Js(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function Zs(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function Ge(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Xs(r,e){Ge(r,e,e)}function _S(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=253;i>=0;i--)Xs(t,t),i!==2&&i!==4&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function xF(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=250;i>=0;i--)Xs(t,t),i!==1&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function tw(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve(),h=ve(),p=ve();Zs(t,r[1],r[0]),Zs(p,e[1],e[0]),Ge(t,t,p),Js(i,r[0],r[1]),Js(p,e[0],e[1]),Ge(i,i,p),Ge(n,r[3],e[3]),Ge(n,n,bF),Ge(s,r[2],e[2]),Js(s,s,s),Zs(o,i,t),Zs(a,s,n),Js(u,s,n),Js(h,i,t),Ge(r[0],o,a),Ge(r[1],h,u),Ge(r[2],u,a),Ge(r[3],o,h)}function wS(r,e,t){for(let i=0;i<4;i++)ES(r[i],e[i],t)}function iw(r,e){let t=ve(),i=ve(),n=ve();_S(n,e[2]),Ge(t,e[0],n),Ge(i,e[1],n),Dc(r,i),r[31]^=IS(t)<<7}function bS(r,e,t){Rn(r[0],ew),Rn(r[1],Ja),Rn(r[2],Ja),Rn(r[3],ew);for(let i=255;i>=0;--i){let n=t[i/8|0]>>(i&7)&1;wS(r,e,n),tw(e,r),tw(r,r),wS(r,e,n)}}function nw(r,e){let t=[ve(),ve(),ve(),ve()];Rn(t[0],gS),Rn(t[1],yS),Rn(t[2],Ja),Ge(t[3],gS,yS),bS(r,t,e)}function CS(r){if(r.length!==He.SEED_LENGTH)throw new Error(`ed25519: seed must be ${He.SEED_LENGTH} bytes`);let e=(0,Nc.hash)(r);e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(32),i=[ve(),ve(),ve(),ve()];nw(i,e),iw(t,i);let n=new Uint8Array(64);return n.set(r),n.set(t,32),{publicKey:t,secretKey:n}}He.generateKeyPairFromSeed=CS;function TF(r){let e=(0,AF.randomBytes)(32,r),t=CS(e);return(0,vS.wipe)(e),t}He.generateKeyPair=TF;function NF(r){if(r.length!==He.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${He.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))}He.extractPublicKeyFromSecretKey=NF;var Zm=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 SS(r,e){let t,i,n,s;for(i=63;i>=32;--i){for(t=0,n=i-32,s=i-12;n>4)*Zm[n],t=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=t*Zm[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,r[i]=e[i]&255}function rw(r){let e=new Float64Array(64);for(let t=0;t<64;t++)e[t]=r[t];for(let t=0;t<64;t++)r[t]=0;SS(r,e)}function DF(r,e){let t=new Float64Array(64),i=[ve(),ve(),ve(),ve()],n=(0,Nc.hash)(r.subarray(0,32));n[0]&=248,n[31]&=127,n[31]|=64;let s=new Uint8Array(64);s.set(n.subarray(32),32);let o=new Nc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),rw(a),nw(i,a),iw(s,i),o.reset(),o.update(s.subarray(0,32)),o.update(r.subarray(32)),o.update(e);let u=o.digest();rw(u);for(let h=0;h<32;h++)t[h]=a[h];for(let h=0;h<32;h++)for(let p=0;p<32;p++)t[h+p]+=u[h]*n[p];return SS(s.subarray(32),t),s}He.sign=DF;function xS(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve();return Rn(r[2],Ja),SF(r[1],e),Xs(n,r[1]),Ge(s,n,_F),Zs(n,n,r[2]),Js(s,r[2],s),Xs(o,s),Xs(a,o),Ge(u,a,o),Ge(t,u,n),Ge(t,t,s),xF(t,t),Ge(t,t,n),Ge(t,t,s),Ge(t,t,s),Ge(r[0],t,s),Xs(i,r[0]),Ge(i,i,s),mS(i,n)&&Ge(r[0],r[0],CF),Xs(i,r[0]),Ge(i,i,s),mS(i,n)?-1:(IS(r[0])===e[31]>>7&&Zs(r[0],ew,r[0]),Ge(r[3],r[0],r[1]),0)}function OF(r,e,t){let i=new Uint8Array(32),n=[ve(),ve(),ve(),ve()],s=[ve(),ve(),ve(),ve()];if(t.length!==He.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${He.SIGNATURE_LENGTH} bytes`);if(xS(s,r))return!1;let o=new Nc.SHA512;o.update(t.subarray(0,32)),o.update(r),o.update(e);let a=o.digest();return rw(a),bS(n,s,a),nw(s,t.subarray(32)),tw(n,s),iw(i,n),!AS(t,i)}He.verify=OF;function PF(r){let e=[ve(),ve(),ve(),ve()];if(xS(e,r))throw new Error("Ed25519: invalid public key");let t=ve(),i=ve(),n=e[1];Js(t,Ja,n),Zs(i,Ja,n),_S(i,i),Ge(t,t,i);let s=new Uint8Array(32);return Dc(s,t),s}He.convertPublicKeyToX25519=PF;function BF(r){let e=(0,Nc.hash)(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(e.subarray(0,32));return(0,vS.wipe)(e),t}He.convertSecretKeyToX25519=BF});var Bh,Mh,eo,Xa,Rh,Oc,Lh,Fh,Uh,Za,qh,Vh,NS,DS,Hh=me(()=>{f();Bh="EdDSA",Mh="JWT",eo=".",Xa="base64url",Rh="utf8",Oc="utf8",Lh=":",Fh="did",Uh="key",Za="base58btc",qh="z",Vh="K36",NS=32,DS=32});function eu(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Qh=me(()=>{f()});function jh(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));let t=eu(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var sw=me(()=>{f();Qh()});function MF(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var RF,LF,OS,PS=me(()=>{f();RF=MF,LF=RF,OS=LF});var rX,BS,Zi,MS,RS,Ln=me(()=>{f();rX=new Uint8Array(0),BS=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},MS=r=>new TextEncoder().encode(r),RS=r=>new TextDecoder().decode(r)});var ow,aw,uw,FS,cw,tu,Fn,FF,UF,ut,Xr=me(()=>{f();PS();Ln();ow=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},aw=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 FS(this,e)}},uw=class{constructor(e){this.decoders=e}or(e){return FS(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FS=(r,e)=>new uw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),cw=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new ow(e,t,i),this.decoder=new aw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},tu=({name:r,prefix:e,encode:t,decode:i})=>new cw(r,e,t,i),Fn=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=OS(t,e);return tu({prefix:r,name:e,encode:i,decode:s=>Zi(n(s))})},FF=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},UF=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<tu({prefix:e,name:r,encode(n){return UF(n,i,t)},decode(n){return FF(n,i,t,r)}})});var lw={};ot(lw,{identity:()=>qF});var qF,US=me(()=>{f();Xr();Ln();qF=tu({prefix:"\0",name:"identity",encode:r=>RS(r),decode:r=>MS(r)})});var fw={};ot(fw,{base2:()=>VF});var VF,qS=me(()=>{f();Xr();VF=ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var hw={};ot(hw,{base8:()=>HF});var HF,VS=me(()=>{f();Xr();HF=ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var dw={};ot(dw,{base10:()=>QF});var QF,HS=me(()=>{f();Xr();QF=Fn({prefix:"9",name:"base10",alphabet:"0123456789"})});var pw={};ot(pw,{base16:()=>jF,base16upper:()=>GF});var jF,GF,QS=me(()=>{f();Xr();jF=ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),GF=ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var gw={};ot(gw,{base32:()=>ru,base32hex:()=>WF,base32hexpad:()=>YF,base32hexpadupper:()=>JF,base32hexupper:()=>$F,base32pad:()=>zF,base32padupper:()=>kF,base32upper:()=>KF,base32z:()=>XF});var ru,KF,zF,kF,WF,$F,YF,JF,XF,yw=me(()=>{f();Xr();ru=ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),KF=ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zF=ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kF=ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),WF=ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$F=ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),YF=ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),JF=ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),XF=ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var mw={};ot(mw,{base36:()=>ZF,base36upper:()=>e4});var ZF,e4,jS=me(()=>{f();Xr();ZF=Fn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),e4=Fn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var ww={};ot(ww,{base58btc:()=>Ni,base58flickr:()=>t4});var Ni,t4,vw=me(()=>{f();Xr();Ni=Fn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),t4=Fn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Ew={};ot(Ew,{base64:()=>r4,base64pad:()=>i4,base64url:()=>n4,base64urlpad:()=>s4});var r4,i4,n4,s4,GS=me(()=>{f();Xr();r4=ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),i4=ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),n4=ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),s4=ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Aw={};ot(Aw,{base256emoji:()=>l4});function u4(r){return r.reduce((e,t)=>(e+=o4[t],e),"")}function c4(r){let e=[];for(let t of r){let i=a4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var KS,o4,a4,l4,zS=me(()=>{f();Xr();KS=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}"),o4=KS.reduce((r,e,t)=>(r[t]=e,r),[]),a4=KS.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);l4=tu({prefix:"\u{1F680}",name:"base256emoji",encode:u4,decode:c4})});function $S(r,e,t){e=e||[],t=t||0;for(var i=t;r>=p4;)e[t++]=r&255|kS,r/=128;for(;r&d4;)e[t++]=r&255|kS,r>>>=7;return e[t]=r|0,$S.bytes=t-i+1,e}function Iw(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Iw.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WS)<=y4);return Iw.bytes=s-i,t}var f4,kS,h4,d4,p4,g4,y4,WS,m4,w4,v4,E4,A4,I4,_4,b4,C4,S4,x4,T4,Pc,YS=me(()=>{f();f4=$S,kS=128,h4=127,d4=~h4,p4=Math.pow(2,31);g4=Iw,y4=128,WS=127;m4=Math.pow(2,7),w4=Math.pow(2,14),v4=Math.pow(2,21),E4=Math.pow(2,28),A4=Math.pow(2,35),I4=Math.pow(2,42),_4=Math.pow(2,49),b4=Math.pow(2,56),C4=Math.pow(2,63),S4=function(r){return r{f();YS();Bc=(r,e=0)=>[Pc.decode(r,e),Pc.decode.bytes],iu=(r,e,t=0)=>(Pc.encode(r,e,t),e),nu=r=>Pc.encodingLength(r)});var to,JS,XS,su,Rc=me(()=>{f();Ln();Kh();to=(r,e)=>{let t=e.byteLength,i=nu(r),n=i+nu(t),s=new Uint8Array(n+t);return iu(r,s,0),iu(t,s,i),s.set(e,n),new su(r,t,e,s)},JS=r=>{let e=Zi(r),[t,i]=Bc(e),[n,s]=Bc(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new su(t,n,o,e)},XS=(r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&BS(r.bytes,e.bytes),su=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}});var bw,_w,Cw=me(()=>{f();Rc();bw=({name:r,code:e,encode:t})=>new _w(r,e,t),_w=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?to(this.code,t):t.then(i=>to(this.code,i))}else throw Error("Unknown type, must be binary type")}}});var Sw={};ot(Sw,{sha256:()=>N4,sha512:()=>D4});var ex,N4,D4,tx=me(()=>{f();Cw();ex=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),N4=bw({name:"sha2-256",code:18,encode:ex("SHA-256")}),D4=bw({name:"sha2-512",code:19,encode:ex("SHA-512")})});var xw={};ot(xw,{identity:()=>B4});var rx,O4,ix,P4,B4,nx=me(()=>{f();Ln();Rc();rx=0,O4="identity",ix=Zi,P4=r=>to(rx,ix(r)),B4={code:rx,name:O4,encode:ix,digest:P4}});var sx=me(()=>{f();Ln()});var QX,jX,ox=me(()=>{f();QX=new TextEncoder,jX=new TextDecoder});var Vt,L4,F4,U4,Lc,q4,ax,ux,zh,kh,V4,H4,Q4,cx=me(()=>{f();Kh();Rc();vw();yw();Ln();Vt=class{constructor(e,t,i,n){this.code=t,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:kh,byteLength:kh,code:zh,version:zh,multihash:zh,bytes:zh,_baseCache:kh,asCID:kh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Lc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==q4)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Vt.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,i=to(e,t);return Vt.createV1(this.code,i)}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&&XS(this.multihash,e.multihash)}toString(e){let{bytes:t,version:i,_baseCache:n}=this;switch(i){case 0:return F4(t,n,e||Ni.encoder);default:return U4(t,n,e||ru.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 H4(/^0\.0/,Q4),!!(e&&(e[ux]||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 Vt)return e;if(e!=null&&e.asCID===e){let{version:t,code:i,multihash:n,bytes:s}=e;return new Vt(t,i,n,s||ax(t,i,n.bytes))}else if(e!=null&&e[ux]===!0){let{version:t,multihash:i,code:n}=e,s=JS(i);return Vt.create(t,n,s)}else return null}static create(e,t,i){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Lc)throw new Error(`Version 0 CID must use dag-pb (code: ${Lc}) block encoding`);return new Vt(e,t,i,i.bytes)}case 1:{let n=ax(e,t,i.bytes);return new Vt(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return Vt.create(0,Lc,e)}static createV1(e,t){return Vt.create(1,e,t)}static decode(e){let[t,i]=Vt.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Vt.inspectBytes(e),i=t.size-t.multihashSize,n=Zi(e.subarray(i,i+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),o=new su(t.multihashCode,t.digestSize,s,n);return[t.version===0?Vt.createV0(o):Vt.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,i=()=>{let[w,N]=Bc(e.subarray(t));return t+=N,w},n=i(),s=Lc;if(n===18?(n=0,t=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=t,a=i(),u=i(),h=t+u,p=h-o;return{version:n,codec:s,multihashCode:a,digestSize:u,multihashSize:p,size:h}}static parse(e,t){let[i,n]=L4(e,t),s=Vt.decode(n);return s._baseCache.set(i,e),s}},L4=(r,e)=>{switch(r[0]){case"Q":{let t=e||Ni;return[Ni.prefix,t.decode(`${Ni.prefix}${r}`)]}case Ni.prefix:{let t=e||Ni;return[Ni.prefix,t.decode(r)]}case ru.prefix:{let t=e||ru;return[ru.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},F4=(r,e,t)=>{let{prefix:i}=t;if(i!==Ni.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(i);if(n==null){let s=t.encode(r).slice(1);return e.set(i,s),s}else return n},U4=(r,e,t)=>{let{prefix:i}=t,n=e.get(i);if(n==null){let s=t.encode(r);return e.set(i,s),s}else return n},Lc=112,q4=18,ax=(r,e,t)=>{let i=nu(r),n=i+nu(e),s=new Uint8Array(n+t.byteLength);return iu(r,s,0),iu(e,s,i),s.set(t,n),s},ux=Symbol.for("@ipld/js-cid/CID"),zh={writable:!1,configurable:!1,enumerable:!0},kh={writable:!1,enumerable:!1,configurable:!1},V4="0.0.0-dev",H4=(r,e)=>{if(r.test(V4))console.warn(e);else throw new Error(e)},Q4=`CID.isCID(v) is deprecated and will be removed in the next major release. +`)}};ge.ErrTypeInferenceSystemRequiresRegularJavascriptObjects=$0;var Y0=class extends Le{constructor(e,t){super(`field ${e} does not exist on struct ${t}`)}};ge.ErrMissingFieldOnStruct=Y0;var J0=class extends Le{constructor(e,t){super(`field ${e} does not exist on enum ${t}`)}};ge.ErrMissingFieldOnEnum=J0;var X0=class extends Le{constructor(e){super(`cannot parse contract results: ${e}`)}};ge.ErrCannotParseContractResults=X0;var Z0=class extends Le{constructor(e,t){super(`cannot parse outcome of transaction ${e}: ${t}`)}};ge.ErrCannotParseTransactionOutcome=Z0;var eg=class extends Le{constructor(e){super(e)}};ge.ErrCodec=eg;var tg=class extends Le{constructor(e){super(e)}};ge.ErrContractInteraction=tg;var rg=class extends Le{constructor(){super("Method not yet implemented")}};ge.ErrNotImplemented=rg;var ig=class extends Le{constructor(){super("invalid arguments for relayed v1 builder")}};ge.ErrInvalidRelayedV1BuilderArguments=ig;var ng=class extends Le{constructor(){super("invalid arguments for relayed v2 builder")}};ge.ErrInvalidRelayedV2BuilderArguments=ng;var sg=class extends Le{constructor(){super("gas limit must be 0 for the inner transaction for relayed v2")}};ge.ErrGasLimitShouldBe0ForInnerTransaction=sg});var og=B(To=>{"use strict";f();var aP=To&&To.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(To,"__esModule",{value:!0});To.TokenPayment=void 0;var zu=aP(jr()),uP=Ye(),eA="EGLD",tA=18;zu.default.set({ROUNDING_MODE:1});var Ki=class{constructor(e,t,i,n){let s=new zu.default(i);if(!s.isInteger()||s.isNegative())throw new uP.ErrInvalidArgument(`bad amountAsBigInteger: ${i}`);this.tokenIdentifier=e,this.nonce=t,this.amountAsBigInteger=s,this.numDecimals=n}static egldFromAmount(e){let t=new zu.default(e).shiftedBy(tA).decimalPlaces(0);return this.egldFromBigInteger(t)}static egldFromBigInteger(e){return new Ki(eA,0,e,tA)}static fungibleFromAmount(e,t,i){let n=new zu.default(t).shiftedBy(i).decimalPlaces(0);return this.fungibleFromBigInteger(e,n,i)}static fungibleFromBigInteger(e,t,i=0){return new Ki(e,0,t,i)}static nonFungible(e,t){return new Ki(e,t,1,0)}static semiFungible(e,t,i){return new Ki(e,t,i,0)}static metaEsdtFromAmount(e,t,i,n){let s=new zu.default(i).shiftedBy(n).decimalPlaces(0);return this.metaEsdtFromBigInteger(e,t,s,n)}static metaEsdtFromBigInteger(e,t,i,n=0){return new Ki(e,t,i,n)}toString(){return this.amountAsBigInteger.toFixed(0)}valueOf(){return this.amountAsBigInteger}toPrettyString(){return`${this.toRationalNumber()} ${this.tokenIdentifier}`}toRationalNumber(){return this.amountAsBigInteger.shiftedBy(-this.numDecimals).toFixed(this.numDecimals)}isEgld(){return this.tokenIdentifier==eA}isFungible(){return this.nonce==0}};To.TokenPayment=Ki});var kl=B((wz,nA)=>{"use strict";f();var Kl="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ag={};for(ku=0;ku>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function rA(r){for(var e=1,t=0;t126)return"Invalid prefix ("+r+")";e=No(e)^i>>5}for(e=No(e),t=0;tt)throw new TypeError("Exceeds length limit");r=r.toLowerCase();var i=rA(r);if(typeof i=="string")throw new Error(i);for(var n=r+"1",s=0;s>5)throw new Error("Non 5-bit word");i=No(i)^o,n+=Kl.charAt(o)}for(s=0;s<6;++s)i=No(i);for(i^=1,s=0;s<6;++s){var a=i>>(5-s)*5&31;n+=Kl.charAt(a)}return n}function iA(r,e){if(e=e||90,r.length<8)return r+" too short";if(r.length>e)return"Exceeds length limit";var t=r.toLowerCase(),i=r.toUpperCase();if(r!==t&&r!==i)return"Mixed-case string "+r;r=t;var n=r.lastIndexOf("1");if(n===-1)return"No separator character for "+r;if(n===0)return"Missing prefix for "+r;var s=r.slice(0,n),o=r.slice(n+1);if(o.length<6)return"Data too short";var a=rA(s);if(typeof a=="string")return a;for(var u=[],h=0;h=o.length)&&u.push(w)}return a!==1?"Invalid checksum for "+r:{prefix:s,words:u}}function lP(){var r=iA.apply(null,arguments);if(typeof r=="object")return r}function fP(r){var e=iA.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zl(r,e,t,i){for(var n=0,s=0,o=(1<=t;)s-=t,a.push(n>>s&o);if(i)s>0&&a.push(n<=e)return"Excess padding";if(n<{"use strict";f();var yP=ai&&ai.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),mP=ai&&ai.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sA=ai&&ai.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yP(e,r,t);return mP(e,r),e};Object.defineProperty(ai,"__esModule",{value:!0});ai.Address=void 0;var Wl=sA(kl()),Do=sA(Ye()),ug="erd",cg=32,wP="0".repeat(16),Kt=class{constructor(e){if(this.valueHex="",!!e){if(e instanceof Kt)return Kt.fromAddress(e);if(e instanceof y.Buffer)return Kt.fromBuffer(e);if(typeof e=="string")return Kt.fromString(e);throw new Do.ErrAddressCannotCreate(e)}}static fromAddress(e){return Kt.fromValidHex(e.valueHex)}static fromValidHex(e){let t=new Kt;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=cg)throw new Do.ErrAddressCannotCreate(e);return Kt.fromValidHex(e.toString("hex"))}static fromString(e){return Kt.isValidHex(e)?Kt.fromValidHex(e):Kt.fromBech32(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==cg}static fromHex(e){if(!Kt.isValidHex(e))throw new Do.ErrAddressCannotCreate(e);return Kt.fromValidHex(e)}static fromBech32(e){let t;try{t=Wl.decode(e)}catch(s){throw new Do.ErrAddressCannotCreate(e,s)}let i=t.prefix;if(i!=ug)throw new Do.ErrAddressBadHrp(ug,i);let n=y.Buffer.from(Wl.fromWords(t.words));if(n.length!=cg)throw new Do.ErrAddressCannotCreate(e);return Kt.fromValidHex(n.toString("hex"))}hex(){return this.isEmpty()?"":this.valueHex}bech32(){if(this.isEmpty())return"";let e=Wl.toWords(this.pubkey());return Wl.encode(ug,e)}pubkey(){return this.isEmpty()?y.Buffer.from([]):y.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 Kt("0".repeat(64))}isContractAddress(){return this.hex().startsWith(wP)}};ai.Address=Kt});var Wu=B(tt=>{"use strict";f();Object.defineProperty(tt,"__esModule",{value:!0});tt.ARGUMENTS_SEPARATOR=tt.ESDT_TRANSFER_VALUE=tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDTNFT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_FUNCTION_NAME=tt.ESDT_TRANSFER_GAS_LIMIT=tt.TRANSACTION_VERSION_TX_HASH_SIGN=tt.TRANSACTION_VERSION_DEFAULT=tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=tt.TRANSACTION_OPTIONS_DEFAULT=tt.TRANSACTION_MIN_GAS_PRICE=void 0;tt.TRANSACTION_MIN_GAS_PRICE=1e9;tt.TRANSACTION_OPTIONS_DEFAULT=0;tt.TRANSACTION_OPTIONS_TX_HASH_SIGN=1;tt.TRANSACTION_VERSION_DEFAULT=1;tt.TRANSACTION_VERSION_TX_HASH_SIGN=2;tt.ESDT_TRANSFER_GAS_LIMIT=5e5;tt.ESDT_TRANSFER_FUNCTION_NAME="ESDTTransfer";tt.ESDTNFT_TRANSFER_FUNCTION_NAME="ESDTNFTTransfer";tt.MULTI_ESDTNFT_TRANSFER_FUNCTION_NAME="MultiESDTNFTTransfer";tt.ESDT_TRANSFER_VALUE="0";tt.ARGUMENTS_SEPARATOR="@"});var Tr=B(rt=>{"use strict";f();var vP=rt&&rt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),EP=rt&&rt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),AP=rt&&rt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&vP(e,r,t);return EP(e,r),e};Object.defineProperty(rt,"__esModule",{value:!0});rt.isEmpty=rt.guardEmpty=rt.guardNotEmpty=rt.guardLength=rt.guardSameLength=rt.guardValueIsSetWithMessage=rt.guardValueIsSet=rt.guardTrue=void 0;var Oo=AP(Ye());function IP(r,e){if(!r)throw new Oo.ErrInvariantFailed(`[<${e}>] isn't true`)}rt.guardTrue=IP;function _P(r,e){oA(`${r} isn't set (null or undefined)`,e)}rt.guardValueIsSet=_P;function oA(r,e){if(e==null||e===void 0)throw new Oo.ErrInvariantFailed(r)}rt.guardValueIsSetWithMessage=oA;function bP(r,e){if(r=r||[],e=e||[],r.length!=e.length)throw new Oo.ErrInvariantFailed("arrays do not have the same length")}rt.guardSameLength=bP;function CP(r,e){let t=r.length||0;if(t!=e)throw new Oo.ErrInvariantFailed(`wrong length, expected: ${e}, actual: ${t}`)}rt.guardLength=CP;function SP(r,e){if(lg(r))throw new Oo.ErrInvariantFailed(`${e} is empty`)}rt.guardNotEmpty=SP;function xP(r,e){if(!lg(r))throw new Oo.ErrInvariantFailed(`${e} is not empty`)}rt.guardEmpty=xP;function lg(r){return r.isEmpty?r.isEmpty():r.length===0}rt.isEmpty=lg});var aA=B($l=>{"use strict";f();Object.defineProperty($l,"__esModule",{value:!0});$l.getJavascriptPrototypesInHierarchy=void 0;function TP(r,e){let t=[],i=Object.getPrototypeOf(r);for(;i&&e(i);)t.push(i),i=Object.getPrototypeOf(i);return t}$l.getJavascriptPrototypesInHierarchy=TP});var Ft=B(Lt=>{"use strict";f();Object.defineProperty(Lt,"__esModule",{value:!0});Lt.NullType=Lt.TypePlaceholder=Lt.isTyped=Lt.PrimitiveValue=Lt.TypedValue=Lt.CustomType=Lt.PrimitiveType=Lt.TypeCardinality=Lt.Type=void 0;var fg=aA(),uA=Tr(),Ir=class{constructor(e,t=[],i=zi.fixed(1)){uA.guardValueIsSet("name",e),this.name=e,this.typeParameters=t,this.cardinality=i}getName(){return this.name}getClassName(){return Ir.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getFullyQualifiedName(){let e=this.getTypeParameters().map(t=>t.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 uA.guardTrue(this.typeParameters.length>0,"type parameters length > 0"),this.typeParameters[0]}toString(){let e=this.getTypeParameters().map(i=>i.toString()).join(", "),t=e?`<${e}>`:"";return`${this.name}${t}`}equals(e){return Ir.equals(this,e)}static equals(e,t){return e.getFullyQualifiedName()==t.getFullyQualifiedName()}static equalsMany(e,t){return e.every((i,n)=>i.equals(t[n]))}static isAssignableFromMany(e,t){return e.every((i,n)=>i.isAssignableFrom(t[n]))}differs(e){return!this.equals(e)}valueOf(){return this.name}isAssignableFrom(e){if(!Ir.equalsMany(this.getTypeParameters(),e.getTypeParameters()))return!1;let i=this.getFullyQualifiedName();return Ir.getFullyQualifiedNamesInHierarchy(e).includes(i)?!0:e.hasClassOrSuperclass(this.getClassName())}static getFullyQualifiedNamesInHierarchy(e){return fg.getJavascriptPrototypesInHierarchy(e,n=>n.belongsToTypesystem).map(n=>n.getFullyQualifiedName.call(e))}getNamesOfDependencies(){let e=[];for(let t of this.typeParameters)e.push(t.getName()),e.push(...t.getNamesOfDependencies());return[...new Set(e)]}toJSON(){return{name:this.name,typeParameters:this.typeParameters.map(e=>e.toJSON())}}getCardinality(){return this.cardinality}belongsToTypesystem(){}};Lt.Type=Ir;Ir.ClassName="Type";var zi=class{constructor(e,t){this.lowerBound=e,this.upperBound=t}static fixed(e){return new zi(e,e)}static variable(e){return new zi(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||zi.MaxCardinality}};Lt.TypeCardinality=zi;zi.MaxCardinality=4096;var Po=class extends Ir{constructor(e){super(e)}getClassName(){return Po.ClassName}};Lt.PrimitiveType=Po;Po.ClassName="PrimitiveType";var Bo=class extends Ir{getClassName(){return Bo.ClassName}};Lt.CustomType=Bo;Bo.ClassName="CustomType";var hs=class{constructor(e){this.type=e}getClassName(){return hs.ClassName}getClassHierarchy(){return fg.getJavascriptPrototypesInHierarchy(this,i=>i.belongsToTypesystem).map(i=>i.getClassName()).reverse()}getType(){return this.type}hasExactClass(e){return this.getClassName()==e}hasClassOrSuperclass(e){return this.getClassHierarchy().includes(e)}belongsToTypesystem(){}};Lt.TypedValue=hs;hs.ClassName="TypedValue";var Mo=class extends hs{constructor(e){super(e)}getClassName(){return Mo.ClassName}};Lt.PrimitiveValue=Mo;Mo.ClassName="PrimitiveValue";function NP(r){return r.belongsToTypesystem!==void 0}Lt.isTyped=NP;var Ro=class extends Ir{constructor(){super("...")}getClassName(){return Ro.ClassName}};Lt.TypePlaceholder=Ro;Ro.ClassName="TypePlaceholder";var Lo=class extends Ir{constructor(){super("?")}getClassName(){return Lo.ClassName}};Lt.NullType=Lo;Lo.ClassName="NullType"});var cA=B((Fo,Uo)=>{f();(function(r){var e=typeof Fo=="object"&&Fo&&!Fo.nodeType&&Fo,t=typeof Uo=="object"&&Uo&&!Uo.nodeType&&Uo,i=typeof global=="object"&&global;(i.global===i||i.window===i||i.self===i)&&(r=i);var n,s=2147483647,o=36,a=1,u=26,h=38,p=700,w=72,N=128,O="-",T=/^xn--/,V=/[^\x20-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,$={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},se=o-a,Y=Math.floor,j=String.fromCharCode,W;function k(v){throw new RangeError($[v])}function R(v,S){for(var D=v.length,I=[];D--;)I[D]=S(v[D]);return I}function F(v,S){var D=v.split("@"),I="";D.length>1&&(I=D[0]+"@",v=D[1]),v=v.replace(z,".");var l=v.split("."),C=R(l,S).join(".");return I+C}function G(v){for(var S=[],D=0,I=v.length,l,C;D=55296&&l<=56319&&D65535&&(S-=65536,D+=j(S>>>10&1023|55296),S=56320|S&1023),D+=j(S),D}).join("")}function J(v){return v-48<10?v-22:v-65<26?v-65:v-97<26?v-97:o}function X(v,S){return v+22+75*(v<26)-((S!=0)<<5)}function A(v,S,D){var I=0;for(v=D?Y(v/p):v>>1,v+=Y(v/S);v>se*u>>1;I+=o)v=Y(v/se);return Y(I+(se+1)*v/(v+h))}function c(v){var S=[],D=v.length,I,l=0,C=N,Z=w,ie,ee,ae,E,b,x,L,P,U;for(ie=v.lastIndexOf(O),ie<0&&(ie=0),ee=0;ee=128&&k("not-basic"),S.push(v.charCodeAt(ee));for(ae=ie>0?ie+1:0;ae=D&&k("invalid-input"),L=J(v.charCodeAt(ae++)),(L>=o||L>Y((s-l)/b))&&k("overflow"),l+=L*b,P=x<=Z?a:x>=Z+u?u:x-Z,!(LY(s/U)&&k("overflow"),b*=U;I=S.length+1,Z=A(l-E,I,E==0),Y(l/I)>s-C&&k("overflow"),C+=Y(l/I),l%=I,S.splice(l++,0,C)}return ce(S)}function d(v){var S,D,I,l,C,Z,ie,ee,ae,E,b,x=[],L,P,U,q;for(v=G(v),L=v.length,S=N,D=0,C=w,Z=0;Z=S&&bY((s-D)/P)&&k("overflow"),D+=(ie-S)*P,S=ie,Z=0;Zs&&k("overflow"),b==S){for(ee=D,ae=o;E=ae<=C?a:ae>=C+u?u:ae-C,!(ee{"use strict";f();var fA=cA();function DP(r,e){this.__proto__=new Error(e),this.__proto__.name="BackslashError",this.offset=r}function hg(r){return r>="0"&&r<="7"}function OP(r){return r>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F"}function lA(r){return r=parseInt(r,16),fA.ucs2.encode([r])}function hA(r,e,t){var i=!1,n=[];function s(u){var h=r[u];if(!OP(h))throw new DP(u,"Unexpected token ILLEGAL");return h}for(;e{f();var yA=dA();vA.exports={validate:PP,parse:BP};function PP(r,e){var t;if(e=e||!1,typeof r!="string")t="Input must be a string";else try{Yl(r,0,e,!1)}catch(i){t=i.message}return t}function BP(r,e){if(typeof r!="string")throw new Error("Input must be a string");e=e||!1;var t=Yl(r,0,e,!0);return t.value}function mA(r,e){for(var t=r.length,i=e,n,s=e;s-1&&r[t]==="\\";)i++,t--;return i%2===0}function FP(r,e,t,i){for(var n=e,s=",",o=[],a=e;ds(r[a]);)a++;if(r[a]==="]")return{start:e,end:a,value:o};for(;s===",";){var u=Yl(r,n,t,i),h=mA(r,u.end);i&&o.push(u.value),n=h.end,s=h.value}return{start:e,end:n,value:o}}function UP(r,e){return r.substr(e,4)==="true"}function qP(r,e){return r.substr(e,5)==="false"}function VP(r,e){return r.substr(e,4)==="null"}var HP=new RegExp(/^\s$/);function ds(r){return HP.test(r)}var QP=new RegExp(/^\d$/);function pA(r){return QP.test(r)}function ki(r,e,t){var i=10,n;r.length{"use strict";f();var jP=ui&&ui.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),GP=ui&&ui.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),KP=ui&&ui.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&jP(e,r,t);return GP(e,r),e};Object.defineProperty(ui,"__esModule",{value:!0});ui.TypeExpressionParser=void 0;var AA=KP(Ye()),zP=Ft(),kP=EA(),pg=class{parse(e){let t=this.doParse(e),i=Object.keys(t);if(i.length!=1)throw new AA.ErrTypingSystem(`bad type expression: ${e}`);let n=i[0];return this.nodeToType(n,t[n])}doParse(e){let t=this.getJsonedString(e);try{return kP.parse(t)}catch{throw new AA.ErrTypingSystem(`cannot parse type expression: ${e}. internal json: ${t}.`)}}getJsonedString(e){let t="";for(var i=0;i"?a!=">"?t+=": {} }":t+="}":o==","?u==">"||(a==">"?t+=",":t+=": {},"):t+=o}let n=/(:|\{|\}|,|\s)/,s=t.replace(/utf\-8\sstring/ig,"utf-8-string").split(n).filter(o=>o);return t=s.map(o=>n.test(o)?o:`"${o}"`).map(o=>o.replace(/utf\-8\-string/ig,"utf-8 string")).join(""),s.length==1?`{${t}: {}}`:`{${t}}`}nodeToType(e,t){e.charAt(e.length-1)==="1"&&(e=e.slice(0,-1));let i=Object.keys(t).map(n=>this.nodeToType(n,t[n]));return new zP.Type(e,i)}};ui.TypeExpressionParser=pg});var Zl=B(dn=>{"use strict";f();Object.defineProperty(dn,"__esModule",{value:!0});dn.EndpointParameterDefinition=dn.EndpointModifiers=dn.EndpointDefinition=void 0;var WP=Jl(),IA="?",$P="N / A",$u=class{constructor(e,t,i,n){this.input=[],this.output=[],this.name=e,this.input=t||[],this.output=i||[],this.modifiers=n}isConstructor(){return this.name=="constructor"}static fromJSON(e){e.name=e.name==null?IA:e.name,e.payableInTokens=e.payableInTokens||[],e.inputs=e.inputs||[],e.outputs=e.outputs||[];let t=e.inputs.map(s=>ps.fromJSON(s)),i=e.outputs.map(s=>ps.fromJSON(s)),n=new Xl(e.mutability,e.payableInTokens);return new $u(e.name,t,i,n)}};dn.EndpointDefinition=$u;var Xl=class{constructor(e,t){this.mutability=e||"",this.payableInTokens=t||[]}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"}};dn.EndpointModifiers=Xl;var ps=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new WP.TypeExpressionParser().parse(e.type);return new ps(e.name||IA,e.description||$P,t)}};dn.EndpointParameterDefinition=ps});var gg=B(ef=>{"use strict";f();Object.defineProperty(ef,"__esModule",{value:!0});ef.ContractInterface=void 0;var YP=Tr(),_A=Zl(),JP="?",Yu=class{constructor(e,t,i){this.endpoints=[],this.name=e,this.constructorDefinition=t,this.endpoints=i}static fromJSON(e){e.name=e.name||JP,e.endpoints=e.endpoints||[];let t=XP(e),i=e.endpoints.map(n=>_A.EndpointDefinition.fromJSON(n));return new Yu(e.name,t,i)}getConstructorDefinition(){return this.constructorDefinition}getEndpoint(e){let t=this.endpoints.find(i=>i.name==e);return YP.guardValueIsSetWithMessage(`endpoint [${e}] not found`,t),t}};ef.ContractInterface=Yu;function XP(r){if(r.constructor.inputs===void 0||r.constructor.outputs===void 0)return null;let e=Object.assign({name:"constructor"},r.constructor);return _A.EndpointDefinition.fromJSON(e)}});var qo=B(gr=>{"use strict";f();var ZP=gr&&gr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eB=gr&&gr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tB=gr&&gr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ZP(e,r,t);return eB(e,r),e};Object.defineProperty(gr,"__esModule",{value:!0});gr.Fields=gr.Field=gr.FieldDefinition=void 0;var yg=tB(Ye()),rB=Jl(),Ju=class{constructor(e,t,i){this.name=e,this.description=t,this.type=i}static fromJSON(e){let t=new rB.TypeExpressionParser().parse(e.type);return new Ju(e.name,e.description,t)}};gr.FieldDefinition=Ju;var mg=class{constructor(e,t=""){this.value=e,this.name=t}checkTyping(e){let t=this.value.getType();if(!t.equals(e.type))throw new yg.ErrTypingSystem(`check type of field "${e.name}; expected: ${e.type}, actual: ${t}"`);if(this.name!=e.name)throw new yg.ErrTypingSystem(`check name of field "${e.name}"`)}equals(e){return this.name==e.name&&this.value.equals(e.value)}};gr.Field=mg;var wg=class{static checkTyping(e,t){if(e.length!=t.length)throw new yg.ErrTypingSystem("fields length vs. field definitions length");for(let i=0;i{"use strict";f();Object.defineProperty(gn,"__esModule",{value:!0});gn.EnumValue=gn.EnumVariantDefinition=gn.EnumType=void 0;var iB=Ye(),vg=Tr(),tf=qo(),CA=Ft(),bA=256,gs=class extends CA.CustomType{constructor(e,t){super(e),this.variants=[],this.variants=t}getClassName(){return gs.ClassName}static fromJSON(e){let t=(e.variants||[]).map(i=>Vo.fromJSON(i));return new gs(e.name,t)}getVariantByDiscriminant(e){let t=this.variants.find(i=>i.discriminant==e);return vg.guardValueIsSet(`variant by discriminant (${e})`,t),t}getVariantByName(e){let t=this.variants.find(i=>i.name==e);return vg.guardValueIsSet(`variant by name (${e})`,t),t}getNamesOfDependencies(){let e=[];for(let t of this.variants)e.push(...t.getNamesOfDependencies());return[...new Set(e)]}};gn.EnumType=gs;gs.ClassName="EnumType";var Vo=class{constructor(e,t,i=[]){this.fieldsDefinitions=[],vg.guardTrue(ttf.FieldDefinition.fromJSON(i));return new Vo(e.name,e.discriminant,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return tf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};gn.EnumVariantDefinition=Vo;var pn=class extends CA.TypedValue{constructor(e,t,i){super(e),this.fields=[],this.name=t.name,this.discriminant=t.discriminant,this.fields=i,this.fieldsByName=new Map(i.map(s=>[s.name,s]));let n=t.getFieldsDefinitions();tf.Fields.checkTyping(this.fields,n)}getClassName(){return pn.ClassName}static fromName(e,t){let i=e.getVariantByName(t);return new pn(e,i,[])}static fromDiscriminant(e,t){let i=e.getVariantByDiscriminant(t);return new pn(e,i,[])}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields(),n=this.name==e.name,s=this.discriminant==e.discriminant,o=tf.Fields.equals(t,i);return n&&s&&o}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new iB.ErrMissingFieldOnEnum(e,this.getType().getName())}valueOf(){let e={name:this.name,fields:[]};return this.fields.forEach(t=>e.fields[t.name]=t.value.valueOf()),e}};gn.EnumValue=pn;pn.ClassName="EnumValue"});var ms=B(Qo=>{"use strict";f();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.Struct=Qo.StructType=void 0;var nB=Ye(),rf=qo(),SA=Ft(),ys=class extends SA.CustomType{constructor(e,t){super(e),this.fieldsDefinitions=[],this.fieldsDefinitions=t}getClassName(){return ys.ClassName}static fromJSON(e){let t=(e.fields||[]).map(i=>rf.FieldDefinition.fromJSON(i));return new ys(e.name,t)}getFieldsDefinitions(){return this.fieldsDefinitions}getFieldDefinition(e){return this.fieldsDefinitions.find(t=>t.name==e)}getNamesOfDependencies(){return rf.Fields.getNamesOfTypeDependencies(this.fieldsDefinitions)}};Qo.StructType=ys;ys.ClassName="StructType";var Ho=class extends SA.TypedValue{constructor(e,t){super(e),this.fields=t,this.fieldsByName=new Map(t.map(i=>[i.name,i])),this.checkTyping()}getClassName(){return Ho.ClassName}checkTyping(){let t=this.getType().getFieldsDefinitions();rf.Fields.checkTyping(this.fields,t)}getFields(){return this.fields}getFieldValue(e){let t=this.fieldsByName.get(e);if(t)return t.value.valueOf();throw new nB.ErrMissingFieldOnStruct(e,this.getType().getName())}valueOf(){let e={};for(let t of this.fields)e[t.name]=t.value.valueOf();return e}equals(e){if(!this.getType().equals(e.getType()))return!1;let t=this.getFields(),i=e.getFields();return rf.Fields.equals(t,i)}};Qo.Struct=Ho;Ho.ClassName="Struct"});var Ko=B(Go=>{"use strict";f();Object.defineProperty(Go,"__esModule",{value:!0});Go.AddressValue=Go.AddressType=void 0;var sB=Gr(),xA=Ft(),ws=class extends xA.PrimitiveType{constructor(){super("Address")}getClassName(){return ws.ClassName}};Go.AddressType=ws;ws.ClassName="AddressType";var jo=class extends xA.PrimitiveValue{constructor(e){super(new ws),this.value=new sB.Address(e.bech32())}getClassName(){return jo.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Go.AddressValue=jo;jo.ClassName="AddressValue"});var nf=B(zo=>{"use strict";f();Object.defineProperty(zo,"__esModule",{value:!0});zo.OptionalValue=zo.OptionalType=void 0;var oB=Tr(),Zu=Ft(),yn=class extends Zu.Type{constructor(e){super("Optional",[e],Zu.TypeCardinality.variable(1))}getClassName(){return yn.ClassName}isAssignableFrom(e){if(!e.hasExactClass(yn.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(Zu.NullType.ClassName);return t||i}};zo.OptionalType=yn;yn.ClassName="OptionalType";var vs=class extends Zu.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return vs.ClassName}static newMissing(){let e=new yn(new Zu.NullType);return new vs(e)}isSet(){return!!this.value}getTypedValue(){return oB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};zo.OptionalValue=vs;vs.ClassName="OptionalValue"});var ec=B(Wo=>{"use strict";f();Object.defineProperty(Wo,"__esModule",{value:!0});Wo.BooleanValue=Wo.BooleanType=void 0;var TA=Ft(),Es=class extends TA.PrimitiveType{constructor(){super("bool")}getClassName(){return Es.ClassName}};Wo.BooleanType=Es;Es.ClassName="BooleanType";var ko=class extends TA.PrimitiveValue{constructor(e){super(new Es),this.value=e}getClassName(){return ko.ClassName}equals(e){return this.value===e.value}isTrue(){return this.value===!0}isFalse(){return!this.isTrue()}valueOf(){return this.value}};Wo.BooleanValue=ko;ko.ClassName="BooleanValue"});var wn=B($o=>{"use strict";f();Object.defineProperty($o,"__esModule",{value:!0});$o.BytesValue=$o.BytesType=void 0;var NA=Ft(),As=class extends NA.PrimitiveType{constructor(){super("bytes")}getClassName(){return As.ClassName}};$o.BytesType=As;As.ClassName="BytesType";var mn=class extends NA.PrimitiveValue{constructor(e){super(new As),this.value=e}getClassName(){return mn.ClassName}static fromUTF8(e){let t=y.Buffer.from(e,"utf-8");return new mn(t)}static fromHex(e){let t=y.Buffer.from(e,"hex");return new mn(t)}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()}};$o.BytesValue=mn;mn.ClassName="BytesValue"});var OA=B(Yo=>{"use strict";f();Object.defineProperty(Yo,"__esModule",{value:!0});Yo.CodeMetadataValue=Yo.CodeMetadataType=void 0;var DA=Ft(),sf=class extends DA.PrimitiveType{constructor(){super("CodeMetadata")}};Yo.CodeMetadataType=sf;var Eg=class extends DA.PrimitiveValue{constructor(e){super(new sf),this.value=e}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};Yo.CodeMetadataValue=Eg});var of=B(Jo=>{"use strict";f();Object.defineProperty(Jo,"__esModule",{value:!0});Jo.CompositeValue=Jo.CompositeType=void 0;var aB=Tr(),Ag=Ft(),Is=class extends Ag.Type{constructor(...e){super("Composite",e,Ag.TypeCardinality.variable(e.length))}getClassName(){return Is.ClassName}};Jo.CompositeType=Is;Is.ClassName="CompositeType";var _s=class extends Ag.TypedValue{constructor(e,t){super(e),aB.guardLength(t,e.getTypeParameters().length),this.items=t}getClassName(){return _s.ClassName}static fromItems(...e){let t=e.map(n=>n.getType()),i=new Is(...t);return new _s(i,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 t=0;t{"use strict";f();Object.defineProperty(af,"__esModule",{value:!0});af.CollectionOfTypedValues=void 0;var Ig=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 t=0;t{"use strict";f();Object.defineProperty(ci,"__esModule",{value:!0});ci.List=ci.OptionValue=ci.ListType=ci.OptionType=void 0;var uB=Tr(),cB=_g(),bs=Ft(),li=class extends bs.Type{constructor(e){super("Option",[e])}getClassName(){return li.ClassName}isAssignableFrom(e){if(!e.hasExactClass(li.ClassName))return!1;let t=this.getFirstTypeParameter().equals(e.getFirstTypeParameter()),i=e.getFirstTypeParameter().hasExactClass(bs.NullType.ClassName);return t||i}};ci.OptionType=li;li.ClassName="OptionType";var Cs=class extends bs.Type{constructor(e){super("List",[e])}getClassName(){return Cs.ClassName}};ci.ListType=Cs;Cs.ClassName="ListType";var Wi=class extends bs.TypedValue{constructor(e,t=null){super(e),this.value=t}getClassName(){return Wi.ClassName}static newMissing(){let e=new li(new bs.NullType);return new Wi(e)}static newMissingTyped(e){return new Wi(new li(e))}static newProvided(e){let t=new li(e.getType());return new Wi(t,e)}isSet(){return!!this.value}getTypedValue(){return uB.guardValueIsSet("value",this.value),this.value}valueOf(){return this.value?this.value.valueOf():null}equals(e){var t;return((t=this.value)===null||t===void 0?void 0:t.equals(e.value))||!1}};ci.OptionValue=Wi;Wi.ClassName="OptionValue";var vn=class extends bs.TypedValue{constructor(e,t){super(e),this.backingCollection=new cB.CollectionOfTypedValues(t)}getClassName(){return vn.ClassName}static fromItems(e){if(e.length==0)return new vn(new bs.TypePlaceholder,[]);let t=e[0].getType(),i=new Cs(t);return new vn(i,e)}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ci.List=vn;vn.ClassName="List"});var uf=B(ea=>{"use strict";f();Object.defineProperty(ea,"__esModule",{value:!0});ea.ArrayVec=ea.ArrayVecType=void 0;var PA=Tr(),lB=_g(),BA=Ft(),Xo=class extends BA.Type{constructor(e,t){super("Array",[t]),PA.guardTrue(e>0,"array length > 0"),this.length=e}getClassName(){return Xo.ClassName}};ea.ArrayVecType=Xo;Xo.ClassName="ArrayVecType";var Zo=class extends BA.TypedValue{constructor(e,t){super(e),PA.guardLength(t,e.length),this.backingCollection=new lB.CollectionOfTypedValues(t)}getClassName(){return Zo.ClassName}getLength(){return this.backingCollection.getLength()}getItems(){return this.backingCollection.getItems()}valueOf(){return this.backingCollection.valueOf()}equals(e){return this.backingCollection.equals(e.backingCollection)}};ea.ArrayVec=Zo;Zo.ClassName="ArrayVec"});var rc=B(ra=>{"use strict";f();Object.defineProperty(ra,"__esModule",{value:!0});ra.H256Value=ra.H256Type=void 0;var MA=Ft(),Ss=class extends MA.PrimitiveType{constructor(){super("H256")}getClassName(){return Ss.ClassName}};ra.H256Type=Ss;Ss.ClassName="H256Type";var ta=class extends MA.PrimitiveValue{constructor(e){super(new Ss),this.value=e}getClassName(){return ta.ClassName}equals(e){return this.value.equals(e.value)}valueOf(){return this.value}};ra.H256Value=ta;ta.ClassName="H256Value"});var cf=B(na=>{"use strict";f();Object.defineProperty(na,"__esModule",{value:!0});na.NothingValue=na.NothingType=void 0;var RA=Ft(),xs=class extends RA.PrimitiveType{constructor(){super("nothing")}getClassName(){return xs.ClassName}};na.NothingType=xs;xs.ClassName="NothingType";var ia=class extends RA.PrimitiveValue{constructor(){super(new xs)}getClassName(){return ia.ClassName}equals(e){return!1}valueOf(){return{}}};na.NothingValue=ia;ia.ClassName="NothingValue"});var ic=B(Ae=>{"use strict";f();var fB=Ae&&Ae.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),hB=Ae&&Ae.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),dB=Ae&&Ae.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&fB(e,r,t);return hB(e,r),e},pB=Ae&&Ae.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.BigIntValue=Ae.BigUIntValue=Ae.I64Value=Ae.U64Value=Ae.I32Value=Ae.U32Value=Ae.I16Value=Ae.U16Value=Ae.I8Value=Ae.U8Value=Ae.NumericalValue=Ae.BigIntType=Ae.BigUIntType=Ae.I64Type=Ae.U64Type=Ae.I32Type=Ae.U32Type=Ae.I16Type=Ae.U16Type=Ae.I8Type=Ae.U8Type=Ae.NumericalType=void 0;var LA=dB(Ye()),FA=Ft(),Us=pB(jr()),ir=class extends FA.PrimitiveType{constructor(e,t,i){super(e),this.sizeInBytes=t,this.withSign=i}getClassName(){return ir.ClassName}hasFixedSize(){return!!this.sizeInBytes}hasArbitrarySize(){return!this.hasFixedSize()}};Ae.NumericalType=ir;ir.ClassName="NumericalType";var Ts=class extends ir{constructor(){super("u8",1,!1)}getClassName(){return Ts.ClassName}};Ae.U8Type=Ts;Ts.ClassName="U8Type";var Ns=class extends ir{constructor(){super("i8",1,!0)}getClassName(){return Ns.ClassName}};Ae.I8Type=Ns;Ns.ClassName="I8Type";var Ds=class extends ir{constructor(){super("u16",2,!1)}getClassName(){return Ds.ClassName}};Ae.U16Type=Ds;Ds.ClassName="U16Type";var Os=class extends ir{constructor(){super("i16",2,!0)}getClassName(){return Os.ClassName}};Ae.I16Type=Os;Os.ClassName="I16Type";var Ps=class extends ir{constructor(){super("u32",4,!1)}getClassName(){return Ps.ClassName}};Ae.U32Type=Ps;Ps.ClassName="U32Type";var Bs=class extends ir{constructor(){super("i32",4,!0)}getClassName(){return Bs.ClassName}};Ae.I32Type=Bs;Bs.ClassName="I32Type";var Ms=class extends ir{constructor(){super("u64",8,!1)}getClassName(){return Ms.ClassName}};Ae.U64Type=Ms;Ms.ClassName="U64Type";var Rs=class extends ir{constructor(){super("i64",8,!0)}getClassName(){return Rs.ClassName}};Ae.I64Type=Rs;Rs.ClassName="I64Type";var Ls=class extends ir{constructor(){super("BigUint",0,!1)}getClassName(){return Ls.ClassName}};Ae.BigUIntType=Ls;Ls.ClassName="BigUIntType";var Fs=class extends ir{constructor(){super("Bigint",0,!0)}getClassName(){return Fs.ClassName}};Ae.BigIntType=Fs;Fs.ClassName="BigIntType";var nr=class extends FA.PrimitiveValue{constructor(e,t){if(super(e),this.value=new Us.default(t),this.sizeInBytes=e.sizeInBytes,this.withSign=e.withSign,this.value.isNaN())throw new LA.ErrInvalidArgument(`not a number: ${t}`);if(!this.withSign&&this.value.isNegative())throw new LA.ErrInvalidArgument(`negative, but type is unsigned: ${t}`)}getClassName(){return nr.ClassName}equals(e){return this.value.isEqualTo(e.value)}valueOf(){return this.value}toString(){return this.value.toString()}};Ae.NumericalValue=nr;nr.ClassName="NumericalValue";var sa=class extends nr{constructor(e){super(new Ts,new Us.default(e))}getClassName(){return sa.ClassName}};Ae.U8Value=sa;sa.ClassName="U8Value";var oa=class extends nr{constructor(e){super(new Ns,new Us.default(e))}getClassName(){return oa.ClassName}};Ae.I8Value=oa;oa.ClassName="I8Value";var aa=class extends nr{constructor(e){super(new Ds,new Us.default(e))}getClassName(){return aa.ClassName}};Ae.U16Value=aa;aa.ClassName="U16Value";var ua=class extends nr{constructor(e){super(new Os,new Us.default(e))}getClassName(){return ua.ClassName}};Ae.I16Value=ua;ua.ClassName="I16Value";var ca=class extends nr{constructor(e){super(new Ps,new Us.default(e))}getClassName(){return ca.ClassName}};Ae.U32Value=ca;ca.ClassName="U32Value";var la=class extends nr{constructor(e){super(new Bs,new Us.default(e))}getClassName(){return la.ClassName}};Ae.I32Value=la;la.ClassName="I32Value";var fa=class extends nr{constructor(e){super(new Ms,e)}getClassName(){return fa.ClassName}};Ae.U64Value=fa;fa.ClassName="U64Value";var ha=class extends nr{constructor(e){super(new Rs,e)}getClassName(){return ha.ClassName}};Ae.I64Value=ha;ha.ClassName="I64Value";var da=class extends nr{constructor(e){super(new Ls,e)}getClassName(){return da.ClassName}};Ae.BigUIntValue=da;da.ClassName="BigUIntValue";var pa=class extends nr{constructor(e){super(new Fs,e)}getClassName(){return pa.ClassName}};Ae.BigIntValue=pa;pa.ClassName="BigIntValue"});var lf=B(ga=>{"use strict";f();Object.defineProperty(ga,"__esModule",{value:!0});ga.StringValue=ga.StringType=void 0;var UA=Ft(),qs=class extends UA.PrimitiveType{constructor(){super("utf-8 string")}getClassName(){return qs.ClassName}};ga.StringType=qs;qs.ClassName="StringType";var En=class extends UA.PrimitiveValue{constructor(e){super(new qs),this.value=e}getClassName(){return En.ClassName}static fromUTF8(e){return new En(e)}static fromHex(e){let t=y.Buffer.from(e,"hex").toString();return new En(t)}getLength(){return this.value.length}equals(e){return this.value===e.value}valueOf(){return this.value}};ga.StringValue=En;En.ClassName="StringValue"});var ma=B(ya=>{"use strict";f();Object.defineProperty(ya,"__esModule",{value:!0});ya.TokenIdentifierValue=ya.TokenIdentifierType=void 0;var qA=Ft(),gB="EGLD",Vs=class extends qA.PrimitiveType{constructor(){super("TokenIdentifier")}getClassName(){return Vs.ClassName}};ya.TokenIdentifierType=Vs;Vs.ClassName="TokenIdentifierType";var An=class extends qA.PrimitiveValue{constructor(e){super(new Vs),this.value=e}static egld(){return new An(gB)}static esdtTokenIdentifier(e){return new An(e)}getClassName(){return An.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()}};ya.TokenIdentifierValue=An;An.ClassName="TokenIdentifierValue"});var ff=B(Nr=>{"use strict";f();var yB=Nr&&Nr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),mB=Nr&&Nr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),wB=Nr&&Nr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yB(e,r,t);return mB(e,r),e};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.Tuple=Nr.TupleType=void 0;var vB=wB(Ye()),EB=ms(),VA=qo(),AB=ms(),$i=class extends AB.StructType{constructor(...e){super($i.prepareName(e),$i.prepareFieldDefinitions(e))}getClassName(){return $i.ClassName}static prepareName(e){let t=e.map(n=>n.toString()).join(", ");return`tuple${t.length}<${t}>`}static prepareFieldDefinitions(e){return e.map((i,n)=>new VA.FieldDefinition(HA(n),"anonymous tuple field",i))}};Nr.TupleType=$i;$i.ClassName="TupleType";function HA(r){return`field${r}`}var Hs=class extends EB.Struct{constructor(e,t){super(e,t)}getClassName(){return Hs.ClassName}static fromItems(e){if(e.length<1)throw new vB.ErrTypingSystem("bad tuple items");let t=e.map(s=>s.getType()),i=new $i(...t),n=e.map((s,o)=>new VA.Field(s,HA(o)));return new Hs(i,n)}};Nr.Tuple=Hs;Hs.ClassName="Tuple"});var df=B(wa=>{"use strict";f();Object.defineProperty(wa,"__esModule",{value:!0});wa.VariadicValue=wa.VariadicType=void 0;var hf=Ft(),_n=class extends hf.Type{constructor(e){super("Variadic",[e],hf.TypeCardinality.variable())}getClassName(){return _n.ClassName}};wa.VariadicType=_n;_n.ClassName="VariadicType";var In=class extends hf.TypedValue{constructor(e,t){super(e),this.items=t}getClassName(){return In.ClassName}static fromItems(...e){if(e.length==0)return new In(new _n(new hf.TypePlaceholder),[]);let t=e[0].getType();return new In(new _n(t),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 t=0;t{"use strict";f();var IB=fi&&fi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),_B=fi&&fi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bB=fi&&fi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&IB(e,r,t);return _B(e,r),e};Object.defineProperty(fi,"__esModule",{value:!0});fi.TypeMapper=void 0;var QA=bB(Ye()),CB=Ko(),bg=nf(),SB=ec(),xB=wn(),TB=OA(),pf=of(),Cg=Xu(),NB=qo(),jA=tc(),gf=uf(),DB=rc(),GA=cf(),Dr=ic(),OB=lf(),KA=ms(),zA=ma(),bn=ff(),Sg=df(),xg=class{constructor(e=[]){this.openTypesFactories=new Map([["Option",(...t)=>new jA.OptionType(t[0])],["List",(...t)=>new jA.ListType(t[0])],["VarArgs",(...t)=>new Sg.VariadicType(t[0])],["MultiResultVec",(...t)=>new Sg.VariadicType(t[0])],["variadic",(...t)=>new Sg.VariadicType(t[0])],["OptionalArg",(...t)=>new bg.OptionalType(t[0])],["optional",(...t)=>new bg.OptionalType(t[0])],["OptionalResult",(...t)=>new bg.OptionalType(t[0])],["multi",(...t)=>new pf.CompositeType(...t)],["MultiArg",(...t)=>new pf.CompositeType(...t)],["MultiResult",(...t)=>new pf.CompositeType(...t)],["multi",(...t)=>new pf.CompositeType(...t)],["tuple",(...t)=>new bn.TupleType(...t)],["tuple2",(...t)=>new bn.TupleType(...t)],["tuple3",(...t)=>new bn.TupleType(...t)],["tuple4",(...t)=>new bn.TupleType(...t)],["tuple5",(...t)=>new bn.TupleType(...t)],["tuple6",(...t)=>new bn.TupleType(...t)],["tuple7",(...t)=>new bn.TupleType(...t)],["tuple8",(...t)=>new bn.TupleType(...t)],["array20",(...t)=>new gf.ArrayVecType(20,t[0])],["array32",(...t)=>new gf.ArrayVecType(32,t[0])],["array46",(...t)=>new gf.ArrayVecType(46,t[0])],["array64",(...t)=>new gf.ArrayVecType(64,t[0])]]),this.closedTypesMap=new Map([["u8",new Dr.U8Type],["u16",new Dr.U16Type],["u32",new Dr.U32Type],["u64",new Dr.U64Type],["U64",new Dr.U64Type],["BigUint",new Dr.BigUIntType],["i8",new Dr.I8Type],["i16",new Dr.I16Type],["i32",new Dr.I32Type],["i64",new Dr.I64Type],["Bigint",new Dr.BigIntType],["BigInt",new Dr.BigIntType],["bool",new SB.BooleanType],["bytes",new xB.BytesType],["Address",new CB.AddressType],["H256",new DB.H256Type],["utf-8 string",new OB.StringType],["TokenIdentifier",new zA.TokenIdentifierType],["EgldOrEsdtTokenIdentifier",new zA.TokenIdentifierType],["CodeMetadata",new TB.CodeMetadataType],["nothing",new GA.NothingType],["AsyncCall",new GA.NothingType]]),this.learnedTypesMap=new Map;for(let t of e)this.learnedTypesMap.set(t.getName(),t)}mapType(e){let t=this.mapTypeRecursively(e);if(t)return t.isGenericType()||this.learnType(t),t;throw new QA.ErrTypingSystem(`Cannot map the type "${e.getName()}" to a known type`)}mapTypeRecursively(e){let t=e.isGenericType(),i=this.learnedTypesMap.get(e.getName());if(i)return i;let n=this.closedTypesMap.get(e.getName());return n||(e.hasExactClass(Cg.EnumType.ClassName)?this.mapEnumType(e):e.hasExactClass(KA.StructType.ClassName)?this.mapStructType(e):t?this.mapGenericType(e):null)}learnType(e){this.learnedTypesMap.delete(e.getName()),this.learnedTypesMap.set(e.getName(),e)}mapStructType(e){let t=this.mappedFields(e.getFieldsDefinitions());return new KA.StructType(e.getName(),t)}mapEnumType(e){let t=e.variants.map(n=>new Cg.EnumVariantDefinition(n.name,n.discriminant,this.mappedFields(n.getFieldsDefinitions())));return new Cg.EnumType(e.getName(),t)}mappedFields(e){return e.map(t=>new NB.FieldDefinition(t.name,t.description,this.mapType(t.type)))}mapGenericType(e){let i=e.getTypeParameters().map(s=>this.mapType(s)),n=this.openTypesFactories.get(e.getName());if(!n)throw new QA.ErrTypingSystem(`Cannot map the generic type "${e.getName()}" to a known type`);return n(...i)}};fi.TypeMapper=xg});var XA=B(hi=>{"use strict";f();var PB=hi&&hi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),BB=hi&&hi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),MB=hi&&hi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&PB(e,r,t);return BB(e,r),e};Object.defineProperty(hi,"__esModule",{value:!0});hi.AbiRegistry=void 0;var kA=MB(Ye()),Ng=Tr(),WA=gg(),Dg=Zl(),$A=Xu(),YA=ms(),RB=Tg(),va=class{constructor(){this.interfaces=[],this.customTypes=[]}static create(e){return new va().extend(e).remapToKnownTypes()}extend(e){e.types=e.types||{};let t=WA.ContractInterface.fromJSON(e);this.interfaces.push(t);for(let i in e.types){let n=e.types[i],s=n.type;n.name=i;let o=this.createCustomType(s,n);this.customTypes.push(o)}return this}createCustomType(e,t){if(e=="struct")return YA.StructType.fromJSON(t);if(e=="enum")return $A.EnumType.fromJSON(t);throw new kA.ErrTypingSystem(`Unknown type discriminant: ${e}`)}getInterface(e){let t=this.interfaces.find(i=>i.name==e);return Ng.guardValueIsSetWithMessage(`interface [${e}] not found`,t),t}getInterfaces(e){return e.map(t=>this.getInterface(t))}getStruct(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass(YA.StructType.ClassName));return Ng.guardValueIsSetWithMessage(`struct [${e}] not found`,t),t}getStructs(e){return e.map(t=>this.getStruct(t))}getEnum(e){let t=this.customTypes.find(i=>i.getName()==e&&i.hasExactClass($A.EnumType.ClassName));return Ng.guardValueIsSetWithMessage(`enum [${e}] not found`,t),t}getEnums(e){return e.map(t=>this.getEnum(t))}remapToKnownTypes(){let e=new RB.TypeMapper([]),t=[],i=[];for(let s of this.customTypes)this.mapCustomTypeDepthFirst(s,this.customTypes,e,t);if(this.customTypes.length!=t.length)throw new kA.ErrTypingSystem("Did not re-map all custom types");for(let s of this.interfaces){let o=[];for(let u of s.endpoints)o.push(JA(u,e));let a=s.constructorDefinition?JA(s.constructorDefinition,e):null;i.push(new WA.ContractInterface(s.name,a,o))}let n=new va;return n.customTypes.push(...t),n.interfaces.push(...i),n}mapCustomTypeDepthFirst(e,t,i,n){if(n.findIndex(a=>a.getName()==e.getName())>=0)return;for(let a of e.getNamesOfDependencies()){let u=t.find(h=>h.getName()==a);u&&this.mapCustomTypeDepthFirst(u,t,i,n)}let o=i.mapType(e);n.push(o)}};hi.AbiRegistry=va;function JA(r,e){let t=r.input.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type))),i=r.output.map(n=>new Dg.EndpointParameterDefinition(n.name,n.description,e.mapType(n.type)));return new Dg.EndpointDefinition(r.name,t,i,r.modifiers)}});var eI=B(Ea=>{"use strict";f();Object.defineProperty(Ea,"__esModule",{value:!0});Ea.createListOfTokenIdentifiers=Ea.createListOfAddresses=void 0;var LB=Ko(),ZA=tc(),FB=ma();function UB(r){let e=r.map(i=>new LB.AddressValue(i));return ZA.List.fromItems(e)}Ea.createListOfAddresses=UB;function qB(r){let e=r.map(i=>new FB.TokenIdentifierValue(i));return ZA.List.fromItems(e)}Ea.createListOfTokenIdentifiers=qB});var pI=B(sr=>{"use strict";f();var VB=sr&&sr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),HB=sr&&sr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),QB=sr&&sr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&VB(e,r,t);return HB(e,r),e};Object.defineProperty(sr,"__esModule",{value:!0});sr.onPrimitiveTypeSelect=sr.onPrimitiveValueSelect=sr.onTypedValueSelect=sr.onTypeSelect=void 0;var mf=QB(Ye()),tI=Ko(),rI=ec(),iI=wn(),nI=Xu(),yf=tc(),sI=rc(),oI=ic(),aI=cf(),uI=ms(),cI=ma(),lI=ff(),fI=Ft(),hI=uf(),dI=lf();function jB(r,e){if(r.hasExactClass(yf.OptionType.ClassName))return e.onOption();if(r.hasExactClass(yf.ListType.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVecType.ClassName))return e.onArray();if(r.hasClassOrSuperclass(fI.PrimitiveType.ClassName))return e.onPrimitive();if(r.hasExactClass(uI.StructType.ClassName))return e.onStruct();if(r.hasExactClass(lI.TupleType.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumType.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't known: ${r}`)}sr.onTypeSelect=jB;function GB(r,e){if(r.hasClassOrSuperclass(fI.PrimitiveValue.ClassName))return e.onPrimitive();if(r.hasExactClass(yf.OptionValue.ClassName))return e.onOption();if(r.hasExactClass(yf.List.ClassName))return e.onList();if(r.hasExactClass(hI.ArrayVec.ClassName))return e.onArray();if(r.hasExactClass(uI.Struct.ClassName))return e.onStruct();if(r.hasExactClass(lI.Tuple.ClassName))return e.onTuple();if(r.hasExactClass(nI.EnumValue.ClassName))return e.onEnum();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't typed: ${r}`)}sr.onTypedValueSelect=GB;function KB(r,e){if(r.hasExactClass(rI.BooleanValue.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalValue.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressValue.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesValue.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringValue.ClassName))return e.onString();if(r.hasExactClass(sI.H256Value.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierValue.ClassName))return e.onTypeIdentifier();if(r.hasExactClass(aI.NothingValue.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`value isn't a primitive: ${r.getType()}`)}sr.onPrimitiveValueSelect=KB;function zB(r,e){if(r.hasExactClass(rI.BooleanType.ClassName))return e.onBoolean();if(r.hasClassOrSuperclass(oI.NumericalType.ClassName))return e.onNumerical();if(r.hasExactClass(tI.AddressType.ClassName))return e.onAddress();if(r.hasExactClass(iI.BytesType.ClassName))return e.onBytes();if(r.hasExactClass(dI.StringType.ClassName))return e.onString();if(r.hasExactClass(sI.H256Type.ClassName))return e.onH256();if(r.hasExactClass(cI.TokenIdentifierType.ClassName))return e.onTokenIndetifier();if(r.hasExactClass(aI.NothingType.ClassName))return e.onNothing();if(e.onOther)return e.onOther();throw new mf.ErrTypingSystem(`type isn't a known primitive: ${r}`)}sr.onPrimitiveTypeSelect=zB});var or=B(Ve=>{"use strict";f();var kB=Ve&&Ve.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),Je=Ve&&Ve.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&kB(e,r,t)};Object.defineProperty(Ve,"__esModule",{value:!0});Je(XA(),Ve);Je(Ko(),Ve);Je(nf(),Ve);Je(ec(),Ve);Je(wn(),Ve);Je(of(),Ve);Je(gg(),Ve);Je(Zl(),Ve);Je(Xu(),Ve);Je(eI(),Ve);Je(qo(),Ve);Je(tc(),Ve);Je(uf(),Ve);Je(rc(),Ve);Je(pI(),Ve);Je(cf(),Ve);Je(ic(),Ve);Je(lf(),Ve);Je(ms(),Ve);Je(ff(),Ve);Je(ma(),Ve);Je(Jl(),Ve);Je(Tg(),Ve);Je(Ft(),Ve);Je(df(),Ve)});var yI=B(di=>{"use strict";f();var WB=di&&di.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),$B=di&&di.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),YB=di&&di.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&WB(e,r,t);return $B(e,r),e};Object.defineProperty(di,"__esModule",{value:!0});di.OptionValueBinaryCodec=void 0;var gI=YB(Ye()),wf=or(),Og=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){if(e[0]==0)return[wf.OptionValue.newMissingTyped(t),1];if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return[wf.OptionValue.newProvided(i),n+1]}decodeTopLevel(e,t){if(e.length==0)return new wf.OptionValue(t);if(e[0]!=1)throw new gI.ErrCodec("invalid buffer for optional value");let[i,n]=this.binaryCodec.decodeNested(e.slice(1),t);return new wf.OptionValue(t,i)}encodeNested(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([0])}encodeTopLevel(e){return e.isSet()?y.Buffer.concat([y.Buffer.from([1]),this.binaryCodec.encodeNested(e.getTypedValue())]):y.Buffer.from([])}};di.OptionValueBinaryCodec=Og});var mI=B(vf=>{"use strict";f();Object.defineProperty(vf,"__esModule",{value:!0});vf.AddressBinaryCodec=void 0;var JB=Gr(),XB=or(),Pg=class{decodeNested(e){let t=e.slice(0,32),i=new JB.Address(t);return[new XB.AddressValue(i),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf().pubkey()}encodeTopLevel(e){return e.valueOf().pubkey()}};vf.AddressBinaryCodec=Pg});var vI=B(pi=>{"use strict";f();var ZB=pi&&pi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),eM=pi&&pi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),tM=pi&&pi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ZB(e,r,t);return eM(e,r),e};Object.defineProperty(pi,"__esModule",{value:!0});pi.BooleanBinaryCodec=void 0;var rM=tM(Ye()),wI=or(),Kr=class{decodeNested(e){let t=e.readUInt8(0);return[new wI.BooleanValue(t==Kr.TRUE),1]}decodeTopLevel(e){if(e.length>1)throw new rM.ErrInvalidArgument("buffer should be of size <= 1");let t=e[0];return new wI.BooleanValue(t==Kr.TRUE)}encodeNested(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([Kr.FALSE])}encodeTopLevel(e){return e.isTrue()?y.Buffer.from([Kr.TRUE]):y.Buffer.from([])}};pi.BooleanBinaryCodec=Kr;Kr.TRUE=1;Kr.FALSE=0});var Af=B(Ef=>{"use strict";f();Object.defineProperty(Ef,"__esModule",{value:!0});Ef.SizeOfU32=void 0;Ef.SizeOfU32=4});var AI=B(gi=>{"use strict";f();var iM=gi&&gi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(gi,"__esModule",{value:!0});gi.zeroPadStringIfOddLength=gi.isPaddedHex=gi.numberToPaddedHex=void 0;var nM=iM(jr());function sM(r){let e=new nM.default(r).toString(16);return EI(e)}gi.numberToPaddedHex=sM;function oM(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}gi.isPaddedHex=oM;function EI(r){return r=r||"",r.length%2==1?"0"+r:r}gi.zeroPadStringIfOddLength=EI});var Mg=B(Ut=>{"use strict";f();var aM=Ut&&Ut.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ut,"__esModule",{value:!0});Ut.prependByteToBuffer=Ut.flipBufferBitsInPlace=Ut.getHexMagnitudeOfBigInt=Ut.bigIntToBuffer=Ut.bufferToBigInt=Ut.cloneBuffer=Ut.isMsbZero=Ut.isMsbOne=void 0;var Bg=aM(jr()),uM=AI();function II(r,e=0){return r[e]>>7==1}Ut.isMsbOne=II;function cM(r,e=0){return!II(r,e)}Ut.isMsbZero=cM;function lM(r){let e=y.Buffer.alloc(r.length);return r.copy(e),e}Ut.cloneBuffer=lM;function fM(r){let e=r.toString("hex");return new Bg.default(`0x${e}`,16)}Ut.bufferToBigInt=fM;function hM(r){let e=_I(r);return y.Buffer.from(e,"hex")}Ut.bigIntToBuffer=hM;function _I(r){return r=new Bg.default(r),r?(r.isNegative()&&(r=r.multipliedBy(new Bg.default(-1))),uM.numberToPaddedHex(r)):""}Ut.getHexMagnitudeOfBigInt=_I;function dM(r){for(let e=0;e{"use strict";f();var gM=Aa&&Aa.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Aa,"__esModule",{value:!0});Aa.NumericalBinaryCodec=void 0;var nc=gM(jr()),Rg=or(),bI=Af(),pt=Mg(),Lg=class{decodeNested(e,t){let i=0,n=t.sizeInBytes;n||(i=bI.SizeOfU32,n=e.readUInt32BE(0));let s=e.slice(i,i+n),o=this.decodeTopLevel(s,t),a=n+i;return[o,a]}decodeTopLevel(e,t){let i=pt.cloneBuffer(e);if(e.length==0)return new Rg.NumericalValue(t,new nc.default(0));if(!t.withSign||pt.isMsbZero(i)){let h=pt.bufferToBigInt(i);return new Rg.NumericalValue(t,h)}pt.flipBufferBitsInPlace(i);let u=pt.bufferToBigInt(i).multipliedBy(new nc.default(-1)).minus(new nc.default(1));return new Rg.NumericalValue(t,u)}encodeNested(e){if(e.sizeInBytes)return this.encodeNestedFixedSize(e,e.sizeInBytes);let t=this.encodeTopLevel(e),i=y.Buffer.alloc(bI.SizeOfU32);return i.writeUInt32BE(t.length),y.Buffer.concat([i,t])}encodeNestedFixedSize(e,t){if(e.value.isZero())return y.Buffer.alloc(t,0);if(!e.withSign){let o=pt.bigIntToBuffer(e.value),a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}if(e.value.isPositive()){let o=pt.bigIntToBuffer(e.value);pt.isMsbOne(o)&&(o=pt.prependByteToBuffer(o,0));let a=y.Buffer.alloc(t-o.length,0);return y.Buffer.concat([a,o])}let i=e.value.plus(new nc.default(1)),n=pt.bigIntToBuffer(i);pt.flipBufferBitsInPlace(n),pt.isMsbZero(n)&&(n=pt.prependByteToBuffer(n,255));let s=y.Buffer.alloc(t-n.length,255);return y.Buffer.concat([s,n])}encodeTopLevel(e){let t=e.withSign;return e.value.isZero()?y.Buffer.alloc(0):t?this.encodePrimitive(e):pt.bigIntToBuffer(e.value)}encodePrimitive(e){if(e.value.isPositive()){let n=pt.bigIntToBuffer(e.value);return pt.isMsbOne(n)&&(n=pt.prependByteToBuffer(n,0)),n}let t=e.value.plus(new nc.default(1)),i=pt.bigIntToBuffer(t);return pt.flipBufferBitsInPlace(i),pt.isMsbZero(i)&&(i=pt.prependByteToBuffer(i,255)),i}};Aa.NumericalBinaryCodec=Lg});var SI=B(If=>{"use strict";f();Object.defineProperty(If,"__esModule",{value:!0});If.H256BinaryCodec=void 0;var yM=rc(),Fg=class{decodeNested(e){let t=e.slice(0,32);return[new yM.H256Value(t),32]}decodeTopLevel(e){let[t,i]=this.decodeNested(e);return t}encodeNested(e){return e.valueOf()}encodeTopLevel(e){return e.valueOf()}};If.H256BinaryCodec=Fg});var Cf=B(bf=>{"use strict";f();Object.defineProperty(bf,"__esModule",{value:!0});bf.BytesBinaryCodec=void 0;var xI=wn(),_f=Af(),Ug=class{decodeNested(e){let t=e.readUInt32BE(0),i=e.slice(_f.SizeOfU32,_f.SizeOfU32+t);return[new xI.BytesValue(i),_f.SizeOfU32+t]}decodeTopLevel(e){return new xI.BytesValue(e)}encodeNested(e){let t=y.Buffer.alloc(_f.SizeOfU32);return t.writeUInt32BE(e.getLength()),y.Buffer.concat([t,e.valueOf()])}encodeTopLevel(e){return e.valueOf()}};bf.BytesBinaryCodec=Ug});var NI=B(Sf=>{"use strict";f();Object.defineProperty(Sf,"__esModule",{value:!0});Sf.TokenIdentifierCodec=void 0;var mM=wn(),TI=ma(),wM=Cf(),qg=class{constructor(){this.bytesCodec=new wM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesCodec.decodeNested(e);return[new TI.TokenIdentifierValue(t.toString()),i]}decodeTopLevel(e){let t=this.bytesCodec.decodeTopLevel(e);return new TI.TokenIdentifierValue(t.toString())}encodeNested(e){let t=mM.BytesValue.fromUTF8(e.valueOf());return this.bytesCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Sf.TokenIdentifierCodec=qg});var OI=B(xf=>{"use strict";f();Object.defineProperty(xf,"__esModule",{value:!0});xf.NothingCodec=void 0;var DI=or(),Vg=class{decodeNested(){return[new DI.NothingValue,0]}decodeTopLevel(){return new DI.NothingValue}encodeNested(){return y.Buffer.from([])}encodeTopLevel(){return y.Buffer.from([])}};xf.NothingCodec=Vg});var BI=B(Tf=>{"use strict";f();Object.defineProperty(Tf,"__esModule",{value:!0});Tf.StringBinaryCodec=void 0;var PI=or(),vM=wn(),EM=Cf(),Hg=class{constructor(){this.bytesBinaryCodec=new EM.BytesBinaryCodec}decodeNested(e){let[t,i]=this.bytesBinaryCodec.decodeNested(e);return[new PI.StringValue(t.valueOf().toString()),i]}decodeTopLevel(e){return new PI.StringValue(e.toString())}encodeNested(e){let t=vM.BytesValue.fromUTF8(e.valueOf());return this.bytesBinaryCodec.encodeNested(t)}encodeTopLevel(e){return y.Buffer.from(e.valueOf())}};Tf.StringBinaryCodec=Hg});var MI=B(Df=>{"use strict";f();Object.defineProperty(Df,"__esModule",{value:!0});Df.PrimitiveBinaryCodec=void 0;var Nf=or(),AM=mI(),IM=vI(),_M=CI(),bM=SI(),CM=Cf(),SM=NI(),xM=OI(),TM=BI(),Qg=class{constructor(e){this.binaryCodec=e,this.booleanCodec=new IM.BooleanBinaryCodec,this.numericalCodec=new _M.NumericalBinaryCodec,this.addressCodec=new AM.AddressBinaryCodec,this.h256Codec=new bM.H256BinaryCodec,this.bytesCodec=new CM.BytesBinaryCodec,this.stringCodec=new TM.StringBinaryCodec,this.tokenIdentifierCodec=new SM.TokenIdentifierCodec,this.nothingCodec=new xM.NothingCodec}decodeNested(e,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeNested(e),onNumerical:()=>this.numericalCodec.decodeNested(e,t),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,t){return Nf.onPrimitiveTypeSelect(t,{onBoolean:()=>this.booleanCodec.decodeTopLevel(e),onNumerical:()=>this.numericalCodec.decodeTopLevel(e,t),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 Nf.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 Nf.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()})}};Df.PrimitiveBinaryCodec=Qg});var FI=B(Of=>{"use strict";f();Object.defineProperty(Of,"__esModule",{value:!0});Of.ListBinaryCodec=void 0;var RI=or(),LI=Af(),jg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.getFirstTypeParameter(),n=[],s=e.readUInt32BE(0);this.binaryCodec.constraints.checkListLength(s);let o=e,a=LI.SizeOfU32;e=o.slice(a);for(let u=0;u0;){let[a,u]=this.binaryCodec.decodeNested(e,i);n.push(a),o+=u,e=s.slice(o),this.binaryCodec.constraints.checkListLength(n.length)}return new RI.List(t,n)}encodeNested(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=y.Buffer.alloc(LI.SizeOfU32);t.writeUInt32BE(e.getLength());let i=[];for(let s of e.getItems()){let o=this.binaryCodec.encodeNested(s);i.push(o)}return y.Buffer.concat([t,...i])}encodeTopLevel(e){this.binaryCodec.constraints.checkListLength(e.getLength());let t=[];for(let n of e.getItems()){let s=this.binaryCodec.encodeNested(n);t.push(s)}return y.Buffer.concat(t)}};Of.ListBinaryCodec=jg});var Kg=B(Pf=>{"use strict";f();Object.defineProperty(Pf,"__esModule",{value:!0});Pf.FieldsBinaryCodec=void 0;var NM=or(),Gg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=[],n=0;for(let s of t){let[o,a]=this.binaryCodec.decodeNested(e,s.type);e=e.slice(a),n+=a;let u=new NM.Field(o,s.name);i.push(u)}return[i,n]}encodeNested(e){let t=[];for(let i of e){let n=this.binaryCodec.encodeNested(i.value);t.push(n)}return y.Buffer.concat(t)}};Pf.FieldsBinaryCodec=Gg});var kg=B(Bf=>{"use strict";f();Object.defineProperty(Bf,"__esModule",{value:!0});Bf.StructBinaryCodec=void 0;var DM=or(),OM=Kg(),zg=class{constructor(e){this.fieldsCodec=new OM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let i=t.getFieldsDefinitions(),[n,s]=this.fieldsCodec.decodeNested(e,i);return[new DM.Struct(t,n),s]}encodeNested(e){let t=e.getFields();return this.fieldsCodec.encodeNested(t)}encodeTopLevel(e){return this.encodeNested(e)}};Bf.StructBinaryCodec=zg});var UI=B(Rf=>{"use strict";f();Object.defineProperty(Rf,"__esModule",{value:!0});Rf.EnumBinaryCodec=void 0;var Mf=or(),PM=Kg(),Wg=class{constructor(e){this.binaryCodec=e,this.fieldsCodec=new PM.FieldsBinaryCodec(e)}decodeTopLevel(e,t){let[i]=this.decodeNested(e,t);return i}decodeNested(e,t){let[i,n]=this.readDiscriminant(e);e=e.slice(n);let s=t.getVariantByDiscriminant(i),o=s.getFieldsDefinitions(),[a,u]=this.fieldsCodec.decodeNested(e,o);return[new Mf.EnumValue(t,s,a),n+u]}readDiscriminant(e){let[t,i]=this.binaryCodec.decodeNested(e,new Mf.U8Type);return[t.valueOf(),i]}encodeNested(e){let t=new Mf.U8Value(e.discriminant),i=this.binaryCodec.encodeNested(t),n=e.getFields(),s=this.fieldsCodec.encodeNested(n);return y.Buffer.concat([i,s])}encodeTopLevel(e){let t=e.getFields(),i=t.length>0,n=this.fieldsCodec.encodeNested(t),s=new Mf.U8Value(e.discriminant),o=i?this.binaryCodec.encodeNested(s):this.binaryCodec.encodeTopLevel(s);return y.Buffer.concat([o,n])}};Rf.EnumBinaryCodec=Wg});var qI=B(Lf=>{"use strict";f();Object.defineProperty(Lf,"__esModule",{value:!0});Lf.TupleBinaryCodec=void 0;var BM=kg(),$g=class{constructor(e){this.structCodec=new BM.StructBinaryCodec(e)}decodeTopLevel(e,t){return this.structCodec.decodeTopLevel(e,t)}decodeNested(e,t){return this.structCodec.decodeNested(e,t)}encodeNested(e){return this.structCodec.encodeNested(e)}encodeTopLevel(e){return this.structCodec.encodeTopLevel(e)}};Lf.TupleBinaryCodec=$g});var VI=B(Ff=>{"use strict";f();Object.defineProperty(Ff,"__esModule",{value:!0});Ff.ArrayVecBinaryCodec=void 0;var MM=or(),Yg=class{constructor(e){this.binaryCodec=e}decodeNested(e,t){let i=t.length,n=t.getFirstTypeParameter(),s=[],o=0;for(let a=0;a{"use strict";f();var RM=Or&&Or.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),LM=Or&&Or.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),FM=Or&&Or.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&RM(e,r,t);return LM(e,r),e};Object.defineProperty(Or,"__esModule",{value:!0});Or.BinaryCodecConstraints=Or.BinaryCodec=void 0;var HI=FM(Ye()),Uf=or(),QI=Tr(),UM=yI(),qM=MI(),VM=FI(),HM=kg(),QM=UI(),jM=qI(),GM=VI(),Jg=class{constructor(e=null){this.constraints=e||new qf,this.optionCodec=new UM.OptionValueBinaryCodec(this),this.listCodec=new VM.ListBinaryCodec(this),this.arrayCodec=new GM.ArrayVecBinaryCodec(this),this.primitiveCodec=new qM.PrimitiveBinaryCodec(this),this.structCodec=new HM.StructBinaryCodec(this),this.tupleCodec=new jM.TupleBinaryCodec(this),this.enumCodec=new QM.EnumBinaryCodec(this)}decodeTopLevel(e,t){return this.constraints.checkBufferLength(e),Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeTopLevel(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeTopLevel(e,t),onArray:()=>this.arrayCodec.decodeTopLevel(e,t),onPrimitive:()=>this.primitiveCodec.decodeTopLevel(e,t),onStruct:()=>this.structCodec.decodeTopLevel(e,t),onTuple:()=>this.tupleCodec.decodeTopLevel(e,t),onEnum:()=>this.enumCodec.decodeTopLevel(e,t)})}decodeNested(e,t){this.constraints.checkBufferLength(e);let[i,n]=Uf.onTypeSelect(t,{onOption:()=>this.optionCodec.decodeNested(e,t.getFirstTypeParameter()),onList:()=>this.listCodec.decodeNested(e,t),onArray:()=>this.arrayCodec.decodeNested(e,t),onPrimitive:()=>this.primitiveCodec.decodeNested(e,t),onStruct:()=>this.structCodec.decodeNested(e,t),onTuple:()=>this.tupleCodec.decodeNested(e,t),onEnum:()=>this.enumCodec.decodeNested(e,t)});return[i,n]}encodeNested(e){return QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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 QI.guardTrue(e.getType().getCardinality().isSingular(),"singular cardinality, thus encodable type"),Uf.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)})}};Or.BinaryCodec=Jg;var qf=class{constructor(e){this.maxBufferLength=e?.maxBufferLength||40960,this.maxListLength=e?.maxListLength||8192}checkBufferLength(e){if(e.length>this.maxBufferLength)throw new HI.ErrCodec(`Buffer too large: ${e.length} > ${this.maxBufferLength}`)}checkListLength(e){if(e>this.maxListLength)throw new HI.ErrCodec(`List too large: ${e} > ${this.maxListLength}`)}};Or.BinaryCodecConstraints=qf});var jI=B(Pr=>{"use strict";f();var KM=Pr&&Pr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Pr,"__esModule",{value:!0});Pr.decodeBigNumber=Pr.decodeString=Pr.decodeBool=Pr.decodeUnsignedNumber=void 0;var zM=KM(jr()),Vf=or(),kM=Xg(),Hf=new kM.BinaryCodec;function WM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return Number(e.valueOf())}Pr.decodeUnsignedNumber=WM;function $M(r){let e=Hf.decodeTopLevel(r,new Vf.BooleanType);return Boolean(e.valueOf())}Pr.decodeBool=$M;function YM(r){let e=Hf.decodeTopLevel(r,new Vf.BytesType);return String(e.valueOf())}Pr.decodeString=YM;function JM(r){let e=Hf.decodeTopLevel(r,new Vf.BigUIntType);return new zM.default(e.valueOf())}Pr.decodeBigNumber=JM});var KI=B(Cn=>{"use strict";f();var XM=Cn&&Cn.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),GI=Cn&&Cn.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&XM(e,r,t)};Object.defineProperty(Cn,"__esModule",{value:!0});GI(Xg(),Cn);GI(jI(),Cn)});var jf=B(Qf=>{"use strict";f();Object.defineProperty(Qf,"__esModule",{value:!0});Qf.ArgSerializer=void 0;var zI=Wu(),ZM=KI(),Zg=nf(),ey=of(),ty=df(),eR={codec:new ZM.BinaryCodec},ry=class{constructor(e){e=Object.assign(Object.assign({},eR),e),this.codec=e.codec}stringToValues(e,t){let i=this.stringToBuffers(e);return this.buffersToValues(i,t)}stringToBuffers(e){return e.split(zI.ARGUMENTS_SEPARATOR).map(t=>y.Buffer.from(t,"hex"))}buffersToValues(e,t){let i=this;e=e||[];let n=[],s=0,o=e.length;for(let p=0;p=o}return n}valuesToString(e){let t=this.valuesToStrings(e),i=t.join(zI.ARGUMENTS_SEPARATOR),n=t.length;return{argumentsString:i,count:n}}valuesToStrings(e){return this.valuesToBuffers(e).map(n=>n.toString("hex"))}valuesToBuffers(e){let t=this,i=[];for(let s of e)n(s);function n(s){if(s.hasExactClass(Zg.OptionalValue.ClassName)){let o=s;o.isSet()&&n(o.getTypedValue())}else if(s.hasExactClass(ty.VariadicValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else if(s.hasExactClass(ey.CompositeValue.ClassName)){let o=s;for(let a of o.getItems())n(a)}else{let o=t.codec.encodeTopLevel(s);i.push(o)}}return i}};Qf.ArgSerializer=ry});var cy=B(zr=>{"use strict";f();Object.defineProperty(zr,"__esModule",{value:!0});zr.ContractCallPayloadBuilder=zr.ContractUpgradePayloadBuilder=zr.ContractDeployPayloadBuilder=zr.ArwenVirtualMachine=void 0;var oy=sc(),ay=Tr(),tR=jf();zr.ArwenVirtualMachine="0500";var iy=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`${e}@${zr.ArwenVirtualMachine}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractDeployPayloadBuilder=iy;var ny=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(){ay.guardValueIsSet("code",this.code);let e=this.code.toString(),t=this.codeMetadata.toString(),i=`upgradeContract@${e}@${t}`;return i=uy(i,this.arguments),new oy.TransactionPayload(i)}};zr.ContractUpgradePayloadBuilder=ny;var sy=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(){ay.guardValueIsSet("calledFunction",this.contractFunction);let e=this.contractFunction.name;return e=uy(e,this.arguments),new oy.TransactionPayload(e)}};zr.ContractCallPayloadBuilder=sy;function uy(r,e){let{argumentsString:t,count:i}=new tR.ArgSerializer().valuesToString(e);return i==0?r:`${r}@${t}`}});var sc=B(Gf=>{"use strict";f();Object.defineProperty(Gf,"__esModule",{value:!0});Gf.TransactionPayload=void 0;var ly=cy(),Ia=class{constructor(e){this.data=y.Buffer.from(e||[])}static fromEncoded(e){if(!e)return new Ia("");let t=y.Buffer.from(e,"base64").toString();return new Ia(t)}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=>y.Buffer.from(e,"hex"))}length(){return y.Buffer.from(this.data).length}static contractDeploy(){return new ly.ContractDeployPayloadBuilder}static contractUpgrade(){return new ly.ContractUpgradePayloadBuilder}static contractCall(){return new ly.ContractCallPayloadBuilder}};Gf.TransactionPayload=Ia});var $I=B(Sn=>{"use strict";f();Object.defineProperty(Sn,"__esModule",{value:!0});Sn.MultiESDTNFTTransferPayloadBuilder=Sn.ESDTNFTTransferPayloadBuilder=Sn.ESDTTransferPayloadBuilder=void 0;var kI=Gr(),py=jf(),kr=or(),WI=og(),gy=sc(),fy=class{constructor(){this.payment=WI.TokenPayment.fungibleFromAmount("","0",0)}setPayment(e){return this.payment=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.BigUIntValue(this.payment.valueOf())],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTTransfer@${t}`;return new gy.TransactionPayload(i)}};Sn.ESDTTransferPayloadBuilder=fy;var hy=class{constructor(){this.payment=WI.TokenPayment.nonFungible("",0),this.destination=new kI.Address("")}setPayment(e){return this.payment=e,this}setDestination(e){return this.destination=e,this}build(){let e=[kr.BytesValue.fromUTF8(this.payment.tokenIdentifier),new kr.U64Value(this.payment.nonce),new kr.BigUIntValue(this.payment.valueOf()),new kr.AddressValue(this.destination)],{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`ESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Sn.ESDTNFTTransferPayloadBuilder=hy;var dy=class{constructor(){this.payments=[],this.destination=new kI.Address("")}setPayments(e){return this.payments=e,this}setDestination(e){return this.destination=e,this}build(){let e=[new kr.AddressValue(this.destination),new kr.U16Value(this.payments.length)];for(let n of this.payments)e.push(kr.BytesValue.fromUTF8(n.tokenIdentifier),new kr.U64Value(n.nonce),new kr.BigUIntValue(n.valueOf()));let{argumentsString:t}=new py.ArgSerializer().valuesToString(e),i=`MultiESDTNFTTransfer@${t}`;return new gy.TransactionPayload(i)}};Sn.MultiESDTNFTTransferPayloadBuilder=dy});var zf=B(Kf=>{"use strict";f();Object.defineProperty(Kf,"__esModule",{value:!0});Kf.Account=void 0;var rR=Gr(),yy=class{constructor(e){this.address=new rR.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()}}};Kf.Account=yy});var YI=B(yi=>{"use strict";f();var iR=yi&&yi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),nR=yi&&yi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sR=yi&&yi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iR(e,r,t);return nR(e,r),e};Object.defineProperty(yi,"__esModule",{value:!0});yi.Hash=void 0;var oR=sR(Ye()),oc=class{constructor(e){if(!e)this.hash=y.Buffer.from([]);else if(e instanceof y.Buffer)this.hash=e;else if(typeof e=="string")this.hash=y.Buffer.from(e,"hex");else throw new oR.ErrBadType("hash","buffer | string",e)}static empty(){return new oc(y.Buffer.from([]))}isEmpty(){return this.hash.length==0}toString(){return this.hex()}hex(){return this.hash.toString("hex")}valueOf(){return this.hash}};yi.Hash=oc});var XI=B(Br=>{"use strict";f();var aR=Br&&Br.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),uR=Br&&Br.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),cR=Br&&Br.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&aR(e,r,t);return uR(e,r),e};Object.defineProperty(Br,"__esModule",{value:!0});Br.TransactionOptions=Br.TransactionVersion=void 0;var JI=cR(Ye()),kf=Wu(),_a=class{constructor(e){if(e=Number(e),e<1)throw new JI.ErrTransactionVersionInvalid(e);this.value=e}static withDefaultVersion(){return new _a(kf.TRANSACTION_VERSION_DEFAULT)}static withTxHashSignVersion(){return new _a(kf.TRANSACTION_VERSION_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionVersion=_a;var ba=class{constructor(e){if(e=Number(e),e<0)throw new JI.ErrTransactionOptionsInvalid(e);this.value=e}static withDefaultOptions(){return new ba(kf.TRANSACTION_OPTIONS_DEFAULT)}static withTxHashSignOptions(){return new ba(kf.TRANSACTION_OPTIONS_TX_HASH_SIGN)}valueOf(){return this.value}};Br.TransactionOptions=ba});var e_=B((qW,ZI)=>{"use strict";f();ZI.exports=lR;function lR(r,e){for(var t=new Array(arguments.length-1),i=0,n=2,s=!0;n{"use strict";f();var Wf=i_;Wf.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&e.charAt(t)==="=";)++i;return Math.ceil(e.length*3)/4-i};var Ca=new Array(64),r_=new Array(123);for(Wr=0;Wr<64;)r_[Ca[Wr]=Wr<26?Wr+65:Wr<52?Wr+71:Wr<62?Wr-4:Wr-59|43]=Wr++;var Wr;Wf.encode=function(e,t,i){for(var n=null,s=[],o=0,a=0,u;t>2],u=(h&3)<<4,a=1;break;case 1:s[o++]=Ca[u|h>>4],u=(h&15)<<2,a=2;break;case 2:s[o++]=Ca[u|h>>6],s[o++]=Ca[h&63],a=0;break}o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=Ca[u],s[o++]=61,a===1&&(s[o++]=61)),n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var t_="invalid encoding";Wf.decode=function(e,t,i){for(var n=i,s=0,o,a=0;a1)break;if((u=r_[u])===void 0)throw Error(t_);switch(s){case 0:o=u,s=1;break;case 1:t[i++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:t[i++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:t[i++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(t_);return i-n};Wf.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var o_=B((jW,s_)=>{"use strict";f();s_.exports=$f;function $f(){this._listeners={}}$f.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this};$f.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n{"use strict";f();h_.exports=a_(a_);function a_(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),i=t[3]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3]}function s(u,h,p){e[0]=u,h[p]=t[3],h[p+1]=t[2],h[p+2]=t[1],h[p+3]=t[0]}r.writeFloatLE=i?n:s,r.writeFloatBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],e[0]}function a(u,h){return t[3]=u[h],t[2]=u[h+1],t[1]=u[h+2],t[0]=u[h+3],e[0]}r.readFloatLE=i?o:a,r.readFloatBE=i?a:o}():function(){function e(i,n,s,o){var a=n<0?1:0;if(a&&(n=-n),n===0)i(1/n>0?0:2147483648,s,o);else if(isNaN(n))i(2143289344,s,o);else if(n>34028234663852886e22)i((a<<31|2139095040)>>>0,s,o);else if(n<11754943508222875e-54)i((a<<31|Math.round(n/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(n)/Math.LN2),h=Math.round(n*Math.pow(2,-u)*8388608)&8388607;i((a<<31|u+127<<23|h)>>>0,s,o)}}r.writeFloatLE=e.bind(null,u_),r.writeFloatBE=e.bind(null,c_);function t(i,n,s){var o=i(n,s),a=(o>>31)*2+1,u=o>>>23&255,h=o&8388607;return u===255?h?NaN:a*(1/0):u===0?a*1401298464324817e-60*h:a*Math.pow(2,u-150)*(h+8388608)}r.readFloatLE=t.bind(null,l_),r.readFloatBE=t.bind(null,f_)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),i=t[7]===128;function n(u,h,p){e[0]=u,h[p]=t[0],h[p+1]=t[1],h[p+2]=t[2],h[p+3]=t[3],h[p+4]=t[4],h[p+5]=t[5],h[p+6]=t[6],h[p+7]=t[7]}function s(u,h,p){e[0]=u,h[p]=t[7],h[p+1]=t[6],h[p+2]=t[5],h[p+3]=t[4],h[p+4]=t[3],h[p+5]=t[2],h[p+6]=t[1],h[p+7]=t[0]}r.writeDoubleLE=i?n:s,r.writeDoubleBE=i?s:n;function o(u,h){return t[0]=u[h],t[1]=u[h+1],t[2]=u[h+2],t[3]=u[h+3],t[4]=u[h+4],t[5]=u[h+5],t[6]=u[h+6],t[7]=u[h+7],e[0]}function a(u,h){return t[7]=u[h],t[6]=u[h+1],t[5]=u[h+2],t[4]=u[h+3],t[3]=u[h+4],t[2]=u[h+5],t[1]=u[h+6],t[0]=u[h+7],e[0]}r.readDoubleLE=i?o:a,r.readDoubleBE=i?a:o}():function(){function e(i,n,s,o,a,u){var h=o<0?1:0;if(h&&(o=-o),o===0)i(0,a,u+n),i(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))i(0,a,u+n),i(2146959360,a,u+s);else if(o>17976931348623157e292)i(0,a,u+n),i((h<<31|2146435072)>>>0,a,u+s);else{var p;if(o<22250738585072014e-324)p=o/5e-324,i(p>>>0,a,u+n),i((h<<31|p/4294967296)>>>0,a,u+s);else{var w=Math.floor(Math.log(o)/Math.LN2);w===1024&&(w=1023),p=o*Math.pow(2,-w),i(p*4503599627370496>>>0,a,u+n),i((h<<31|w+1023<<20|p*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=e.bind(null,u_,0,4),r.writeDoubleBE=e.bind(null,c_,4,0);function t(i,n,s,o,a){var u=i(o,a+n),h=i(o,a+s),p=(h>>31)*2+1,w=h>>>20&2047,N=4294967296*(h&1048575)+u;return w===2047?N?NaN:p*(1/0):w===0?p*5e-324*N:p*Math.pow(2,w-1075)*(N+4503599627370496)}r.readDoubleLE=t.bind(null,l_,0,4),r.readDoubleBE=t.bind(null,f_,4,0)}(),r}function u_(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function c_(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function l_(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function f_(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var p_=B((exports,module)=>{"use strict";f();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(r){}return null}});var y_=B(g_=>{"use strict";f();var my=g_;my.length=function(e){for(var t=0,i=0,n=0;n191&&u<224?o[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&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))};my.write=function(e,t,i){for(var n=i,s,o,a=0;a>6|192,t[i++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,t[i++]=s>>18|240,t[i++]=s>>12&63|128,t[i++]=s>>6&63|128,t[i++]=s&63|128):(t[i++]=s>>12|224,t[i++]=s>>6&63|128,t[i++]=s&63|128);return i-n}});var w_=B((YW,m_)=>{"use strict";f();m_.exports=fR;function fR(r,e,t){var i=t||8192,n=i>>>1,s=null,o=i;return function(u){if(u<1||u>n)return r(u);o+u>i&&(s=r(i),o=0);var h=e.call(s,o,o+=u);return o&7&&(o=(o|7)+1),h}}});var E_=B((XW,v_)=>{"use strict";f();v_.exports=zt;var ac=Tn();function zt(r,e){this.lo=r>>>0,this.hi=e>>>0}var Qs=zt.zero=new zt(0,0);Qs.toNumber=function(){return 0};Qs.zzEncode=Qs.zzDecode=function(){return this};Qs.length=function(){return 1};var hR=zt.zeroHash="\0\0\0\0\0\0\0\0";zt.fromNumber=function(e){if(e===0)return Qs;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new zt(i,n)};zt.from=function(e){if(typeof e=="number")return zt.fromNumber(e);if(ac.isString(e))if(ac.Long)e=ac.Long.fromString(e);else return zt.fromNumber(parseInt(e,10));return e.low||e.high?new zt(e.low>>>0,e.high>>>0):Qs};zt.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+i*4294967296)}return this.lo+this.hi*4294967296};zt.prototype.toLong=function(e){return ac.Long?new ac.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var xn=String.prototype.charCodeAt;zt.fromHash=function(e){return e===hR?Qs:new zt((xn.call(e,0)|xn.call(e,1)<<8|xn.call(e,2)<<16|xn.call(e,3)<<24)>>>0,(xn.call(e,4)|xn.call(e,5)<<8|xn.call(e,6)<<16|xn.call(e,7)<<24)>>>0)};zt.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)};zt.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};zt.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};zt.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}});var Tn=B(wy=>{"use strict";f();var we=wy;we.asPromise=e_();we.base64=n_();we.EventEmitter=o_();we.float=d_();we.inquire=p_();we.utf8=y_();we.pool=w_();we.LongBits=E_();we.isNode=Boolean(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);we.global=we.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||wy;we.emptyArray=Object.freeze?Object.freeze([]):[];we.emptyObject=Object.freeze?Object.freeze({}):{};we.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};we.isString=function(e){return typeof e=="string"||e instanceof String};we.isObject=function(e){return e&&typeof e=="object"};we.isset=we.isSet=function(e,t){var i=e[t];return i!=null&&e.hasOwnProperty(t)?typeof i!="object"||(Array.isArray(i)?i.length:Object.keys(i).length)>0:!1};we.Buffer=function(){try{var r=we.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();we._Buffer_from=null;we._Buffer_allocUnsafe=null;we.newBuffer=function(e){return typeof e=="number"?we.Buffer?we._Buffer_allocUnsafe(e):new we.Array(e):we.Buffer?we._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};we.Array=typeof Uint8Array<"u"?Uint8Array:Array;we.Long=we.global.dcodeIO&&we.global.dcodeIO.Long||we.global.Long||we.inquire("long");we.key2Re=/^true|false|0|1$/;we.key32Re=/^-?(?:0|[1-9][0-9]*)$/;we.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;we.longToHash=function(e){return e?we.LongBits.from(e).toHash():we.LongBits.zeroHash};we.longFromHash=function(e,t){var i=we.LongBits.fromHash(e);return we.Long?we.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))};function A_(r,e,t){for(var i=Object.keys(e),n=0;n-1;--s)if(t[n[s]]===1&&this[n[s]]!==void 0&&this[n[s]]!==null)return n[s]}};we.oneOfSetter=function(e){return function(t){for(var i=0;i{"use strict";f();S_.exports=qe;var Mr=Tn(),vy,Yf=Mr.LongBits,__=Mr.base64,b_=Mr.utf8;function uc(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function Ay(){}function dR(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function qe(){this.len=0,this.head=new uc(Ay,0,0),this.tail=this.head,this.states=null}var C_=function(){return Mr.Buffer?function(){return(qe.create=function(){return new vy})()}:function(){return new qe}};qe.create=C_();qe.alloc=function(e){return new Mr.Array(e)};Mr.Array!==Array&&(qe.alloc=Mr.pool(qe.alloc,Mr.Array.prototype.subarray));qe.prototype._push=function(e,t,i){return this.tail=this.tail.next=new uc(e,t,i),this.len+=t,this};function Iy(r,e,t){e[t]=r&255}function pR(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function _y(r,e){this.len=r,this.next=void 0,this.val=e}_y.prototype=Object.create(uc.prototype);_y.prototype.fn=pR;qe.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new _y((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};qe.prototype.int32=function(e){return e<0?this._push(by,10,Yf.fromNumber(e)):this.uint32(e)};qe.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function by(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}qe.prototype.uint64=function(e){var t=Yf.from(e);return this._push(by,t.length(),t)};qe.prototype.int64=qe.prototype.uint64;qe.prototype.sint64=function(e){var t=Yf.from(e).zzEncode();return this._push(by,t.length(),t)};qe.prototype.bool=function(e){return this._push(Iy,1,e?1:0)};function Ey(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}qe.prototype.fixed32=function(e){return this._push(Ey,4,e>>>0)};qe.prototype.sfixed32=qe.prototype.fixed32;qe.prototype.fixed64=function(e){var t=Yf.from(e);return this._push(Ey,4,t.lo)._push(Ey,4,t.hi)};qe.prototype.sfixed64=qe.prototype.fixed64;qe.prototype.float=function(e){return this._push(Mr.float.writeFloatLE,4,e)};qe.prototype.double=function(e){return this._push(Mr.float.writeDoubleLE,8,e)};var gR=Mr.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n>>0;if(!t)return this._push(Iy,1,0);if(Mr.isString(e)){var i=qe.alloc(t=__.length(e));__.decode(e,i,0),e=i}return this.uint32(t)._push(gR,t,e)};qe.prototype.string=function(e){var t=b_.length(e);return t?this.uint32(t)._push(b_.write,t,e):this._push(Iy,1,0)};qe.prototype.fork=function(){return this.states=new dR(this),this.head=this.tail=new uc(Ay,0,0),this.len=0,this};qe.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 uc(Ay,0,0),this.len=0),this};qe.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this};qe.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t};qe._configure=function(r){vy=r,qe.create=C_(),vy._configure()}});var N_=B((n$,T_)=>{"use strict";f();T_.exports=mi;var x_=Cy();(mi.prototype=Object.create(x_.prototype)).constructor=mi;var Nn=Tn();function mi(){x_.call(this)}mi._configure=function(){mi.alloc=Nn._Buffer_allocUnsafe,mi.writeBytesBuffer=Nn.Buffer&&Nn.Buffer.prototype instanceof Uint8Array&&Nn.Buffer.prototype.set.name==="set"?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(mi.writeBytesBuffer,t,e),this};function yR(r,e,t){r.length<40?Nn.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}mi.prototype.string=function(e){var t=Nn.Buffer.byteLength(e);return this.uint32(t),t&&this._push(yR,t,e),this};mi._configure()});var Ty=B((o$,M_)=>{"use strict";f();M_.exports=gt;var wi=Tn(),xy,P_=wi.LongBits,mR=wi.utf8;function $r(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function gt(r){this.buf=r,this.pos=0,this.len=r.length}var D_=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new gt(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new gt(e);throw Error("illegal buffer")},B_=function(){return wi.Buffer?function(t){return(gt.create=function(n){return wi.Buffer.isBuffer(n)?new xy(n):D_(n)})(t)}:D_};gt.create=B_();gt.prototype._slice=wi.Array.prototype.subarray||wi.Array.prototype.slice;gt.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}}();gt.prototype.int32=function(){return this.uint32()|0};gt.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Sy(){var r=new P_(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw $r(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw $r(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}gt.prototype.bool=function(){return this.uint32()!==0};function Jf(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}gt.prototype.fixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)};gt.prototype.sfixed32=function(){if(this.pos+4>this.len)throw $r(this,4);return Jf(this.buf,this.pos+=4)|0};function O_(){if(this.pos+8>this.len)throw $r(this,8);return new P_(Jf(this.buf,this.pos+=4),Jf(this.buf,this.pos+=4))}gt.prototype.float=function(){if(this.pos+4>this.len)throw $r(this,4);var e=wi.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};gt.prototype.double=function(){if(this.pos+8>this.len)throw $r(this,4);var e=wi.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};gt.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw $r(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)};gt.prototype.string=function(){var e=this.bytes();return mR.read(e,0,e.length)};gt.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};gt.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};gt._configure=function(r){xy=r,gt.create=B_(),xy._configure();var e=wi.Long?"toLong":"toNumber";wi.merge(gt.prototype,{int64:function(){return Sy.call(this)[e](!1)},uint64:function(){return Sy.call(this)[e](!0)},sint64:function(){return Sy.call(this).zzDecode()[e](!1)},fixed64:function(){return O_.call(this)[e](!0)},sfixed64:function(){return O_.call(this)[e](!1)}})}});var U_=B((u$,F_)=>{"use strict";f();F_.exports=js;var L_=Ty();(js.prototype=Object.create(L_.prototype)).constructor=js;var R_=Tn();function js(r){L_.call(this,r)}js._configure=function(){R_.Buffer&&(js.prototype._slice=R_.Buffer.prototype.slice)};js.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))};js._configure()});var V_=B((l$,q_)=>{"use strict";f();q_.exports=cc;var Ny=Tn();(cc.prototype=Object.create(Ny.EventEmitter.prototype)).constructor=cc;function cc(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Ny.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}cc.prototype.rpcCall=function r(e,t,i,n,s){if(!n)throw TypeError("request must be specified");var o=this;if(!s)return Ny.asPromise(r,o,e,t,i,n);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,t[o.requestDelimited?"encodeDelimited":"encode"](n).finish(),function(u,h){if(u)return o.emit("error",u,e),s(u);if(h===null){o.end(!0);return}if(!(h instanceof i))try{h=i[o.responseDelimited?"decodeDelimited":"decode"](h)}catch(p){return o.emit("error",p,e),s(p)}return o.emit("data",h,e),s(null,h)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};cc.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Q_=B(H_=>{"use strict";f();var wR=H_;wR.Service=V_()});var G_=B((p$,j_)=>{"use strict";f();j_.exports={}});var k_=B(z_=>{"use strict";f();var yr=z_;yr.build="minimal";yr.Writer=Cy();yr.BufferWriter=N_();yr.Reader=Ty();yr.BufferReader=U_();yr.util=Tn();yr.rpc=Q_();yr.roots=G_();yr.configure=K_;function K_(){yr.util._configure(),yr.Writer._configure(yr.BufferWriter),yr.Reader._configure(yr.BufferReader)}K_()});var $_=B((w$,W_)=>{"use strict";f();W_.exports=k_()});var J_=B((E$,Y_)=>{"use strict";f();var Sa=$_(),Xf=Sa.Reader,vR=Sa.Writer,le=Sa.util,lc=Sa.roots.default||(Sa.roots.default={});lc.proto=function(){var r={};return r.Transaction=function(){function e(t){if(t)for(var i=Object.keys(t),n=0;n>>3){case 1:o.Nonce=i.uint64();break;case 2:o.Value=i.bytes();break;case 3:o.RcvAddr=i.bytes();break;case 4:o.RcvUserName=i.bytes();break;case 5:o.SndAddr=i.bytes();break;case 6:o.SndUserName=i.bytes();break;case 7:o.GasPrice=i.uint64();break;case 8:o.GasLimit=i.uint64();break;case 9:o.Data=i.bytes();break;case 10:o.ChainID=i.bytes();break;case 11:o.Version=i.uint32();break;case 12:o.Signature=i.bytes();break;case 13:o.Options=i.uint32();break;default:i.skipType(a&7);break}}return o},e.decodeDelimited=function(i){return i instanceof Xf||(i=new Xf(i)),this.decode(i,i.uint32())},e.verify=function(i){return typeof i!="object"||i===null?"object expected":i.Nonce!=null&&i.hasOwnProperty("Nonce")&&!le.isInteger(i.Nonce)&&!(i.Nonce&&le.isInteger(i.Nonce.low)&&le.isInteger(i.Nonce.high))?"Nonce: integer|Long expected":i.Value!=null&&i.hasOwnProperty("Value")&&!(i.Value&&typeof i.Value.length=="number"||le.isString(i.Value))?"Value: buffer expected":i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&!(i.RcvAddr&&typeof i.RcvAddr.length=="number"||le.isString(i.RcvAddr))?"RcvAddr: buffer expected":i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&!(i.RcvUserName&&typeof i.RcvUserName.length=="number"||le.isString(i.RcvUserName))?"RcvUserName: buffer expected":i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&!(i.SndAddr&&typeof i.SndAddr.length=="number"||le.isString(i.SndAddr))?"SndAddr: buffer expected":i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&!(i.SndUserName&&typeof i.SndUserName.length=="number"||le.isString(i.SndUserName))?"SndUserName: buffer expected":i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&!le.isInteger(i.GasPrice)&&!(i.GasPrice&&le.isInteger(i.GasPrice.low)&&le.isInteger(i.GasPrice.high))?"GasPrice: integer|Long expected":i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&!le.isInteger(i.GasLimit)&&!(i.GasLimit&&le.isInteger(i.GasLimit.low)&&le.isInteger(i.GasLimit.high))?"GasLimit: integer|Long expected":i.Data!=null&&i.hasOwnProperty("Data")&&!(i.Data&&typeof i.Data.length=="number"||le.isString(i.Data))?"Data: buffer expected":i.ChainID!=null&&i.hasOwnProperty("ChainID")&&!(i.ChainID&&typeof i.ChainID.length=="number"||le.isString(i.ChainID))?"ChainID: buffer expected":i.Version!=null&&i.hasOwnProperty("Version")&&!le.isInteger(i.Version)?"Version: integer expected":i.Signature!=null&&i.hasOwnProperty("Signature")&&!(i.Signature&&typeof i.Signature.length=="number"||le.isString(i.Signature))?"Signature: buffer expected":i.Options!=null&&i.hasOwnProperty("Options")&&!le.isInteger(i.Options)?"Options: integer expected":null},e.fromObject=function(i){if(i instanceof lc.proto.Transaction)return i;var n=new lc.proto.Transaction;return i.Nonce!=null&&(le.Long?(n.Nonce=le.Long.fromValue(i.Nonce)).unsigned=!0:typeof i.Nonce=="string"?n.Nonce=parseInt(i.Nonce,10):typeof i.Nonce=="number"?n.Nonce=i.Nonce:typeof i.Nonce=="object"&&(n.Nonce=new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0))),i.Value!=null&&(typeof i.Value=="string"?le.base64.decode(i.Value,n.Value=le.newBuffer(le.base64.length(i.Value)),0):i.Value.length&&(n.Value=i.Value)),i.RcvAddr!=null&&(typeof i.RcvAddr=="string"?le.base64.decode(i.RcvAddr,n.RcvAddr=le.newBuffer(le.base64.length(i.RcvAddr)),0):i.RcvAddr.length&&(n.RcvAddr=i.RcvAddr)),i.RcvUserName!=null&&(typeof i.RcvUserName=="string"?le.base64.decode(i.RcvUserName,n.RcvUserName=le.newBuffer(le.base64.length(i.RcvUserName)),0):i.RcvUserName.length&&(n.RcvUserName=i.RcvUserName)),i.SndAddr!=null&&(typeof i.SndAddr=="string"?le.base64.decode(i.SndAddr,n.SndAddr=le.newBuffer(le.base64.length(i.SndAddr)),0):i.SndAddr.length&&(n.SndAddr=i.SndAddr)),i.SndUserName!=null&&(typeof i.SndUserName=="string"?le.base64.decode(i.SndUserName,n.SndUserName=le.newBuffer(le.base64.length(i.SndUserName)),0):i.SndUserName.length&&(n.SndUserName=i.SndUserName)),i.GasPrice!=null&&(le.Long?(n.GasPrice=le.Long.fromValue(i.GasPrice)).unsigned=!0:typeof i.GasPrice=="string"?n.GasPrice=parseInt(i.GasPrice,10):typeof i.GasPrice=="number"?n.GasPrice=i.GasPrice:typeof i.GasPrice=="object"&&(n.GasPrice=new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0))),i.GasLimit!=null&&(le.Long?(n.GasLimit=le.Long.fromValue(i.GasLimit)).unsigned=!0:typeof i.GasLimit=="string"?n.GasLimit=parseInt(i.GasLimit,10):typeof i.GasLimit=="number"?n.GasLimit=i.GasLimit:typeof i.GasLimit=="object"&&(n.GasLimit=new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0))),i.Data!=null&&(typeof i.Data=="string"?le.base64.decode(i.Data,n.Data=le.newBuffer(le.base64.length(i.Data)),0):i.Data.length&&(n.Data=i.Data)),i.ChainID!=null&&(typeof i.ChainID=="string"?le.base64.decode(i.ChainID,n.ChainID=le.newBuffer(le.base64.length(i.ChainID)),0):i.ChainID.length&&(n.ChainID=i.ChainID)),i.Version!=null&&(n.Version=i.Version>>>0),i.Signature!=null&&(typeof i.Signature=="string"?le.base64.decode(i.Signature,n.Signature=le.newBuffer(le.base64.length(i.Signature)),0):i.Signature.length&&(n.Signature=i.Signature)),i.Options!=null&&(n.Options=i.Options>>>0),n},e.toObject=function(i,n){n||(n={});var s={};if(n.defaults){if(le.Long){var o=new le.Long(0,0,!0);s.Nonce=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.Nonce=n.longs===String?"0":0;if(n.bytes===String?s.Value="":(s.Value=[],n.bytes!==Array&&(s.Value=le.newBuffer(s.Value))),n.bytes===String?s.RcvAddr="":(s.RcvAddr=[],n.bytes!==Array&&(s.RcvAddr=le.newBuffer(s.RcvAddr))),n.bytes===String?s.RcvUserName="":(s.RcvUserName=[],n.bytes!==Array&&(s.RcvUserName=le.newBuffer(s.RcvUserName))),n.bytes===String?s.SndAddr="":(s.SndAddr=[],n.bytes!==Array&&(s.SndAddr=le.newBuffer(s.SndAddr))),n.bytes===String?s.SndUserName="":(s.SndUserName=[],n.bytes!==Array&&(s.SndUserName=le.newBuffer(s.SndUserName))),le.Long){var o=new le.Long(0,0,!0);s.GasPrice=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasPrice=n.longs===String?"0":0;if(le.Long){var o=new le.Long(0,0,!0);s.GasLimit=n.longs===String?o.toString():n.longs===Number?o.toNumber():o}else s.GasLimit=n.longs===String?"0":0;n.bytes===String?s.Data="":(s.Data=[],n.bytes!==Array&&(s.Data=le.newBuffer(s.Data))),n.bytes===String?s.ChainID="":(s.ChainID=[],n.bytes!==Array&&(s.ChainID=le.newBuffer(s.ChainID))),s.Version=0,n.bytes===String?s.Signature="":(s.Signature=[],n.bytes!==Array&&(s.Signature=le.newBuffer(s.Signature))),s.Options=0}return i.Nonce!=null&&i.hasOwnProperty("Nonce")&&(typeof i.Nonce=="number"?s.Nonce=n.longs===String?String(i.Nonce):i.Nonce:s.Nonce=n.longs===String?le.Long.prototype.toString.call(i.Nonce):n.longs===Number?new le.LongBits(i.Nonce.low>>>0,i.Nonce.high>>>0).toNumber(!0):i.Nonce),i.Value!=null&&i.hasOwnProperty("Value")&&(s.Value=n.bytes===String?le.base64.encode(i.Value,0,i.Value.length):n.bytes===Array?Array.prototype.slice.call(i.Value):i.Value),i.RcvAddr!=null&&i.hasOwnProperty("RcvAddr")&&(s.RcvAddr=n.bytes===String?le.base64.encode(i.RcvAddr,0,i.RcvAddr.length):n.bytes===Array?Array.prototype.slice.call(i.RcvAddr):i.RcvAddr),i.RcvUserName!=null&&i.hasOwnProperty("RcvUserName")&&(s.RcvUserName=n.bytes===String?le.base64.encode(i.RcvUserName,0,i.RcvUserName.length):n.bytes===Array?Array.prototype.slice.call(i.RcvUserName):i.RcvUserName),i.SndAddr!=null&&i.hasOwnProperty("SndAddr")&&(s.SndAddr=n.bytes===String?le.base64.encode(i.SndAddr,0,i.SndAddr.length):n.bytes===Array?Array.prototype.slice.call(i.SndAddr):i.SndAddr),i.SndUserName!=null&&i.hasOwnProperty("SndUserName")&&(s.SndUserName=n.bytes===String?le.base64.encode(i.SndUserName,0,i.SndUserName.length):n.bytes===Array?Array.prototype.slice.call(i.SndUserName):i.SndUserName),i.GasPrice!=null&&i.hasOwnProperty("GasPrice")&&(typeof i.GasPrice=="number"?s.GasPrice=n.longs===String?String(i.GasPrice):i.GasPrice:s.GasPrice=n.longs===String?le.Long.prototype.toString.call(i.GasPrice):n.longs===Number?new le.LongBits(i.GasPrice.low>>>0,i.GasPrice.high>>>0).toNumber(!0):i.GasPrice),i.GasLimit!=null&&i.hasOwnProperty("GasLimit")&&(typeof i.GasLimit=="number"?s.GasLimit=n.longs===String?String(i.GasLimit):i.GasLimit:s.GasLimit=n.longs===String?le.Long.prototype.toString.call(i.GasLimit):n.longs===Number?new le.LongBits(i.GasLimit.low>>>0,i.GasLimit.high>>>0).toNumber(!0):i.GasLimit),i.Data!=null&&i.hasOwnProperty("Data")&&(s.Data=n.bytes===String?le.base64.encode(i.Data,0,i.Data.length):n.bytes===Array?Array.prototype.slice.call(i.Data):i.Data),i.ChainID!=null&&i.hasOwnProperty("ChainID")&&(s.ChainID=n.bytes===String?le.base64.encode(i.ChainID,0,i.ChainID.length):n.bytes===Array?Array.prototype.slice.call(i.ChainID):i.ChainID),i.Version!=null&&i.hasOwnProperty("Version")&&(s.Version=i.Version),i.Signature!=null&&i.hasOwnProperty("Signature")&&(s.Signature=n.bytes===String?le.base64.encode(i.Signature,0,i.Signature.length):n.bytes===Array?Array.prototype.slice.call(i.Signature):i.Signature),i.Options!=null&&i.hasOwnProperty("Options")&&(s.Options=i.Options),s},e.prototype.toJSON=function(){return this.constructor.toObject(this,Sa.util.toJSONOptions)},e}(),r}();Y_.exports=lc});var eb=B(Rr=>{"use strict";f();var ER=Rr&&Rr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),AR=Rr&&Rr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),IR=Rr&&Rr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ER(e,r,t);return AR(e,r),e},_R=Rr&&Rr.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.ProtoSerializer=void 0;var bR=_R(jr()),X_=Gr(),CR=Wu(),SR=IR(Ye()),xR=Mg(),Z_=J_(),Dy=class{serializeTransaction(e){let t=new X_.Address(e.getReceiver().bech32()).pubkey(),i=new X_.Address(e.getSender().bech32()).pubkey(),n=new Z_.proto.Transaction({Nonce:e.getNonce().valueOf()?e.getNonce().valueOf():void 0,Value:this.serializeTransactionValue(e.getValue()),RcvAddr:t,RcvUserName:null,SndAddr:i,SndUserName:null,GasPrice:e.getGasPrice().valueOf(),GasLimit:e.getGasLimit().valueOf(),Data:e.getData().length()==0?null:e.getData().valueOf(),ChainID:y.Buffer.from(e.getChainID().valueOf()),Version:e.getVersion().valueOf(),Signature:y.Buffer.from(e.getSignature().hex(),"hex")});e.getOptions().valueOf()!==CR.TRANSACTION_OPTIONS_DEFAULT&&(n.Options=e.getOptions().valueOf());let s=Z_.proto.Transaction.encode(n).finish();return y.Buffer.from(s)}serializeTransactionValue(e){let t=new bR.default(e.toString());if(t.isZero())return y.Buffer.from([0,0]);let i=xR.bigIntToBuffer(t);return i=y.Buffer.concat([y.Buffer.from([0]),i]),i}deserializeTransaction(e){throw new SR.ErrUnsupportedOperation("deserializeTransaction")}};Rr.ProtoSerializer=Dy});var tb=B(Gs=>{"use strict";f();var TR=Gs&&Gs.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),NR=Gs&&Gs.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&TR(e,r,t)};Object.defineProperty(Gs,"__esModule",{value:!0});NR(eb(),Gs)});var nb=B(vi=>{"use strict";f();var DR=vi&&vi.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),OR=vi&&vi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),PR=vi&&vi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&DR(e,r,t);return OR(e,r),e};Object.defineProperty(vi,"__esModule",{value:!0});vi.Signature=void 0;var rb=PR(Ye()),ib=64,Yr=class{constructor(e){if(this.valueHex="",!!e){if(typeof e=="string")return Yr.fromHex(e);if(e instanceof y.Buffer)return Yr.fromBuffer(e)}}static empty(){return new Yr}static fromHex(e){if(e.startsWith("0x")&&(e=e.slice(2)),!Yr.isValidHex(e))throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e)}static isValidHex(e){return y.Buffer.from(e,"hex").length==ib}static fromValidHex(e){let t=new Yr;return t.valueHex=e,t}static fromBuffer(e){if(e.length!=ib)throw new rb.ErrSignatureCannotCreate(e);return Yr.fromValidHex(e.toString("hex"))}hex(){return this.valueHex}};vi.Signature=Yr});var Oy=B((T$,sb)=>{f();Yi.notEqual=MR;Yi.notOk=RR;Yi.equal=BR;Yi.ok=Yi;sb.exports=Yi;function BR(r,e,t){Yi(r==e,t)}function MR(r,e,t){Yi(r!=e,t)}function RR(r,e){Yi(!r,e)}function Yi(r,e){if(!r)throw new Error(e||"AssertionError")}});var Ib=B(Da=>{"use strict";f();var Py=y0(),Ta=w0(),ob=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Da.Buffer=ne;Da.SlowBuffer=HR;Da.INSPECT_MAX_BYTES=50;var Zf=2147483647;Da.kMaxLength=Zf;ne.TYPED_ARRAY_SUPPORT=LR();!ne.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 LR(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(ne.prototype,"parent",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.buffer}});Object.defineProperty(ne.prototype,"offset",{enumerable:!0,get:function(){if(ne.isBuffer(this))return this.byteOffset}});function Ji(r){if(r>Zf)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,ne.prototype),e}function ne(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ly(r)}return lb(r,e,t)}ne.poolSize=8192;function lb(r,e,t){if(typeof r=="string")return UR(r,e);if(ArrayBuffer.isView(r))return qR(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Ei(r,ArrayBuffer)||r&&Ei(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ei(r,SharedArrayBuffer)||r&&Ei(r.buffer,SharedArrayBuffer)))return My(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return ne.from(i,e,t);let n=VR(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return ne.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}ne.from=function(r,e,t){return lb(r,e,t)};Object.setPrototypeOf(ne.prototype,Uint8Array.prototype);Object.setPrototypeOf(ne,Uint8Array);function fb(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function FR(r,e,t){return fb(r),r<=0?Ji(r):e!==void 0?typeof t=="string"?Ji(r).fill(e,t):Ji(r).fill(e):Ji(r)}ne.alloc=function(r,e,t){return FR(r,e,t)};function Ly(r){return fb(r),Ji(r<0?0:Fy(r)|0)}ne.allocUnsafe=function(r){return Ly(r)};ne.allocUnsafeSlow=function(r){return Ly(r)};function UR(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!ne.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=hb(r,e)|0,i=Ji(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function By(r){let e=r.length<0?0:Fy(r.length)|0,t=Ji(e);for(let i=0;i=Zf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zf.toString(16)+" bytes");return r|0}function HR(r){return+r!=r&&(r=0),ne.alloc(+r)}ne.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==ne.prototype};ne.compare=function(e,t){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),Ei(t,Uint8Array)&&(t=ne.from(t,t.offset,t.byteLength)),!ne.isBuffer(e)||!ne.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let s=0,o=Math.min(i,n);sn.length?(ne.isBuffer(o)||(o=ne.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(ne.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function hb(r,e){if(ne.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Ei(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Ry(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Ab(r).length;default:if(n)return i?-1:Ry(r).length;e=(""+e).toLowerCase(),n=!0}}ne.byteLength=hb;function QR(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return XR(this,e,t);case"utf8":case"utf-8":return pb(this,e,t);case"ascii":return YR(this,e,t);case"latin1":case"binary":return JR(this,e,t);case"base64":return WR(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZR(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}ne.prototype._isBuffer=!0;function Ks(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}ne.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 t=0;tt&&(e+=" ... "),""};ob&&(ne.prototype[ob]=ne.prototype.inspect);ne.prototype.compare=function(e,t,i,n,s){if(Ei(e,Uint8Array)&&(e=ne.from(e,e.offset,e.byteLength)),!ne.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),t<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=i)return 0;if(n>=s)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-t,u=Math.min(o,a),h=this.slice(n,s),p=e.slice(t,i);for(let w=0;w2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,qy(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=ne.from(e,i)),ne.isBuffer(e))return e.length===0?-1:ab(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):ab(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function ab(r,e,t,i,n){let s=1,o=r.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function u(p,w){return s===1?p[w]:p.readUInt16BE(w*s)}let h;if(n){let p=-1;for(h=t;ho&&(t=o-a),h=t;h>=0;h--){let p=!0;for(let w=0;wn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return jR(this,e,t,i);case"utf8":case"utf-8":return GR(this,e,t,i);case"ascii":case"latin1":case"binary":return KR(this,e,t,i);case"base64":return zR(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kR(this,e,t,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};ne.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function WR(r,e,t){return e===0&&t===r.length?Py.fromByteArray(r):Py.fromByteArray(r.slice(e,t))}function pb(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+a<=t){let u,h,p,w;switch(a){case 1:s<128&&(o=s);break;case 2:u=r[n+1],(u&192)===128&&(w=(s&31)<<6|u&63,w>127&&(o=w));break;case 3:u=r[n+1],h=r[n+2],(u&192)===128&&(h&192)===128&&(w=(s&15)<<12|(u&63)<<6|h&63,w>2047&&(w<55296||w>57343)&&(o=w));break;case 4:u=r[n+1],h=r[n+2],p=r[n+3],(u&192)===128&&(h&192)===128&&(p&192)===128&&(w=(s&15)<<18|(u&63)<<12|(h&63)<<6|p&63,w>65535&&w<1114112&&(o=w))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return $R(i)}var ub=4096;function $R(r){let e=r.length;if(e<=ub)return String.fromCharCode.apply(String,r);let t="",i=0;for(;ii)&&(t=i);let n="";for(let s=e;si&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),tt)throw new RangeError("Trying to access beyond buffer length")}ne.prototype.readUintLE=ne.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e+--t],s=1;for(;t>0&&(s*=256);)n+=this[e+--t]*s;return n};ne.prototype.readUint8=ne.prototype.readUInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]};ne.prototype.readUint16LE=ne.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]|this[e+1]<<8};ne.prototype.readUint16BE=ne.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||kt(e,2,this.length),this[e]<<8|this[e+1]};ne.prototype.readUint32LE=ne.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};ne.prototype.readUint32BE=ne.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};ne.prototype.readBigUInt64LE=Dn(function(e){e=e>>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=t*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+i;return(BigInt(n)<>>0,t=t>>>0,i||kt(e,t,this.length);let n=this[e],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*t)),n};ne.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||kt(e,t,this.length);let n=t,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};ne.prototype.readInt8=function(e,t){return e=e>>>0,t||kt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};ne.prototype.readInt16LE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt16BE=function(e,t){e=e>>>0,t||kt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};ne.prototype.readInt32LE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};ne.prototype.readInt32BE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};ne.prototype.readBigInt64LE=Dn(function(e){e=e>>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Na(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&fc(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,t||kt(e,4,this.length),Ta.read(this,e,!0,23,4)};ne.prototype.readFloatBE=function(e,t){return e=e>>>0,t||kt(e,4,this.length),Ta.read(this,e,!1,23,4)};ne.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),Ta.read(this,e,!0,52,8)};ne.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||kt(e,8,this.length),Ta.read(this,e,!1,52,8)};function mr(r,e,t,i,n,s){if(!ne.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||er.length)throw new RangeError("Index out of range")}ne.prototype.writeUintLE=ne.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;mr(this,e,t,i,a,0)}let s=i-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+i};ne.prototype.writeUint8=ne.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,255,0),this[t]=e&255,t+1};ne.prototype.writeUint16LE=ne.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeUint16BE=ne.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeUint32LE=ne.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};ne.prototype.writeUint32BE=ne.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function gb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function yb(r,e,t,i,n){Eb(e,i,n,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}ne.prototype.writeBigUInt64LE=Dn(function(e,t=0){return gb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeBigUInt64BE=Dn(function(e,t=0){return yb(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});ne.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=0,o=1,a=0;for(this[t]=e&255;++s>0)-a&255;return t+i};ne.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let u=Math.pow(2,8*i-1);mr(this,e,t,i,u-1,-u)}let s=i-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i};ne.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};ne.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};ne.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};ne.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};ne.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||mr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};ne.prototype.writeBigInt64LE=Dn(function(e,t=0){return gb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});ne.prototype.writeBigInt64BE=Dn(function(e,t=0){return yb(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function mb(r,e,t,i,n,s){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function wb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,4,34028234663852886e22,-34028234663852886e22),Ta.write(r,e,t,i,23,4),t+4}ne.prototype.writeFloatLE=function(e,t,i){return wb(this,e,t,!0,i)};ne.prototype.writeFloatBE=function(e,t,i){return wb(this,e,t,!1,i)};function vb(r,e,t,i,n){return e=+e,t=t>>>0,n||mb(r,e,t,8,17976931348623157e292,-17976931348623157e292),Ta.write(r,e,t,i,52,8),t+8}ne.prototype.writeDoubleLE=function(e,t,i){return vb(this,e,t,!0,i)};ne.prototype.writeDoubleBE=function(e,t,i){return vb(this,e,t,!1,i)};ne.prototype.copy=function(e,t,i,n){if(!ne.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s2**32?n=cb(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=cb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function cb(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function eL(r,e,t){Na(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&fc(e,r.length-(t+1))}function Eb(r,e,t,i,n,s){if(r>t||r3?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 <= ${t}${o}`,new xa.ERR_OUT_OF_RANGE("value",a,r)}eL(i,n,s)}function Na(r,e){if(typeof r!="number")throw new xa.ERR_INVALID_ARG_TYPE(e,"number",r)}function fc(r,e,t){throw Math.floor(r)!==r?(Na(r,t),new xa.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new xa.ERR_BUFFER_OUT_OF_BOUNDS:new xa.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var tL=/[^+/0-9A-Za-z-_]/g;function rL(r){if(r=r.split("=")[0],r=r.trim().replace(tL,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Ry(r,e){e=e||1/0;let t,i=r.length,n=null,s=[];for(let o=0;o55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function iL(r){let e=[];for(let t=0;t>8,n=t%256,s.push(n),s.push(i);return s}function Ab(r){return Py.toByteArray(rL(r))}function eh(r,e,t,i){let n;for(n=0;n=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function Ei(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function qy(r){return r!==r}var sL=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function Dn(r){return typeof BigInt>"u"?oL:r}function oL(){throw new Error("BigInt not supported")}});var bb=B((B$,_b)=>{f();_b.exports=Vy;Vy.supported=typeof WebAssembly<"u";function Vy(r){if(!Vy.supported)return null;var e=r&&r.imports,t=aL("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"),i=null,n={buffer:t,memory:null,exports:null,realloc:s,onload:o};return o(function(){}),n;function s(u){n.exports.memory.grow(Math.ceil(Math.abs(u-n.memory.length)/65536)),n.memory=new Uint8Array(n.exports.memory.buffer)}function o(u){if(n.exports)return u();if(i){i.then(u.bind(null,null)).catch(u);return}try{if(r&&r.async)throw new Error("async");a({instance:new WebAssembly.Instance(new WebAssembly.Module(t),e)})}catch{i=WebAssembly.instantiate(t,e).then(a)}o(u)}function a(u){n.exports=u.instance.exports,n.memory=n.exports.memory&&n.exports.memory.buffer&&new Uint8Array(n.exports.memory.buffer)}}function aL(r){return typeof atob=="function"?new Uint8Array(atob(r).split("").map(uL)):new(Ib()).Buffer(r,"base64")}function uL(r){return r.charCodeAt(0)}});var Ob=B((F$,Ii)=>{f();var Ai=Oy(),ke=bb()(),Xi=64,th=[];Ii.exports=Lr;var Cb=Ii.exports.BYTES_MIN=16,Sb=Ii.exports.BYTES_MAX=64,R$=Ii.exports.BYTES=32,xb=Ii.exports.KEYBYTES_MIN=16,Tb=Ii.exports.KEYBYTES_MAX=64,L$=Ii.exports.KEYBYTES=32,Nb=Ii.exports.SALTBYTES=16,Db=Ii.exports.PERSONALBYTES=16;function Lr(r,e,t,i,n){if(!(this instanceof Lr))return new Lr(r,e,t,i,n);if(!(ke&&ke.exports))throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");r||(r=32),n!==!0&&(Ai(r>=Cb,"digestLength must be at least "+Cb+", was given "+r),Ai(r<=Sb,"digestLength must be at most "+Sb+", was given "+r),e!=null&&Ai(e.length>=xb,"key must be at least "+xb+", was given "+e.length),e!=null&&Ai(e.length<=Tb,"key must be at least "+Tb+", was given "+e.length),t!=null&&Ai(t.length===Nb,"salt must be exactly "+Nb+", was given "+t.length),i!=null&&Ai(i.length===Db,"personal must be exactly "+Db+", was given "+i.length)),th.length||(th.push(Xi),Xi+=216),this.digestLength=r,this.finalized=!1,this.pointer=th.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,t&&ke.memory.set(t,32),i&&ke.memory.set(i,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,Xi,Xi+e.length),ke.memory[this.pointer+200]=128)}Lr.prototype.update=function(r){return Ai(this.finalized===!1,"Hash instance finalized"),Ai(r,"input must be TypedArray or Buffer"),Xi+r.length>ke.memory.length&&ke.realloc(Xi+r.length),ke.memory.set(r,Xi),ke.exports.blake2b_update(this.pointer,Xi,Xi+r.length),this};Lr.prototype.digest=function(r){if(Ai(this.finalized===!1,"Hash instance finalized"),this.finalized=!0,th.push(this.pointer),ke.exports.blake2b_final(this.pointer),!r||r==="binary")return ke.memory.slice(this.pointer+128,this.pointer+128+this.digestLength);if(r==="hex")return lL(ke.memory,this.pointer+128,this.digestLength);Ai(r.length>=this.digestLength,"input must be TypedArray or Buffer");for(var e=0;e{f();var Bn=Oy(),dc=Ob();function rh(r,e,t){var i=r[e]+r[t],n=r[e+1]+r[t+1];i>=4294967296&&n++,r[e]=i,r[e+1]=n}function Pb(r,e,t,i){var n=r[e]+t;t<0&&(n+=4294967296);var s=r[e+1]+i;n>=4294967296&&s++,r[e]=n,r[e+1]=s}function qb(r,e){return r[e]^r[e+1]<<8^r[e+2]<<16^r[e+3]<<24}function On(r,e,t,i,n,s){var o=hc[n],a=hc[n+1],u=hc[s],h=hc[s+1];rh(Se,r,e),Pb(Se,r,o,a);var p=Se[i]^Se[r],w=Se[i+1]^Se[r+1];Se[i]=w,Se[i+1]=p,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=p>>>24^w<<8,Se[e+1]=w>>>24^p<<8,rh(Se,r,e),Pb(Se,r,u,h),p=Se[i]^Se[r],w=Se[i+1]^Se[r+1],Se[i]=p>>>16^w<<16,Se[i+1]=w>>>16^p<<16,rh(Se,t,i),p=Se[e]^Se[t],w=Se[e+1]^Se[t+1],Se[e]=w>>>31^p<<1,Se[e+1]=p>>>31^w<<1}var Vb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),hL=[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],ar=new Uint8Array(hL.map(function(r){return r*2})),Se=new Uint32Array(32),hc=new Uint32Array(32);function Hb(r,e){var t=0;for(t=0;t<16;t++)Se[t]=r.h[t],Se[t+16]=Vb[t];for(Se[24]=Se[24]^r.t,Se[25]=Se[25]^r.t/4294967296,e&&(Se[28]=~Se[28],Se[29]=~Se[29]),t=0;t<32;t++)hc[t]=qb(r.b,4*t);for(t=0;t<12;t++)On(0,8,16,24,ar[t*16+0],ar[t*16+1]),On(2,10,18,26,ar[t*16+2],ar[t*16+3]),On(4,12,20,28,ar[t*16+4],ar[t*16+5]),On(6,14,22,30,ar[t*16+6],ar[t*16+7]),On(0,10,20,30,ar[t*16+8],ar[t*16+9]),On(2,12,22,24,ar[t*16+10],ar[t*16+11]),On(4,14,16,26,ar[t*16+12],ar[t*16+13]),On(6,8,18,28,ar[t*16+14],ar[t*16+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^Se[t]^Se[t+16]}var Pn=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 Oa(r,e,t,i){Pn.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=r,Pn[0]=r,e&&(Pn[1]=e.length),Pn[2]=1,Pn[3]=1,t&&Pn.set(t,32),i&&Pn.set(i,48);for(var n=0;n<16;n++)this.h[n]=Vb[n]^qb(Pn,n*4);e&&(Qb(this,e),this.c=128)}Oa.prototype.update=function(r){return Bn(r!=null,"input must be Uint8Array or Buffer"),Qb(this,r),this};Oa.prototype.digest=function(r){var e=!r||r==="binary"||r==="hex"?new Uint8Array(this.outlen):r;return Bn(e.length>=this.outlen,"out must have at least outlen bytes of space"),dL(this,e),r==="hex"?pL(e):e};Oa.prototype.final=Oa.prototype.digest;Oa.ready=function(r){dc.ready(function(){r()})};function Qb(r,e){for(var t=0;t>2]>>8*(t&3);return e}function pL(r){for(var e="",t=0;t=Bb,"outlen must be at least "+Bb+", was given "+e),Bn(e<=Mb,"outlen must be at most "+Mb+", was given "+e),t!=null&&Bn(t.length>=Rb,"key must be at least "+Rb+", was given "+t.length),t!=null&&Bn(t.length<=Lb,"key must be at most "+Lb+", was given "+t.length),i!=null&&Bn(i.length===Fb,"salt must be exactly "+Fb+", was given "+i.length),n!=null&&Bn(n.length===Ub,"personal must be exactly "+Ub+", was given "+n.length)),new jb(e,t,i,n)};wr.exports.ready=function(r){dc.ready(function(){r()})};wr.exports.WASM_SUPPORTED=dc.SUPPORTED;wr.exports.WASM_LOADED=!1;var Bb=wr.exports.BYTES_MIN=16,Mb=wr.exports.BYTES_MAX=64,q$=wr.exports.BYTES=32,Rb=wr.exports.KEYBYTES_MIN=16,Lb=wr.exports.KEYBYTES_MAX=64,V$=wr.exports.KEYBYTES=32,Fb=wr.exports.SALTBYTES=16,Ub=wr.exports.PERSONALBYTES=16;dc.ready(function(r){r||(wr.exports.WASM_LOADED=!0,jb=dc)})});var jy=B(Fr=>{"use strict";f();var yL=Fr&&Fr.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),mL=Fr&&Fr.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),wL=Fr&&Fr.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&yL(e,r,t);return mL(e,r),e};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.TransactionHash=Fr.Transaction=void 0;var Pa=jr(),Hy=Gr(),vL=Wu(),EL=wL(Ye()),AL=YI(),Qy=XI(),IL=tb(),Kb=nb(),zb=sc(),_L=Tr(),bL=Gb(),CL=32,pc=class{constructor({nonce:e,value:t,receiver:i,sender:n,gasPrice:s,gasLimit:o,data:a,chainID:u,version:h,options:p}){this.nonce=e||0,this.value=t?new Pa.BigNumber(t.toString()).toFixed(0):0,this.sender=n,this.receiver=i,this.gasPrice=s||vL.TRANSACTION_MIN_GAS_PRICE,this.gasLimit=o,this.data=a||new zb.TransactionPayload,this.chainID=u,this.version=h||Qy.TransactionVersion.withDefaultVersion(),this.options=p||Qy.TransactionOptions.withDefaultOptions(),this.signature=Kb.Signature.empty(),this.hash=zs.empty()}getNonce(){return this.nonce}setNonce(e){this.nonce=e}getValue(){return this.value}setValue(e){this.value=e}getSender(){return this.sender}getReceiver(){return this.receiver}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}getOptions(){return this.options}getSignature(){return this.signature}getHash(){return _L.guardNotEmpty(this.hash,"hash"),this.hash}serializeForSigning(e){let t=this.toPlainObject(e);t.signature&&delete t.signature;let i=JSON.stringify(t);return y.Buffer.from(i)}toPlainObject(e){return{nonce:this.nonce.valueOf(),value:this.value.toString(),receiver:this.receiver.bech32(),sender:e?e.bech32():this.sender.bech32(),gasPrice:this.gasPrice.valueOf(),gasLimit:this.gasLimit.valueOf(),data:this.data.length()==0?void 0:this.data.encoded(),chainID:this.chainID.valueOf(),version:this.version.valueOf(),options:this.options.valueOf()==0?void 0:this.options.valueOf(),signature:this.signature.hex()?this.signature.hex():void 0}}static fromPlainObject(e){let t=new pc({nonce:Number(e.nonce),value:new Pa.BigNumber(e.value).toFixed(0),receiver:Hy.Address.fromString(e.receiver),sender:Hy.Address.fromString(e.sender),gasPrice:Number(e.gasPrice),gasLimit:Number(e.gasLimit),data:new zb.TransactionPayload(y.Buffer.from(e.data||"","base64")),chainID:String(e.chainID),version:new Qy.TransactionVersion(e.version)});return e.signature&&t.applySignature(new Kb.Signature(e.signature),Hy.Address.fromString(e.sender)),t}applySignature(e,t){this.signature=e,this.sender=t,this.hash=zs.compute(this)}toSendable(){return this.toPlainObject()}computeFee(e){let t=e.MinGasLimit.valueOf()+this.data.length()*e.GasPerDataByte.valueOf();if(t>this.gasLimit.valueOf())throw new EL.ErrNotEnoughGas(this.gasLimit.valueOf());let i=new Pa.BigNumber(this.gasPrice.valueOf()),n=new Pa.BigNumber(t).multipliedBy(i);if(t===this.gasLimit.valueOf())return n;let s=new Pa.BigNumber(this.gasLimit.valueOf()-t),o=i.multipliedBy(new Pa.BigNumber(e.GasPriceModifier.valueOf())),a=s.multipliedBy(o);return n.plus(a)}};Fr.Transaction=pc;var zs=class extends AL.Hash{constructor(e){super(e)}static compute(e){let i=new IL.ProtoSerializer().serializeTransaction(e),n=bL(CL).update(i).digest("hex");return new zs(n)}};Fr.TransactionHash=zs});var Gy=B(Ws=>{"use strict";f();Object.defineProperty(Ws,"__esModule",{value:!0});Ws.Logger=Ws.LogLevel=void 0;var ks;(function(r){r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Info=2]="Info",r[r.Warn=3]="Warn",r[r.Error=4]="Error",r[r.None=5]="None"})(ks=Ws.LogLevel||(Ws.LogLevel={}));var Jr=class{static setLevel(e){Jr.logLevel=e}static trace(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static debug(e,...t){Jr.logLevel>=ks.Debug||console.debug(e,t)}static info(e,...t){Jr.logLevel>=ks.Info||console.log(e,t)}static warn(e,...t){Jr.logLevel>=ks.Warn||console.warn(e,t)}static error(e,...t){Jr.logLevel>=ks.Error||console.error(e,t)}};Ws.Logger=Jr;Jr.logLevel=ks.Debug});var kb=B(_i=>{"use strict";f();var SL=_i&&_i.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),xL=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),TL=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&SL(e,r,t);return xL(e,r),e};Object.defineProperty(_i,"__esModule",{value:!0});_i.AsyncTimer=void 0;var NL=TL(Ye()),DL=Ye(),Ky=Gy(),zy=class{constructor(e){this.timeoutHandle=null,this.rejectionFunc=null,this.name=e,this.correlationTag=0}start(e){if(this.timeoutHandle)throw new NL.ErrAsyncTimerAlreadyRunning;return this.correlationTag++,Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].start()`),new Promise((t,i)=>{this.rejectionFunc=i;let n=()=>{this.rejectionFunc=null,this.stop(),t()};this.timeoutHandle=setTimeout(n,e)})}abort(){Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].abort()`),this.rejectionFunc&&(this.rejectionFunc(new DL.ErrAsyncTimerAborted),this.rejectionFunc=null),this.stop()}stop(){this.isStopped()||(Ky.Logger.trace(`AsyncTimer[${this.name}'${this.correlationTag}].stop()`),this.timeoutHandle&&(clearTimeout(this.timeoutHandle),this.timeoutHandle=null))}isStopped(){return!this.timeoutHandle}};_i.AsyncTimer=zy});var Wy=B(Ma=>{"use strict";f();var Ur=Ma&&Ma.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(Ma,"__esModule",{value:!0});Ma.TransactionWatcher=void 0;var Wb=kb(),$b=Gy(),Ba=Ye(),bi=class{constructor(e,t=bi.DefaultPollingInterval,i=bi.DefaultTimeout){this.fetcher=new ky(e),this.pollingInterval=t,this.timeout=i}awaitPending(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.status.isPending(),i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ba.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitCompleted(e){return Ur(this,void 0,void 0,function*(){let t=s=>s.isCompleted,i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ba.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitAllEvents(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.every(h=>a.includes(h))},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ba.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitAnyEvent(e,t){return Ur(this,void 0,void 0,function*(){let i=o=>{let a=this.getAllTransactionEvents(o).map(h=>h.identifier);return t.find(h=>a.includes(h))!=null},n=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),s=()=>new Ba.ErrExpectedTransactionEventsNotFound;return this.awaitConditionally(i,n,s)})}awaitOnCondition(e,t){return Ur(this,void 0,void 0,function*(){let i=()=>Ur(this,void 0,void 0,function*(){return yield this.fetcher.getTransaction(e.getHash().hex())}),n=()=>new Ba.ErrExpectedTransactionStatusNotReached;return this.awaitConditionally(t,i,n)})}awaitConditionally(e,t,i){return Ur(this,void 0,void 0,function*(){let n=new Wb.AsyncTimer("watcher:periodic"),s=new Wb.AsyncTimer("watcher:timeout"),o=!1,a,u=!1;for(s.start(this.timeout).finally(()=>{s.stop(),o=!0});!o;){yield n.start(this.pollingInterval);try{if(a=yield t(),u=e(a),u||o)break}catch(h){if($b.Logger.debug("TransactionWatcher.awaitConditionally(): cannot (yet) fetch data."),!(h instanceof Ba.Err))throw h}}if(s.isStopped()||s.stop(),!a||!u)throw i();return a})}getAllTransactionEvents(e){let t=[...e.logs.events];for(let i of e.contractResults.items)t.push(...i.logs.events);return t}};Ma.TransactionWatcher=bi;bi.DefaultPollingInterval=6e3;bi.DefaultTimeout=bi.DefaultPollingInterval*15;bi.NoopOnStatusReceived=r=>{};var ky=class{constructor(e){this.fetcher=e}getTransaction(e){return Ur(this,void 0,void 0,function*(){return $b.Logger.debug(`transactionWatcher, getTransaction(${e})`),yield this.fetcher.getTransaction(e)})}}});var Yb=B(Ci=>{"use strict";f();var OL=Ci&&Ci.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),PL=Ci&&Ci.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),BL=Ci&&Ci.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&OL(e,r,t);return PL(e,r),e};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.ContractFunction=void 0;var ML=BL(Ye()),gc=class{constructor(e){if(this.name=e,e==null)throw new ML.ErrInvalidFunctionName}static none(){return new gc("untitled")}toString(){return this.name}valueOf(){return this.name}equals(e){return e?this.name==e.name:!1}};Ci.ContractFunction=gc});var Jb=B(Ra=>{"use strict";f();Object.defineProperty(Ra,"__esModule",{value:!0});Ra.Signature=Ra.Address=void 0;var $y=class{constructor(e){this.value=e}bech32(){return this.value}};Ra.Address=$y;var Yy=class{constructor(e){this.value=e}hex(){return this.value}};Ra.Signature=Yy});var Xb=B(yc=>{"use strict";f();Object.defineProperty(yc,"__esModule",{value:!0});yc.Operation=void 0;var RL;(function(r){r.Connect="connect",r.Logout="logout",r.SignTransactions="signTransactions",r.SignMessage="signMessage",r.CancelAction="cancelAction"})(RL=yc.Operation||(yc.Operation={}))});var Zb=B(Mn=>{"use strict";f();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.ErrAccountNotConnected=Mn.ErrCannotSignSingleTransaction=Mn.Err=void 0;var mc=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Mn.Err=mc;var Jy=class extends mc{constructor(){super("Cannot sign single transaction.")}};Mn.ErrCannotSignSingleTransaction=Jy;var Xy=class extends mc{constructor(){super("Account is not connected.")}};Mn.ErrAccountNotConnected=Xy});var Zy=B(La=>{"use strict";f();var Rn=La&&La.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})};Object.defineProperty(La,"__esModule",{value:!0});La.ExtensionProvider=void 0;var ih=Jb(),wc=Xb(),eC=Zb(),Si=class{constructor(){if(this.account={address:""},this.initialized=!1,Si._instance)throw new Error("Error: Instantiation failed: Use ExtensionProvider.getInstance() instead of new.");Si._instance=this}static getInstance(){return Si._instance}setAddress(e){return this.account.address=e,Si._instance}init(){return Rn(this,void 0,void 0,function*(){return window&&window.elrondWallet&&(this.initialized=!0),this.initialized})}login(e={}){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");let{token:t}=e,i=t||"";return yield this.startBgrMsgChannel(wc.Operation.Connect,i),this.account.address})}logout(){return Rn(this,void 0,void 0,function*(){if(!this.initialized)throw new Error("Extension provider is not initialised, call init() first");try{yield this.startBgrMsgChannel(wc.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 Rn(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 Rn(this,void 0,void 0,function*(){return Boolean(this.account.address)})}signTransaction(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.signTransactions([e]);if(t.length!=1)throw new eC.ErrCannotSignSingleTransaction;return t[0]})}ensureConnected(){if(!this.account.address)throw new eC.ErrAccountNotConnected}signTransactions(e){return Rn(this,void 0,void 0,function*(){this.ensureConnected();let t=yield this.startBgrMsgChannel(wc.Operation.SignTransactions,{from:this.account.address,transactions:e.map(i=>i.toPlainObject())});try{for(let i=0;i{window.postMessage({target:"erdw-inpage",type:e,data:t},window.origin);let n=s=>{s.isTrusted&&s.data.target==="erdw-contentScript"&&(s.data.type==="connectResponse"?(s.data.data&&Boolean(s.data.data.address)&&(this.account=s.data.data),window.removeEventListener("message",n),i(s.data.data)):(window.removeEventListener("message",n),i(s.data.data)))};window.addEventListener("message",n,!1)})}};La.ExtensionProvider=Si;Si._instance=new Si});var oC=B((yY,sC)=>{"use strict";f();function LL(r){try{return JSON.stringify(r)}catch{return'"[Circular]"'}}sC.exports=FL;function FL(r,e,t){var i=t&&t.stringify||LL,n=1;if(typeof r=="object"&&r!==null){var s=e.length+n;if(s===1)return r;var o=new Array(s);o[0]=i(r);for(var a=1;a-1?w:0,r.charCodeAt(O+1)){case 100:case 102:if(p>=u||e[p]==null)break;w=u||e[p]==null)break;w=u||e[p]===void 0)break;w",w=O+2,O++;break}h+=i(e[p]),w=O+2,O++;break;case 115:if(p>=u)break;w{"use strict";f();var aC=oC();lC.exports=Ti;var vc=kL().console||{},UL={mapHttpRequest:uh,mapHttpResponse:uh,wrapRequestSerializer:em,wrapResponseSerializer:em,wrapErrorSerializer:em,req:uh,res:uh,err:jL};function qL(r,e){return Array.isArray(r)?r.filter(function(i){return i!=="!stdSerializers.err"}):r===!0?Object.keys(e):!1}function Ti(r){r=r||{},r.browser=r.browser||{};let e=r.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");let t=r.browser.write||vc;r.browser.write&&(r.browser.asObject=!0);let i=r.serializers||{},n=qL(r.browser.serialize,i),s=r.browser.serialize;Array.isArray(r.browser.serialize)&&r.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);let o=["error","fatal","warn","info","debug","trace"];typeof t=="function"&&(t.error=t.fatal=t.warn=t.info=t.debug=t.trace=t),r.enabled===!1&&(r.level="silent");let a=r.level||"info",u=Object.create(t);u.log||(u.log=Ec),Object.defineProperty(u,"levelVal",{get:p}),Object.defineProperty(u,"level",{get:w,set:N});let h={transmit:e,serialize:n,asObject:r.browser.asObject,levels:o,timestamp:GL(r)};u.levels=Ti.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=Ec,u.serializers=i,u._serialize=n,u._stdErrSerialize=s,u.child=O,e&&(u._logEvent=tm());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function w(){return this._level}function N(T){if(T!=="silent"&&!this.levels.values[T])throw Error("unknown level "+T);this._level=T,Fa(h,u,"error","log"),Fa(h,u,"fatal","error"),Fa(h,u,"warn","error"),Fa(h,u,"info","log"),Fa(h,u,"debug","log"),Fa(h,u,"trace","log")}function O(T,V){if(!T)throw new Error("missing bindings for child Pino");V=V||{},n&&T.serializers&&(V.serializers=T.serializers);let z=V.serializers;if(n&&z){var $=Object.assign({},i,z),se=r.browser.serialize===!0?Object.keys($):n;delete T.serializers,ch([T],se,$,this._stdErrSerialize)}function Y(j){this._childLevel=(j._childLevel|0)+1,this.error=Ua(j,T,"error"),this.fatal=Ua(j,T,"fatal"),this.warn=Ua(j,T,"warn"),this.info=Ua(j,T,"info"),this.debug=Ua(j,T,"debug"),this.trace=Ua(j,T,"trace"),$&&(this.serializers=$,this._serialize=se),e&&(this._logEvent=tm([].concat(j._logEvent.bindings,T)))}return Y.prototype=this,new Y(this)}return u}Ti.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"}};Ti.stdSerializers=UL;Ti.stdTimeFunctions=Object.assign({},{nullTime:uC,epochTime:cC,unixTime:KL,isoTime:zL});function Fa(r,e,t,i){let n=Object.getPrototypeOf(e);e[t]=e.levelVal>e.levels.values[t]?Ec:n[t]?n[t]:vc[t]||vc[i]||Ec,VL(r,e,t)}function VL(r,e,t){!r.transmit&&e[t]===Ec||(e[t]=function(i){return function(){let s=r.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===vc?vc:this;for(var u=0;u-1&&s in t&&(r[n][s]=t[s](r[n][s]))}function Ua(r,e,t){return function(){let i=new Array(1+arguments.length);i[0]=e;for(var n=1;n{"use strict";f();var qa=typeof Reflect=="object"?Reflect:null,fC=qa&&typeof qa.apply=="function"?qa.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},fh;qa&&typeof qa.ownKeys=="function"?fh=qa.ownKeys:Object.getOwnPropertySymbols?fh=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:fh=function(e){return Object.getOwnPropertyNames(e)};function WL(r){console&&console.warn&&console.warn(r)}var dC=Number.isNaN||function(e){return e!==e};function je(){je.init.call(this)}rm.exports=je;rm.exports.once=XL;je.EventEmitter=je;je.prototype._events=void 0;je.prototype._eventsCount=0;je.prototype._maxListeners=void 0;var hC=10;function hh(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(je,"defaultMaxListeners",{enumerable:!0,get:function(){return hC},set:function(r){if(typeof r!="number"||r<0||dC(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");hC=r}});je.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};je.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dC(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 pC(r){return r._maxListeners===void 0?je.defaultMaxListeners:r._maxListeners}je.prototype.getMaxListeners=function(){return pC(this)};je.prototype.emit=function(e){for(var t=[],i=1;i0&&(o=t[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")fC(u,this,t);else for(var h=u.length,p=vC(u,h),i=0;i0&&o.length>n&&!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=r,a.type=e,a.count=o.length,WL(a)}return r}je.prototype.addListener=function(e,t){return gC(this,e,t,!1)};je.prototype.on=je.prototype.addListener;je.prototype.prependListener=function(e,t){return gC(this,e,t,!0)};function $L(){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 yC(r,e,t){var i={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},n=$L.bind(i);return n.listener=t,i.wrapFn=n,n}je.prototype.once=function(e,t){return hh(t),this.on(e,yC(this,e,t)),this};je.prototype.prependOnceListener=function(e,t){return hh(t),this.prependListener(e,yC(this,e,t)),this};je.prototype.removeListener=function(e,t){var i,n,s,o,a;if(hh(t),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():YL(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};je.prototype.off=je.prototype.removeListener;je.prototype.removeAllListeners=function(e){var t,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function mC(r,e,t){var i=r._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?t?[n.listener||n]:[n]:t?JL(n):vC(n,n.length)}je.prototype.listeners=function(e){return mC(this,e,!0)};je.prototype.rawListeners=function(e){return mC(this,e,!1)};je.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):wC.call(r,e)};je.prototype.listenerCount=wC;function wC(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}je.prototype.eventNames=function(){return this._eventsCount>0?fh(this._events):[]};function vC(r,e){for(var t=new Array(e),i=0;inm,__asyncDelegator:()=>h5,__asyncGenerator:()=>f5,__asyncValues:()=>d5,__await:()=>Ac,__awaiter:()=>s5,__classPrivateFieldGet:()=>m5,__classPrivateFieldSet:()=>w5,__createBinding:()=>a5,__decorate:()=>r5,__exportStar:()=>u5,__extends:()=>e5,__generator:()=>o5,__importDefault:()=>y5,__importStar:()=>g5,__makeTemplateObject:()=>p5,__metadata:()=>n5,__param:()=>i5,__read:()=>AC,__rest:()=>t5,__spread:()=>c5,__spreadArrays:()=>l5,__values:()=>sm});function e5(r,e){im(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function t5(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n=0;a--)(o=r[a])&&(s=(n<3?o(s):n>3?o(e,t,s):o(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s}function i5(r,e){return function(t,i){e(t,i,r)}}function n5(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)}function s5(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})}function o5(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,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(h){return function(p){return u([h,p])}}function u(h){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,n&&(s=h[0]&2?n.return:h[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,h[1])).done)return s;switch(n=0,s&&(h=[h[0]&2,s.value]),h[0]){case 0:case 1:s=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,n=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!s||h[1]>s[0]&&h[1]=r.length&&(r=void 0),{value:r&&r[i++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function AC(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var i=t.call(r),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function c5(){for(var r=[],e=0;e1||a(N,O)})})}function a(N,O){try{u(i[N](O))}catch(T){w(s[0][3],T)}}function u(N){N.value instanceof Ac?Promise.resolve(N.value.v).then(h,p):w(s[0][2],N)}function h(N){a("next",N)}function p(N){a("throw",N)}function w(N,O){N(O),s.shift(),s.length&&a(s[0][0],s[0][1])}}function h5(r){var e,t;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=r[n]?function(o){return(t=!t)?{value:Ac(r[n](o)),done:n==="return"}:s?s(o):o}:s}}function d5(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof sm=="function"?sm(r):r[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=r[s]&&function(o){return new Promise(function(a,u){o=r[s](o),n(a,u,o.done,o.value)})}}function n(s,o,a,u){Promise.resolve(u).then(function(h){s({value:h,done:a})},o)}}function p5(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}function g5(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e}function y5(r){return r&&r.__esModule?r:{default:r}}function m5(r,e){if(!e.has(r))throw new TypeError("attempted to get private field on non-instance");return e.get(r)}function w5(r,e,t){if(!e.has(r))throw new TypeError("attempted to set private field on non-instance");return e.set(r,t),t}var im,nm,br=me(()=>{f();im=function(r,e){return im=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)i.hasOwnProperty(n)&&(t[n]=i[n])},im(r,e)};nm=function(){return nm=Object.assign||function(e){for(var t,i=1,n=arguments.length;i{"use strict";f();Object.defineProperty(dh,"__esModule",{value:!0});function v5(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}dh.safeJsonParse=v5;function E5(r){return typeof r=="string"?r:JSON.stringify(r,(e,t)=>typeof t>"u"?null:t)}dh.safeJsonStringify=E5});var IC=B((CY,ph)=>{"use strict";f();(function(){"use strict";let r;function e(){}r=e,r.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},r.prototype.setItem=function(t,i){this[t]=String(i)},r.prototype.removeItem=function(t){delete this[t]},r.prototype.clear=function(){let t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},r.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof global<"u"&&global.localStorage?ph.exports=global.localStorage:typeof window<"u"&&window.localStorage?ph.exports=window.localStorage:ph.exports=new e})()});var _C=B(gh=>{"use strict";f();Object.defineProperty(gh,"__esModule",{value:!0});gh.IKeyValueStorage=void 0;var am=class{};gh.IKeyValueStorage=am});var bC=B(yh=>{"use strict";f();Object.defineProperty(yh,"__esModule",{value:!0});yh.parseEntry=void 0;var A5=om();function I5(r){var e;return[r[0],A5.safeJsonParse((e=r[1])!==null&&e!==void 0?e:"")]}yh.parseEntry=I5});var SC=B(mh=>{"use strict";f();Object.defineProperty(mh,"__esModule",{value:!0});var CC=(br(),at(_r));CC.__exportStar(_C(),mh);CC.__exportStar(bC(),mh)});var TC=B(Ic=>{"use strict";f();Object.defineProperty(Ic,"__esModule",{value:!0});Ic.KeyValueStorage=void 0;var Va=(br(),at(_r)),xC=om(),_5=Va.__importDefault(IC()),b5=SC(),wh=class{constructor(){this.localStorage=_5.default}getKeys(){return Va.__awaiter(this,void 0,void 0,function*(){return Object.keys(this.localStorage)})}getEntries(){return Va.__awaiter(this,void 0,void 0,function*(){return Object.entries(this.localStorage).map(b5.parseEntry)})}getItem(e){return Va.__awaiter(this,void 0,void 0,function*(){let t=this.localStorage.getItem(e);if(t!==null)return xC.safeJsonParse(t)})}setItem(e,t){return Va.__awaiter(this,void 0,void 0,function*(){this.localStorage.setItem(e,xC.safeJsonStringify(t))})}removeItem(e){return Va.__awaiter(this,void 0,void 0,function*(){this.localStorage.removeItem(e)})}};Ic.KeyValueStorage=wh;Ic.default=wh});var NC=B(vh=>{"use strict";f();Object.defineProperty(vh,"__esModule",{value:!0});vh.delay=void 0;function C5(r){return new Promise(e=>{setTimeout(()=>{e(!0)},r)})}vh.delay=C5});var DC=B(Ha=>{"use strict";f();Object.defineProperty(Ha,"__esModule",{value:!0});Ha.ONE_THOUSAND=Ha.ONE_HUNDRED=void 0;Ha.ONE_HUNDRED=100;Ha.ONE_THOUSAND=1e3});var OC=B(ye=>{"use strict";f();Object.defineProperty(ye,"__esModule",{value:!0});ye.ONE_YEAR=ye.FOUR_WEEKS=ye.THREE_WEEKS=ye.TWO_WEEKS=ye.ONE_WEEK=ye.THIRTY_DAYS=ye.SEVEN_DAYS=ye.FIVE_DAYS=ye.THREE_DAYS=ye.ONE_DAY=ye.TWENTY_FOUR_HOURS=ye.TWELVE_HOURS=ye.SIX_HOURS=ye.THREE_HOURS=ye.ONE_HOUR=ye.SIXTY_MINUTES=ye.THIRTY_MINUTES=ye.TEN_MINUTES=ye.FIVE_MINUTES=ye.ONE_MINUTE=ye.SIXTY_SECONDS=ye.THIRTY_SECONDS=ye.TEN_SECONDS=ye.FIVE_SECONDS=ye.ONE_SECOND=void 0;ye.ONE_SECOND=1;ye.FIVE_SECONDS=5;ye.TEN_SECONDS=10;ye.THIRTY_SECONDS=30;ye.SIXTY_SECONDS=60;ye.ONE_MINUTE=ye.SIXTY_SECONDS;ye.FIVE_MINUTES=ye.ONE_MINUTE*5;ye.TEN_MINUTES=ye.ONE_MINUTE*10;ye.THIRTY_MINUTES=ye.ONE_MINUTE*30;ye.SIXTY_MINUTES=ye.ONE_MINUTE*60;ye.ONE_HOUR=ye.SIXTY_MINUTES;ye.THREE_HOURS=ye.ONE_HOUR*3;ye.SIX_HOURS=ye.ONE_HOUR*6;ye.TWELVE_HOURS=ye.ONE_HOUR*12;ye.TWENTY_FOUR_HOURS=ye.ONE_HOUR*24;ye.ONE_DAY=ye.TWENTY_FOUR_HOURS;ye.THREE_DAYS=ye.ONE_DAY*3;ye.FIVE_DAYS=ye.ONE_DAY*5;ye.SEVEN_DAYS=ye.ONE_DAY*7;ye.THIRTY_DAYS=ye.ONE_DAY*30;ye.ONE_WEEK=ye.SEVEN_DAYS;ye.TWO_WEEKS=ye.ONE_WEEK*2;ye.THREE_WEEKS=ye.ONE_WEEK*3;ye.FOUR_WEEKS=ye.ONE_WEEK*4;ye.ONE_YEAR=ye.ONE_DAY*365});var um=B(Eh=>{"use strict";f();Object.defineProperty(Eh,"__esModule",{value:!0});var PC=(br(),at(_r));PC.__exportStar(DC(),Eh);PC.__exportStar(OC(),Eh)});var MC=B(Qa=>{"use strict";f();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.fromMiliseconds=Qa.toMiliseconds=void 0;var BC=um();function S5(r){return r*BC.ONE_THOUSAND}Qa.toMiliseconds=S5;function x5(r){return Math.floor(r/BC.ONE_THOUSAND)}Qa.fromMiliseconds=x5});var LC=B(Ah=>{"use strict";f();Object.defineProperty(Ah,"__esModule",{value:!0});var RC=(br(),at(_r));RC.__exportStar(NC(),Ah);RC.__exportStar(MC(),Ah)});var FC=B(_c=>{"use strict";f();Object.defineProperty(_c,"__esModule",{value:!0});_c.Watch=void 0;var Ih=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 t=this.get(e);if(typeof t.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);let i=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:i})}get(e){let t=this.timestamps.get(e);if(typeof t>"u")throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};_c.Watch=Ih;_c.default=Ih});var UC=B(_h=>{"use strict";f();Object.defineProperty(_h,"__esModule",{value:!0});_h.IWatch=void 0;var cm=class{};_h.IWatch=cm});var qC=B(lm=>{"use strict";f();Object.defineProperty(lm,"__esModule",{value:!0});var T5=(br(),at(_r));T5.__exportStar(UC(),lm)});var Ys=B(ja=>{"use strict";f();Object.defineProperty(ja,"__esModule",{value:!0});var bh=(br(),at(_r));bh.__exportStar(LC(),ja);bh.__exportStar(FC(),ja);bh.__exportStar(qC(),ja);bh.__exportStar(um(),ja)});var fm,VC=me(()=>{f();fm=class{}});var hm={};ot(hm,{IEvents:()=>fm});var dm=me(()=>{f();VC()});var HC=B(Ch=>{"use strict";f();Object.defineProperty(Ch,"__esModule",{value:!0});Ch.IHeartBeat=void 0;var N5=(dm(),at(hm)),pm=class extends N5.IEvents{constructor(e){super()}};Ch.IHeartBeat=pm});var ym=B(gm=>{"use strict";f();Object.defineProperty(gm,"__esModule",{value:!0});var D5=(br(),at(_r));D5.__exportStar(HC(),gm)});var QC=B(Ga=>{"use strict";f();Object.defineProperty(Ga,"__esModule",{value:!0});Ga.HEARTBEAT_EVENTS=Ga.HEARTBEAT_INTERVAL=void 0;var O5=Ys();Ga.HEARTBEAT_INTERVAL=O5.FIVE_SECONDS;Ga.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"}});var wm=B(mm=>{"use strict";f();Object.defineProperty(mm,"__esModule",{value:!0});var P5=(br(),at(_r));P5.__exportStar(QC(),mm)});var jC=B(Sh=>{"use strict";f();Object.defineProperty(Sh,"__esModule",{value:!0});Sh.HeartBeat=void 0;var vm=(br(),at(_r)),B5=$s(),M5=Ys(),R5=ym(),Em=wm(),bc=class extends R5.IHeartBeat{constructor(e){super(e),this.events=new B5.EventEmitter,this.interval=Em.HEARTBEAT_INTERVAL,this.interval=e?.interval||Em.HEARTBEAT_INTERVAL}static init(e){return vm.__awaiter(this,void 0,void 0,function*(){let t=new bc(e);return yield t.init(),t})}init(){return vm.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}initialize(){return vm.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),M5.toMiliseconds(this.interval))})}pulse(){this.events.emit(Em.HEARTBEAT_EVENTS.pulse)}};Sh.HeartBeat=bc});var GC=B(Cc=>{"use strict";f();Object.defineProperty(Cc,"__esModule",{value:!0});var Am=(br(),at(_r));Am.__exportStar(jC(),Cc);Am.__exportStar(ym(),Cc);Am.__exportStar(wm(),Cc)});var Im=B(Ka=>{"use strict";f();Object.defineProperty(Ka,"__esModule",{value:!0});Ka.PINO_CUSTOM_CONTEXT_KEY=Ka.PINO_LOGGER_DEFAULTS=void 0;Ka.PINO_LOGGER_DEFAULTS={level:"info"};Ka.PINO_CUSTOM_CONTEXT_KEY="custom_context"});var $C=B(vr=>{"use strict";f();Object.defineProperty(vr,"__esModule",{value:!0});vr.generateChildLogger=vr.formatChildLoggerContext=vr.getLoggerContext=vr.setBrowserLoggerContext=vr.getBrowserLoggerContext=vr.getDefaultLoggerOptions=void 0;var za=Im();function L5(r){return Object.assign(Object.assign({},r),{level:r?.level||za.PINO_LOGGER_DEFAULTS.level})}vr.getDefaultLoggerOptions=L5;function KC(r,e=za.PINO_CUSTOM_CONTEXT_KEY){return r[e]||""}vr.getBrowserLoggerContext=KC;function zC(r,e,t=za.PINO_CUSTOM_CONTEXT_KEY){return r[t]=e,r}vr.setBrowserLoggerContext=zC;function kC(r,e=za.PINO_CUSTOM_CONTEXT_KEY){let t="";return typeof r.bindings>"u"?t=KC(r,e):t=r.bindings().context||"",t}vr.getLoggerContext=kC;function WC(r,e,t=za.PINO_CUSTOM_CONTEXT_KEY){let i=kC(r,t);return i.trim()?`${i}/${e}`:e}vr.formatChildLoggerContext=WC;function F5(r,e,t=za.PINO_CUSTOM_CONTEXT_KEY){let i=WC(r,e,t),n=r.child({context:i});return zC(n,i,t)}vr.generateChildLogger=F5});var bm=B(ka=>{"use strict";f();Object.defineProperty(ka,"__esModule",{value:!0});ka.pino=void 0;var _m=(br(),at(_r)),U5=_m.__importDefault(lh());Object.defineProperty(ka,"pino",{enumerable:!0,get:function(){return U5.default}});_m.__exportStar(Im(),ka);_m.__exportStar($C(),ka)});var Hm=B(Wt=>{"use strict";f();Object.defineProperty(Wt,"__esModule",{value:!0});var Wa=(dm(),at(hm)),YC=$s();function q5(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var V5=q5(YC),Cm=class extends Wa.IEvents{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},Sm=class{constructor(e,t,i){this.core=e,this.logger=t}},xm=class extends Wa.IEvents{constructor(e,t){super(),this.core=e,this.logger=t,this.records=new Map}},Tm=class{constructor(e,t){this.logger=e,this.core=t}},Nm=class extends Wa.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Dm=class extends Wa.IEvents{constructor(e){super()}},Om=class{constructor(e,t,i,n){this.core=e,this.logger=t,this.name=i}},Pm=class{constructor(){this.map=new Map}},Bm=class extends Wa.IEvents{constructor(e,t){super(),this.relayer=e,this.logger=t}},Mm=class{constructor(e,t){this.core=e,this.logger=t}},Rm=class extends Wa.IEvents{constructor(e,t){super(),this.core=e,this.logger=t}},Lm=class{constructor(e,t){this.logger=e,this.core=t}},Fm=class extends V5.default{constructor(){super()}},Um=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},qm=class extends YC.EventEmitter{constructor(){super()}},Vm=class{constructor(e){this.client=e}};Wt.ICore=Cm,Wt.ICrypto=Sm,Wt.IEngine=Vm,Wt.IEngineEvents=qm,Wt.IExpirer=Rm,Wt.IJsonRpcHistory=xm,Wt.IKeyChain=Mm,Wt.IMessageTracker=Tm,Wt.IPairing=Lm,Wt.IPublisher=Nm,Wt.IRelayer=Dm,Wt.ISignClient=Um,Wt.ISignClientEvents=Fm,Wt.IStore=Om,Wt.ISubscriber=Bm,Wt.ISubscriberTopicMap=Pm});var JC={};ot(JC,{safeJsonParse:()=>Sc,safeJsonStringify:()=>xc});function Sc(r){if(typeof r!="string")throw new Error(`Cannot safe json parse value of type ${typeof r}`);try{return JSON.parse(r)}catch{return r}}function xc(r){return typeof r=="string"?r:JSON.stringify(r)}var xh=me(()=>{f()});var ZC=B(Th=>{"use strict";f();Object.defineProperty(Th,"__esModule",{value:!0});Th.BrowserRandomSource=void 0;var XC=65536,Qm=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 t=new Uint8Array(e);for(let i=0;i{"use strict";f();Object.defineProperty(jm,"__esModule",{value:!0});function H5(r){for(var e=0;e{f()});var tS=B(Nh=>{"use strict";f();Object.defineProperty(Nh,"__esModule",{value:!0});Nh.NodeRandomSource=void 0;var Q5=qr(),Gm=class{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof PE<"u"){let e=eS();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 t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");let i=new Uint8Array(e);for(let n=0;n{"use strict";f();Object.defineProperty(Dh,"__esModule",{value:!0});Dh.SystemRandomSource=void 0;var j5=ZC(),G5=tS(),Km=class{constructor(){if(this.isAvailable=!1,this.name="",this._source=new j5.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new G5.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)}};Dh.SystemRandomSource=Km});var iS=B(Cr=>{"use strict";f();Object.defineProperty(Cr,"__esModule",{value:!0});function K5(r,e){var t=r>>>16&65535,i=r&65535,n=e>>>16&65535,s=e&65535;return i*s+(t*s+i*n<<16>>>0)|0}Cr.mul=Math.imul||K5;function z5(r,e){return r+e|0}Cr.add=z5;function k5(r,e){return r-e|0}Cr.sub=k5;function W5(r,e){return r<>>32-e}Cr.rotl=W5;function $5(r,e){return r<<32-e|r>>>e}Cr.rotr=$5;function Y5(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}Cr.isInteger=Number.isInteger||Y5;Cr.MAX_SAFE_INTEGER=9007199254740991;Cr.isSafeInteger=function(r){return Cr.isInteger(r)&&r>=-Cr.MAX_SAFE_INTEGER&&r<=Cr.MAX_SAFE_INTEGER}});var $a=B(Oe=>{"use strict";f();Object.defineProperty(Oe,"__esModule",{value:!0});var nS=iS();function J5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}Oe.readInt16BE=J5;function X5(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}Oe.readUint16BE=X5;function Z5(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}Oe.readInt16LE=Z5;function eF(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}Oe.readUint16LE=eF;function sS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}Oe.writeUint16BE=sS;Oe.writeInt16BE=sS;function oS(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}Oe.writeUint16LE=oS;Oe.writeInt16LE=oS;function zm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}Oe.readInt32BE=zm;function km(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}Oe.readUint32BE=km;function Wm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}Oe.readInt32LE=Wm;function $m(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}Oe.readUint32LE=$m;function Oh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}Oe.writeUint32BE=Oh;Oe.writeInt32BE=Oh;function Ph(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}Oe.writeUint32LE=Ph;Oe.writeInt32LE=Ph;function tF(r,e){e===void 0&&(e=0);var t=zm(r,e),i=zm(r,e+4);return t*4294967296+i-(i>>31)*4294967296}Oe.readInt64BE=tF;function rF(r,e){e===void 0&&(e=0);var t=km(r,e),i=km(r,e+4);return t*4294967296+i}Oe.readUint64BE=rF;function iF(r,e){e===void 0&&(e=0);var t=Wm(r,e),i=Wm(r,e+4);return i*4294967296+t-(t>>31)*4294967296}Oe.readInt64LE=iF;function nF(r,e){e===void 0&&(e=0);var t=$m(r,e),i=$m(r,e+4);return i*4294967296+t}Oe.readUint64LE=nF;function aS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Oh(r/4294967296>>>0,e,t),Oh(r>>>0,e,t+4),e}Oe.writeUint64BE=aS;Oe.writeInt64BE=aS;function uS(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Ph(r>>>0,e,t),Ph(r/4294967296>>>0,e,t+4),e}Oe.writeUint64LE=uS;Oe.writeInt64LE=uS;function sF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=r/8+t-1;s>=t;s--)i+=e[s]*n,n*=256;return i}Oe.readUintBE=sF;function oF(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=t;s=i;s--)t[s]=e/n&255,n*=256;return t}Oe.writeUintBE=aF;function uF(r,e,t,i){if(t===void 0&&(t=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!nS.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s{"use strict";f();Object.defineProperty(ur,"__esModule",{value:!0});ur.randomStringForEntropy=ur.randomString=ur.randomUint32=ur.randomBytes=ur.defaultRandomSource=void 0;var mF=rS(),wF=$a(),cS=qr();ur.defaultRandomSource=new mF.SystemRandomSource;function Ym(r,e=ur.defaultRandomSource){return e.randomBytes(r)}ur.randomBytes=Ym;function vF(r=ur.defaultRandomSource){let e=Ym(4,r),t=(0,wF.readUint32LE)(e);return(0,cS.wipe)(e),t}ur.randomUint32=vF;var lS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function fS(r,e=lS,t=ur.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 i="",n=e.length,s=256-256%n;for(;r>0;){let o=Ym(Math.ceil(r*256/s),t);for(let a=0;a0;a++){let u=o[a];u{"use strict";f();Object.defineProperty(Zi,"__esModule",{value:!0});var Ja=$a(),Ya=qr();Zi.DIGEST_LENGTH=64;Zi.BLOCK_SIZE=128;var dS=function(){function r(){this.digestLength=Zi.DIGEST_LENGTH,this.blockSize=Zi.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Ya.wipe(this._buffer),Ya.wipe(this._tempHi),Ya.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Jm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%128<112?128:256;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Ya.wipe(e.stateHi),Ya.wipe(e.stateLo),e.buffer&&Ya.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Zi.SHA512=dS;var hS=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 Jm(r,e,t,i,n,s,o){for(var a=t[0],u=t[1],h=t[2],p=t[3],w=t[4],N=t[5],O=t[6],T=t[7],V=i[0],z=i[1],$=i[2],se=i[3],Y=i[4],j=i[5],W=i[6],k=i[7],R,F,G,ce,J,X,A,c;o>=128;){for(var d=0;d<16;d++){var g=8*d+s;r[d]=Ja.readUint32BE(n,g),e[d]=Ja.readUint32BE(n,g+4)}for(var d=0;d<80;d++){var m=a,v=u,S=h,D=p,I=w,l=N,C=O,Z=T,ie=V,ee=z,ae=$,E=se,b=Y,x=j,L=W,P=k;if(R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(w>>>14|Y<<32-14)^(w>>>18|Y<<32-18)^(Y>>>41-32|w<<32-(41-32)),F=(Y>>>14|w<<32-14)^(Y>>>18|w<<32-18)^(w>>>41-32|Y<<32-(41-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=w&N^~w&O,F=Y&j^~Y&W,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=hS[d*2],F=hS[d*2+1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=r[d%16],F=e[d%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,G=A&65535|c<<16,ce=J&65535|X<<16,R=G,F=ce,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=(a>>>28|V<<32-28)^(V>>>34-32|a<<32-(34-32))^(V>>>39-32|a<<32-(39-32)),F=(V>>>28|a<<32-28)^(a>>>34-32|V<<32-(34-32))^(a>>>39-32|V<<32-(39-32)),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,R=a&u^a&h^u&h,F=V&z^V&$^z&$,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,Z=A&65535|c<<16,P=J&65535|X<<16,R=D,F=E,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=G,F=ce,J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,D=A&65535|c<<16,E=J&65535|X<<16,u=m,h=v,p=S,w=D,N=I,O=l,T=C,a=Z,z=ie,$=ee,se=ae,Y=E,j=b,W=x,k=L,V=P,d%16===15)for(var g=0;g<16;g++)R=r[g],F=e[g],J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=r[(g+9)%16],F=e[(g+9)%16],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+1)%16],ce=e[(g+1)%16],R=(G>>>1|ce<<32-1)^(G>>>8|ce<<32-8)^G>>>7,F=(ce>>>1|G<<32-1)^(ce>>>8|G<<32-8)^(ce>>>7|G<<32-7),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,G=r[(g+14)%16],ce=e[(g+14)%16],R=(G>>>19|ce<<32-19)^(ce>>>61-32|G<<32-(61-32))^G>>>6,F=(ce>>>19|G<<32-19)^(G>>>61-32|ce<<32-(61-32))^(ce>>>6|G<<32-6),J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,r[g]=A&65535|c<<16,e[g]=J&65535|X<<16}R=a,F=V,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[0],F=i[0],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[0]=a=A&65535|c<<16,i[0]=V=J&65535|X<<16,R=u,F=z,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[1],F=i[1],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[1]=u=A&65535|c<<16,i[1]=z=J&65535|X<<16,R=h,F=$,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[2],F=i[2],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[2]=h=A&65535|c<<16,i[2]=$=J&65535|X<<16,R=p,F=se,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[3],F=i[3],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[3]=p=A&65535|c<<16,i[3]=se=J&65535|X<<16,R=w,F=Y,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[4],F=i[4],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[4]=w=A&65535|c<<16,i[4]=Y=J&65535|X<<16,R=N,F=j,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[5],F=i[5],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[5]=N=A&65535|c<<16,i[5]=j=J&65535|X<<16,R=O,F=W,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[6],F=i[6],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[6]=O=A&65535|c<<16,i[6]=W=J&65535|X<<16,R=T,F=k,J=F&65535,X=F>>>16,A=R&65535,c=R>>>16,R=t[7],F=i[7],J+=F&65535,X+=F>>>16,A+=R&65535,c+=R>>>16,X+=J>>>16,A+=X>>>16,c+=A>>>16,t[7]=T=A&65535|c<<16,i[7]=k=J&65535|X<<16,s+=128,o-=128}return s}function AF(r){var e=new dS;e.update(r);var t=e.digest();return e.clean(),t}Zi.hash=AF});var TS=B(He=>{"use strict";f();Object.defineProperty(He,"__esModule",{value:!0});He.convertSecretKeyToX25519=He.convertPublicKeyToX25519=He.verify=He.sign=He.extractPublicKeyFromSecretKey=He.generateKeyPair=He.generateKeyPairFromSeed=He.SEED_LENGTH=He.SECRET_KEY_LENGTH=He.PUBLIC_KEY_LENGTH=He.SIGNATURE_LENGTH=void 0;var IF=Tc(),Nc=pS(),vS=qr();He.SIGNATURE_LENGTH=64;He.PUBLIC_KEY_LENGTH=32;He.SECRET_KEY_LENGTH=64;He.SEED_LENGTH=32;function ve(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,ES(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function AS(r,e){let t=0;for(let i=0;i<32;i++)t|=r[i]^e[i];return(1&t-1>>>8)-1}function mS(r,e){let t=new Uint8Array(32),i=new Uint8Array(32);return Dc(t,r),Dc(i,e),AS(t,i)}function IS(r){let e=new Uint8Array(32);return Dc(e,r),e[0]&1}function xF(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function Js(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function Zs(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function Ge(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Xs(r,e){Ge(r,e,e)}function _S(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=253;i>=0;i--)Xs(t,t),i!==2&&i!==4&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function TF(r,e){let t=ve(),i;for(i=0;i<16;i++)t[i]=e[i];for(i=250;i>=0;i--)Xs(t,t),i!==1&&Ge(t,t,e);for(i=0;i<16;i++)r[i]=t[i]}function tw(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve(),h=ve(),p=ve();Zs(t,r[1],r[0]),Zs(p,e[1],e[0]),Ge(t,t,p),Js(i,r[0],r[1]),Js(p,e[0],e[1]),Ge(i,i,p),Ge(n,r[3],e[3]),Ge(n,n,CF),Ge(s,r[2],e[2]),Js(s,s,s),Zs(o,i,t),Zs(a,s,n),Js(u,s,n),Js(h,i,t),Ge(r[0],o,a),Ge(r[1],h,u),Ge(r[2],u,a),Ge(r[3],o,h)}function wS(r,e,t){for(let i=0;i<4;i++)ES(r[i],e[i],t)}function iw(r,e){let t=ve(),i=ve(),n=ve();_S(n,e[2]),Ge(t,e[0],n),Ge(i,e[1],n),Dc(r,i),r[31]^=IS(t)<<7}function bS(r,e,t){Ln(r[0],ew),Ln(r[1],Xa),Ln(r[2],Xa),Ln(r[3],ew);for(let i=255;i>=0;--i){let n=t[i/8|0]>>(i&7)&1;wS(r,e,n),tw(e,r),tw(r,r),wS(r,e,n)}}function nw(r,e){let t=[ve(),ve(),ve(),ve()];Ln(t[0],gS),Ln(t[1],yS),Ln(t[2],Xa),Ge(t[3],gS,yS),bS(r,t,e)}function CS(r){if(r.length!==He.SEED_LENGTH)throw new Error(`ed25519: seed must be ${He.SEED_LENGTH} bytes`);let e=(0,Nc.hash)(r);e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(32),i=[ve(),ve(),ve(),ve()];nw(i,e),iw(t,i);let n=new Uint8Array(64);return n.set(r),n.set(t,32),{publicKey:t,secretKey:n}}He.generateKeyPairFromSeed=CS;function NF(r){let e=(0,IF.randomBytes)(32,r),t=CS(e);return(0,vS.wipe)(e),t}He.generateKeyPair=NF;function DF(r){if(r.length!==He.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${He.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(r.subarray(32))}He.extractPublicKeyFromSecretKey=DF;var Zm=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 SS(r,e){let t,i,n,s;for(i=63;i>=32;--i){for(t=0,n=i-32,s=i-12;n>4)*Zm[n],t=e[n]>>8,e[n]&=255;for(n=0;n<32;n++)e[n]-=t*Zm[n];for(i=0;i<32;i++)e[i+1]+=e[i]>>8,r[i]=e[i]&255}function rw(r){let e=new Float64Array(64);for(let t=0;t<64;t++)e[t]=r[t];for(let t=0;t<64;t++)r[t]=0;SS(r,e)}function OF(r,e){let t=new Float64Array(64),i=[ve(),ve(),ve(),ve()],n=(0,Nc.hash)(r.subarray(0,32));n[0]&=248,n[31]&=127,n[31]|=64;let s=new Uint8Array(64);s.set(n.subarray(32),32);let o=new Nc.SHA512;o.update(s.subarray(32)),o.update(e);let a=o.digest();o.clean(),rw(a),nw(i,a),iw(s,i),o.reset(),o.update(s.subarray(0,32)),o.update(r.subarray(32)),o.update(e);let u=o.digest();rw(u);for(let h=0;h<32;h++)t[h]=a[h];for(let h=0;h<32;h++)for(let p=0;p<32;p++)t[h+p]+=u[h]*n[p];return SS(s.subarray(32),t),s}He.sign=OF;function xS(r,e){let t=ve(),i=ve(),n=ve(),s=ve(),o=ve(),a=ve(),u=ve();return Ln(r[2],Xa),xF(r[1],e),Xs(n,r[1]),Ge(s,n,bF),Zs(n,n,r[2]),Js(s,r[2],s),Xs(o,s),Xs(a,o),Ge(u,a,o),Ge(t,u,n),Ge(t,t,s),TF(t,t),Ge(t,t,n),Ge(t,t,s),Ge(t,t,s),Ge(r[0],t,s),Xs(i,r[0]),Ge(i,i,s),mS(i,n)&&Ge(r[0],r[0],SF),Xs(i,r[0]),Ge(i,i,s),mS(i,n)?-1:(IS(r[0])===e[31]>>7&&Zs(r[0],ew,r[0]),Ge(r[3],r[0],r[1]),0)}function PF(r,e,t){let i=new Uint8Array(32),n=[ve(),ve(),ve(),ve()],s=[ve(),ve(),ve(),ve()];if(t.length!==He.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${He.SIGNATURE_LENGTH} bytes`);if(xS(s,r))return!1;let o=new Nc.SHA512;o.update(t.subarray(0,32)),o.update(r),o.update(e);let a=o.digest();return rw(a),bS(n,s,a),nw(s,t.subarray(32)),tw(n,s),iw(i,n),!AS(t,i)}He.verify=PF;function BF(r){let e=[ve(),ve(),ve(),ve()];if(xS(e,r))throw new Error("Ed25519: invalid public key");let t=ve(),i=ve(),n=e[1];Js(t,Xa,n),Zs(i,Xa,n),_S(i,i),Ge(t,t,i);let s=new Uint8Array(32);return Dc(s,t),s}He.convertPublicKeyToX25519=BF;function MF(r){let e=(0,Nc.hash)(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;let t=new Uint8Array(e.subarray(0,32));return(0,vS.wipe)(e),t}He.convertSecretKeyToX25519=MF});var Bh,Mh,eo,Za,Rh,Oc,Lh,Fh,Uh,eu,qh,Vh,NS,DS,Hh=me(()=>{f();Bh="EdDSA",Mh="JWT",eo=".",Za="base64url",Rh="utf8",Oc="utf8",Lh=":",Fh="did",Uh="key",eu="base58btc",qh="z",Vh="K36",NS=32,DS=32});function tu(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}var Qh=me(()=>{f()});function jh(r,e){e||(e=r.reduce((n,s)=>n+s.length,0));let t=tu(e),i=0;for(let n of r)t.set(n,i),i+=n.length;return t}var sw=me(()=>{f();Qh()});function RF(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var LF,FF,OS,PS=me(()=>{f();LF=RF,FF=LF,OS=FF});var iX,BS,en,MS,RS,Fn=me(()=>{f();iX=new Uint8Array(0),BS=(r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},MS=r=>new TextEncoder().encode(r),RS=r=>new TextDecoder().decode(r)});var ow,aw,uw,FS,cw,ru,Un,UF,qF,ut,Xr=me(()=>{f();PS();Fn();ow=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},aw=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 FS(this,e)}},uw=class{constructor(e){this.decoders=e}or(e){return FS(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},FS=(r,e)=>new uw({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),cw=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new ow(e,t,i),this.decoder=new aw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},ru=({name:r,prefix:e,encode:t,decode:i})=>new cw(r,e,t,i),Un=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=OS(t,e);return ru({prefix:r,name:e,encode:i,decode:s=>en(n(s))})},UF=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},qF=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<ru({prefix:e,name:r,encode(n){return qF(n,i,t)},decode(n){return UF(n,i,t,r)}})});var lw={};ot(lw,{identity:()=>VF});var VF,US=me(()=>{f();Xr();Fn();VF=ru({prefix:"\0",name:"identity",encode:r=>RS(r),decode:r=>MS(r)})});var fw={};ot(fw,{base2:()=>HF});var HF,qS=me(()=>{f();Xr();HF=ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var hw={};ot(hw,{base8:()=>QF});var QF,VS=me(()=>{f();Xr();QF=ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var dw={};ot(dw,{base10:()=>jF});var jF,HS=me(()=>{f();Xr();jF=Un({prefix:"9",name:"base10",alphabet:"0123456789"})});var pw={};ot(pw,{base16:()=>GF,base16upper:()=>KF});var GF,KF,QS=me(()=>{f();Xr();GF=ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),KF=ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var gw={};ot(gw,{base32:()=>iu,base32hex:()=>$F,base32hexpad:()=>JF,base32hexpadupper:()=>XF,base32hexupper:()=>YF,base32pad:()=>kF,base32padupper:()=>WF,base32upper:()=>zF,base32z:()=>ZF});var iu,zF,kF,WF,$F,YF,JF,XF,ZF,yw=me(()=>{f();Xr();iu=ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),zF=ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kF=ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),WF=ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),$F=ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),YF=ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),JF=ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),XF=ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ZF=ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var mw={};ot(mw,{base36:()=>e4,base36upper:()=>t4});var e4,t4,jS=me(()=>{f();Xr();e4=Un({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),t4=Un({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var ww={};ot(ww,{base58btc:()=>Ni,base58flickr:()=>r4});var Ni,r4,vw=me(()=>{f();Xr();Ni=Un({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),r4=Un({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Ew={};ot(Ew,{base64:()=>i4,base64pad:()=>n4,base64url:()=>s4,base64urlpad:()=>o4});var i4,n4,s4,o4,GS=me(()=>{f();Xr();i4=ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),n4=ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s4=ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),o4=ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Aw={};ot(Aw,{base256emoji:()=>f4});function c4(r){return r.reduce((e,t)=>(e+=a4[t],e),"")}function l4(r){let e=[];for(let t of r){let i=u4[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var KS,a4,u4,f4,zS=me(()=>{f();Xr();KS=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}"),a4=KS.reduce((r,e,t)=>(r[t]=e,r),[]),u4=KS.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);f4=ru({prefix:"\u{1F680}",name:"base256emoji",encode:c4,decode:l4})});function $S(r,e,t){e=e||[],t=t||0;for(var i=t;r>=g4;)e[t++]=r&255|kS,r/=128;for(;r&p4;)e[t++]=r&255|kS,r>>>=7;return e[t]=r|0,$S.bytes=t-i+1,e}function Iw(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw Iw.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WS)<=m4);return Iw.bytes=s-i,t}var h4,kS,d4,p4,g4,y4,m4,WS,w4,v4,E4,A4,I4,_4,b4,C4,S4,x4,T4,N4,Pc,YS=me(()=>{f();h4=$S,kS=128,d4=127,p4=~d4,g4=Math.pow(2,31);y4=Iw,m4=128,WS=127;w4=Math.pow(2,7),v4=Math.pow(2,14),E4=Math.pow(2,21),A4=Math.pow(2,28),I4=Math.pow(2,35),_4=Math.pow(2,42),b4=Math.pow(2,49),C4=Math.pow(2,56),S4=Math.pow(2,63),x4=function(r){return r{f();YS();Bc=(r,e=0)=>[Pc.decode(r,e),Pc.decode.bytes],nu=(r,e,t=0)=>(Pc.encode(r,e,t),e),su=r=>Pc.encodingLength(r)});var to,JS,XS,ou,Rc=me(()=>{f();Fn();Kh();to=(r,e)=>{let t=e.byteLength,i=su(r),n=i+su(t),s=new Uint8Array(n+t);return nu(r,s,0),nu(t,s,i),s.set(e,n),new ou(r,t,e,s)},JS=r=>{let e=en(r),[t,i]=Bc(e),[n,s]=Bc(e.subarray(i)),o=e.subarray(i+s);if(o.byteLength!==n)throw new Error("Incorrect length");return new ou(t,n,o,e)},XS=(r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&BS(r.bytes,e.bytes),ou=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}}});var bw,_w,Cw=me(()=>{f();Rc();bw=({name:r,code:e,encode:t})=>new _w(r,e,t),_w=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?to(this.code,t):t.then(i=>to(this.code,i))}else throw Error("Unknown type, must be binary type")}}});var Sw={};ot(Sw,{sha256:()=>D4,sha512:()=>O4});var ex,D4,O4,tx=me(()=>{f();Cw();ex=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),D4=bw({name:"sha2-256",code:18,encode:ex("SHA-256")}),O4=bw({name:"sha2-512",code:19,encode:ex("SHA-512")})});var xw={};ot(xw,{identity:()=>M4});var rx,P4,ix,B4,M4,nx=me(()=>{f();Fn();Rc();rx=0,P4="identity",ix=en,B4=r=>to(rx,ix(r)),M4={code:rx,name:P4,encode:ix,digest:B4}});var sx=me(()=>{f();Fn()});var jX,GX,ox=me(()=>{f();jX=new TextEncoder,GX=new TextDecoder});var Vt,F4,U4,q4,Lc,V4,ax,ux,zh,kh,H4,Q4,j4,cx=me(()=>{f();Kh();Rc();vw();yw();Fn();Vt=class{constructor(e,t,i,n){this.code=t,this.version=e,this.multihash=i,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:kh,byteLength:kh,code:zh,version:zh,multihash:zh,bytes:zh,_baseCache:kh,asCID:kh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Lc)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==V4)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Vt.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,i=to(e,t);return Vt.createV1(this.code,i)}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&&XS(this.multihash,e.multihash)}toString(e){let{bytes:t,version:i,_baseCache:n}=this;switch(i){case 0:return U4(t,n,e||Ni.encoder);default:return q4(t,n,e||iu.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 Q4(/^0\.0/,j4),!!(e&&(e[ux]||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 Vt)return e;if(e!=null&&e.asCID===e){let{version:t,code:i,multihash:n,bytes:s}=e;return new Vt(t,i,n,s||ax(t,i,n.bytes))}else if(e!=null&&e[ux]===!0){let{version:t,multihash:i,code:n}=e,s=JS(i);return Vt.create(t,n,s)}else return null}static create(e,t,i){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Lc)throw new Error(`Version 0 CID must use dag-pb (code: ${Lc}) block encoding`);return new Vt(e,t,i,i.bytes)}case 1:{let n=ax(e,t,i.bytes);return new Vt(e,t,i,n)}default:throw new Error("Invalid version")}}static createV0(e){return Vt.create(0,Lc,e)}static createV1(e,t){return Vt.create(1,e,t)}static decode(e){let[t,i]=Vt.decodeFirst(e);if(i.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Vt.inspectBytes(e),i=t.size-t.multihashSize,n=en(e.subarray(i,i+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=n.subarray(t.multihashSize-t.digestSize),o=new ou(t.multihashCode,t.digestSize,s,n);return[t.version===0?Vt.createV0(o):Vt.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,i=()=>{let[w,N]=Bc(e.subarray(t));return t+=N,w},n=i(),s=Lc;if(n===18?(n=0,t=0):n===1&&(s=i()),n!==0&&n!==1)throw new RangeError(`Invalid CID version ${n}`);let o=t,a=i(),u=i(),h=t+u,p=h-o;return{version:n,codec:s,multihashCode:a,digestSize:u,multihashSize:p,size:h}}static parse(e,t){let[i,n]=F4(e,t),s=Vt.decode(n);return s._baseCache.set(i,e),s}},F4=(r,e)=>{switch(r[0]){case"Q":{let t=e||Ni;return[Ni.prefix,t.decode(`${Ni.prefix}${r}`)]}case Ni.prefix:{let t=e||Ni;return[Ni.prefix,t.decode(r)]}case iu.prefix:{let t=e||iu;return[iu.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},U4=(r,e,t)=>{let{prefix:i}=t;if(i!==Ni.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let n=e.get(i);if(n==null){let s=t.encode(r).slice(1);return e.set(i,s),s}else return n},q4=(r,e,t)=>{let{prefix:i}=t,n=e.get(i);if(n==null){let s=t.encode(r);return e.set(i,s),s}else return n},Lc=112,V4=18,ax=(r,e,t)=>{let i=su(r),n=i+su(e),s=new Uint8Array(n+t.byteLength);return nu(r,s,0),nu(e,s,i),s.set(t,n),s},ux=Symbol.for("@ipld/js-cid/CID"),zh={writable:!1,configurable:!1,enumerable:!0},kh={writable:!1,enumerable:!1,configurable:!1},H4="0.0.0-dev",Q4=(r,e)=>{if(r.test(H4))console.warn(e);else throw new Error(e)},j4=`CID.isCID(v) is deprecated and will be removed in the next major release. Following code pattern: if (CID.isCID(value)) { @@ -20,20 +20,20 @@ if (cid) { // Make sure to use cid instead of value doSomethingWithCID(cid) } -`});var lx=me(()=>{f();cx();Kh();Ln();Cw();Rc()});var Tw,eZ,fx=me(()=>{f();US();qS();VS();HS();QS();yw();jS();vw();GS();zS();tx();nx();sx();ox();lx();Tw={...lw,...fw,...hw,...dw,...pw,...gw,...mw,...ww,...Ew,...Aw},eZ={...Sw,...xw}});function dx(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var hx,Nw,j4,Wh,Dw=me(()=>{f();fx();Qh();hx=dx("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Nw=dx("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=eu(r.length);for(let t=0;t{f();Dw()});function Di(r,e="utf8"){let t=Wh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}var Pw=me(()=>{f();Dw()});function Fc(r){return Sc(en(Di(r,Xa),Rh))}function Uc(r){return en(Di(xc(r),Rh),Xa)}function Bw(r){let e=Di(Vh,Za),t=qh+en(jh([e,r]),Za);return[Fh,Uh,t].join(Lh)}function Mw(r){let[e,t,i]=r.split(Lh);if(e!==Fh||t!==Uh)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==qh)throw new Error("Issuer must be a key in mulicodec format");let s=Di(i.slice(1),Za);if(en(s.slice(0,2),Za)!==Vh)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 px(r){return en(r,Xa)}function gx(r){return Di(r,Xa)}function Rw(r){return Di([Uc(r.header),Uc(r.payload)].join(eo),Oc)}function G4(r){let e=en(r,Oc).split(eo),t=Fc(e[0]),i=Fc(e[1]);return{header:t,payload:i}}function Lw(r){return[Uc(r.header),Uc(r.payload),px(r.signature)].join(eo)}function Fw(r){let e=r.split(eo),t=Fc(e[0]),i=Fc(e[1]),n=gx(e[2]),s=Di(e.slice(0,2).join(eo),Oc);return{header:t,payload:i,signature:n,data:s}}var Uw=me(()=>{f();sw();Ow();Pw();xh();Hh()});function K4(r=(0,yx.randomBytes)(32)){return ou.generateKeyPairFromSeed(r)}async function z4(r,e,t,i,n=(0,mx.fromMiliseconds)(Date.now())){let s={alg:Bh,typ:Mh},o=Bw(i.publicKey),a=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:a},h=Rw({header:s,payload:u}),p=ou.sign(i.secretKey,h);return Lw({header:s,payload:u,signature:p})}async function k4(r){let{header:e,payload:t,data:i,signature:n}=Fw(r);if(e.alg!==Bh||e.typ!==Mh)throw new Error("JWT must use EdDSA algorithm");let s=Mw(t.iss);return ou.verify(s,i,n)}var ou,yx,mx,wx=me(()=>{f();ou=_e(TS()),yx=_e(Tc()),mx=_e(Ys());Hh();Uw()});var vx=me(()=>{f()});var Ex={};ot(Ex,{DATA_ENCODING:()=>Oc,DID_DELIMITER:()=>Lh,DID_METHOD:()=>Uh,DID_PREFIX:()=>Fh,JSON_ENCODING:()=>Rh,JWT_DELIMITER:()=>eo,JWT_ENCODING:()=>Xa,JWT_IRIDIUM_ALG:()=>Bh,JWT_IRIDIUM_TYP:()=>Mh,KEY_PAIR_SEED_LENGTH:()=>DS,MULTICODEC_ED25519_BASE:()=>qh,MULTICODEC_ED25519_ENCODING:()=>Za,MULTICODEC_ED25519_HEADER:()=>Vh,MULTICODEC_ED25519_LENGTH:()=>NS,decodeData:()=>G4,decodeIss:()=>Mw,decodeJSON:()=>Fc,decodeJWT:()=>Fw,decodeSig:()=>gx,encodeData:()=>Rw,encodeIss:()=>Bw,encodeJSON:()=>Uc,encodeJWT:()=>Lw,encodeSig:()=>px,generateKeyPair:()=>K4,signJWT:()=>z4,verifyJWT:()=>k4});var Ax=me(()=>{f();wx();Hh();vx();Uw()});var _x=B($h=>{"use strict";f();Object.defineProperty($h,"__esModule",{value:!0});var cr=Wa(),qw=qr(),W4=20;function $4(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],N=t[23]<<24|t[22]<<16|t[21]<<8|t[20],O=t[27]<<24|t[26]<<16|t[25]<<8|t[24],T=t[31]<<24|t[30]<<16|t[29]<<8|t[28],V=e[3]<<24|e[2]<<16|e[1]<<8|e[0],z=e[7]<<24|e[6]<<16|e[5]<<8|e[4],$=e[11]<<24|e[10]<<16|e[9]<<8|e[8],se=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,j=n,W=s,k=o,R=a,F=u,G=h,ce=p,J=w,X=N,A=O,c=T,d=V,g=z,m=$,v=se,S=0;S>>32-16|d<<16,J=J+d|0,R^=J,R=R>>>32-12|R<<12,j=j+F|0,g^=j,g=g>>>32-16|g<<16,X=X+g|0,F^=X,F=F>>>32-12|F<<12,W=W+G|0,m^=W,m=m>>>32-16|m<<16,A=A+m|0,G^=A,G=G>>>32-12|G<<12,k=k+ce|0,v^=k,v=v>>>32-16|v<<16,c=c+v|0,ce^=c,ce=ce>>>32-12|ce<<12,W=W+G|0,m^=W,m=m>>>32-8|m<<8,A=A+m|0,G^=A,G=G>>>32-7|G<<7,k=k+ce|0,v^=k,v=v>>>32-8|v<<8,c=c+v|0,ce^=c,ce=ce>>>32-7|ce<<7,j=j+F|0,g^=j,g=g>>>32-8|g<<8,X=X+g|0,F^=X,F=F>>>32-7|F<<7,Y=Y+R|0,d^=Y,d=d>>>32-8|d<<8,J=J+d|0,R^=J,R=R>>>32-7|R<<7,Y=Y+F|0,v^=Y,v=v>>>32-16|v<<16,A=A+v|0,F^=A,F=F>>>32-12|F<<12,j=j+G|0,d^=j,d=d>>>32-16|d<<16,c=c+d|0,G^=c,G=G>>>32-12|G<<12,W=W+ce|0,g^=W,g=g>>>32-16|g<<16,J=J+g|0,ce^=J,ce=ce>>>32-12|ce<<12,k=k+R|0,m^=k,m=m>>>32-16|m<<16,X=X+m|0,R^=X,R=R>>>32-12|R<<12,W=W+ce|0,g^=W,g=g>>>32-8|g<<8,J=J+g|0,ce^=J,ce=ce>>>32-7|ce<<7,k=k+R|0,m^=k,m=m>>>32-8|m<<8,X=X+m|0,R^=X,R=R>>>32-7|R<<7,j=j+G|0,d^=j,d=d>>>32-8|d<<8,c=c+d|0,G^=c,G=G>>>32-7|G<<7,Y=Y+F|0,v^=Y,v=v>>>32-8|v<<8,A=A+v|0,F^=A,F=F>>>32-7|F<<7;cr.writeUint32LE(Y+i|0,r,0),cr.writeUint32LE(j+n|0,r,4),cr.writeUint32LE(W+s|0,r,8),cr.writeUint32LE(k+o|0,r,12),cr.writeUint32LE(R+a|0,r,16),cr.writeUint32LE(F+u|0,r,20),cr.writeUint32LE(G+h|0,r,24),cr.writeUint32LE(ce+p|0,r,28),cr.writeUint32LE(J+w|0,r,32),cr.writeUint32LE(X+N|0,r,36),cr.writeUint32LE(A+O|0,r,40),cr.writeUint32LE(c+T|0,r,44),cr.writeUint32LE(d+V|0,r,48),cr.writeUint32LE(g+z|0,r,52),cr.writeUint32LE(m+$|0,r,56),cr.writeUint32LE(v+se|0,r,60)}function Ix(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var Yh=B(au=>{"use strict";f();Object.defineProperty(au,"__esModule",{value:!0});function X4(r,e,t){return~(r-1)&e|r-1&t}au.select=X4;function Z4(r,e){return(r|0)-(e|0)-1>>>31&1}au.lessOrEqual=Z4;function bx(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}au.compare=bx;function eU(r,e){return r.length===0||e.length===0?!1:bx(r,e)!==0}au.equal=eU});var Sx=B(tn=>{"use strict";f();Object.defineProperty(tn,"__esModule",{value:!0});var tU=Yh(),Jh=qr();tn.DIGEST_LENGTH=16;var Cx=function(){function r(e){this.digestLength=tn.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 t=e[0]|e[1]<<8;this._r[0]=t&8191;var i=e[2]|e[3]<<8;this._r[1]=(t>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>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 h=e[14]|e[15]<<8;this._r[8]=(u>>>8|h<<8)&8191,this._r[9]=h>>>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 r.prototype._blocks=function(e,t,i){for(var n=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],h=this._h[4],p=this._h[5],w=this._h[6],N=this._h[7],O=this._h[8],T=this._h[9],V=this._r[0],z=this._r[1],$=this._r[2],se=this._r[3],Y=this._r[4],j=this._r[5],W=this._r[6],k=this._r[7],R=this._r[8],F=this._r[9];i>=16;){var G=e[t+0]|e[t+1]<<8;s+=G&8191;var ce=e[t+2]|e[t+3]<<8;o+=(G>>>13|ce<<3)&8191;var J=e[t+4]|e[t+5]<<8;a+=(ce>>>10|J<<6)&8191;var X=e[t+6]|e[t+7]<<8;u+=(J>>>7|X<<9)&8191;var A=e[t+8]|e[t+9]<<8;h+=(X>>>4|A<<12)&8191,p+=A>>>1&8191;var c=e[t+10]|e[t+11]<<8;w+=(A>>>14|c<<2)&8191;var d=e[t+12]|e[t+13]<<8;N+=(c>>>11|d<<5)&8191;var g=e[t+14]|e[t+15]<<8;O+=(d>>>8|g<<8)&8191,T+=g>>>5|n;var m=0,v=m;v+=s*V,v+=o*(5*F),v+=a*(5*R),v+=u*(5*k),v+=h*(5*W),m=v>>>13,v&=8191,v+=p*(5*j),v+=w*(5*Y),v+=N*(5*se),v+=O*(5*$),v+=T*(5*z),m+=v>>>13,v&=8191;var S=m;S+=s*z,S+=o*V,S+=a*(5*F),S+=u*(5*R),S+=h*(5*k),m=S>>>13,S&=8191,S+=p*(5*W),S+=w*(5*j),S+=N*(5*Y),S+=O*(5*se),S+=T*(5*$),m+=S>>>13,S&=8191;var D=m;D+=s*$,D+=o*z,D+=a*V,D+=u*(5*F),D+=h*(5*R),m=D>>>13,D&=8191,D+=p*(5*k),D+=w*(5*W),D+=N*(5*j),D+=O*(5*Y),D+=T*(5*se),m+=D>>>13,D&=8191;var I=m;I+=s*se,I+=o*$,I+=a*z,I+=u*V,I+=h*(5*F),m=I>>>13,I&=8191,I+=p*(5*R),I+=w*(5*k),I+=N*(5*W),I+=O*(5*j),I+=T*(5*Y),m+=I>>>13,I&=8191;var l=m;l+=s*Y,l+=o*se,l+=a*$,l+=u*z,l+=h*V,m=l>>>13,l&=8191,l+=p*(5*F),l+=w*(5*R),l+=N*(5*k),l+=O*(5*W),l+=T*(5*j),m+=l>>>13,l&=8191;var C=m;C+=s*j,C+=o*Y,C+=a*se,C+=u*$,C+=h*z,m=C>>>13,C&=8191,C+=p*V,C+=w*(5*F),C+=N*(5*R),C+=O*(5*k),C+=T*(5*W),m+=C>>>13,C&=8191;var Z=m;Z+=s*W,Z+=o*j,Z+=a*Y,Z+=u*se,Z+=h*$,m=Z>>>13,Z&=8191,Z+=p*z,Z+=w*V,Z+=N*(5*F),Z+=O*(5*R),Z+=T*(5*k),m+=Z>>>13,Z&=8191;var ie=m;ie+=s*k,ie+=o*W,ie+=a*j,ie+=u*Y,ie+=h*se,m=ie>>>13,ie&=8191,ie+=p*$,ie+=w*z,ie+=N*V,ie+=O*(5*F),ie+=T*(5*R),m+=ie>>>13,ie&=8191;var ee=m;ee+=s*R,ee+=o*k,ee+=a*W,ee+=u*j,ee+=h*Y,m=ee>>>13,ee&=8191,ee+=p*se,ee+=w*$,ee+=N*z,ee+=O*V,ee+=T*(5*F),m+=ee>>>13,ee&=8191;var ae=m;ae+=s*F,ae+=o*R,ae+=a*k,ae+=u*W,ae+=h*j,m=ae>>>13,ae&=8191,ae+=p*Y,ae+=w*se,ae+=N*$,ae+=O*z,ae+=T*V,m+=ae>>>13,ae&=8191,m=(m<<2)+m|0,m=m+v|0,v=m&8191,m=m>>>13,S+=m,s=v,o=S,a=D,u=I,h=l,p=C,w=Z,N=ie,O=ee,T=ae,t+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=h,this._h[5]=p,this._h[6]=w,this._h[7]=N,this._h[8]=O,this._h[9]=T},r.prototype.finish=function(e,t){t===void 0&&(t=0);var i=new Uint16Array(10),n,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(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[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[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s=16&&(n=i-i%16,this._blocks(e,t,n),t+=n,i-=n),i){for(var s=0;s{"use strict";f();Object.defineProperty(rn,"__esModule",{value:!0});var Xh=_x(),nU=Sx(),qc=qr(),xx=Wa(),sU=Yh();rn.KEY_LENGTH=32;rn.NONCE_LENGTH=12;rn.TAG_LENGTH=16;var Tx=new Uint8Array(16),oU=function(){function r(e){if(this.nonceLength=rn.NONCE_LENGTH,this.tagLength=rn.TAG_LENGTH,e.length!==rn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return r.prototype.seal=function(e,t,i,n){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);Xh.stream(this._key,s,o,4);var a=t.length+this.tagLength,u;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(a);return Xh.streamXOR(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),i),qc.wipe(s),u},r.prototype.open=function(e,t,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(Tx.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(Tx.subarray(i.length%16));var o=new Uint8Array(8);n&&xx.writeUint64LE(n.length,o),s.update(o),xx.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";f();Object.defineProperty(Vw,"__esModule",{value:!0});function aU(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Vw.isSerializableHash=aU});var Px=B(Vc=>{"use strict";f();Object.defineProperty(Vc,"__esModule",{value:!0});var Oi=Dx(),uU=Yh(),cU=qr(),Ox=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n{"use strict";f();Object.defineProperty(Hw,"__esModule",{value:!0});var Bx=Px(),Mx=qr(),fU=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Bx.hmac(this._hash,i,t);this._hmac=new Bx.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i{"use strict";f();Object.defineProperty(Un,"__esModule",{value:!0});var ed=Wa(),Zh=qr();Un.DIGEST_LENGTH=32;Un.BLOCK_SIZE=64;var Lx=function(){function r(){this.digestLength=Un.DIGEST_LENGTH,this.blockSize=Un.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Zh.wipe(this._buffer),Zh.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Qw(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Qw(this._temp,this._state,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Zh.wipe(e.state),e.buffer&&Zh.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();Un.SHA256=Lx;var hU=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 Qw(r,e,t,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],h=e[4],p=e[5],w=e[6],N=e[7],O=0;O<16;O++){var T=i+O*4;r[O]=ed.readUint32BE(t,T)}for(var O=16;O<64;O++){var V=r[O-2],z=(V>>>17|V<<32-17)^(V>>>19|V<<32-19)^V>>>10;V=r[O-15];var $=(V>>>7|V<<32-7)^(V>>>18|V<<32-18)^V>>>3;r[O]=(z+r[O-7]|0)+($+r[O-16]|0)}for(var O=0;O<64;O++){var z=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&p^~h&w)|0)+(N+(hU[O]+r[O]|0)|0)|0,$=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;N=w,w=p,p=h,h=u+z|0,u=a,a=o,o=s,s=z+$|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=h,e[5]+=p,e[6]+=w,e[7]+=N,i+=64,n-=64}return i}function dU(r){var e=new Lx;e.update(r);var t=e.digest();return e.clean(),t}Un.hash=dU});var Hx=B(ct=>{"use strict";f();Object.defineProperty(ct,"__esModule",{value:!0});ct.sharedKey=ct.generateKeyPair=ct.generateKeyPairFromSeed=ct.scalarMultBase=ct.scalarMult=ct.SHARED_KEY_LENGTH=ct.SECRET_KEY_LENGTH=ct.PUBLIC_KEY_LENGTH=void 0;var pU=Tc(),gU=qr();ct.PUBLIC_KEY_LENGTH=32;ct.SECRET_KEY_LENGTH=32;ct.SHARED_KEY_LENGTH=32;function Pi(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,Hc(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function wU(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function td(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function rd(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function nn(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Qc(r,e){nn(r,e,e)}function vU(r,e){let t=Pi();for(let i=0;i<16;i++)t[i]=e[i];for(let i=253;i>=0;i--)Qc(t,t),i!==2&&i!==4&&nn(t,t,e);for(let i=0;i<16;i++)r[i]=t[i]}function Gw(r,e){let t=new Uint8Array(32),i=new Float64Array(80),n=Pi(),s=Pi(),o=Pi(),a=Pi(),u=Pi(),h=Pi();for(let O=0;O<31;O++)t[O]=r[O];t[31]=r[31]&127|64,t[0]&=248,wU(i,e);for(let O=0;O<16;O++)s[O]=i[O];n[0]=a[0]=1;for(let O=254;O>=0;--O){let T=t[O>>>3]>>>(O&7)&1;Hc(n,s,T),Hc(o,a,T),td(u,n,o),rd(n,n,o),td(o,s,a),rd(s,s,a),Qc(a,u),Qc(h,n),nn(n,o,n),nn(o,s,u),td(u,n,o),rd(n,n,o),Qc(s,n),rd(o,a,h),nn(n,o,yU),td(n,n,a),nn(o,o,n),nn(n,a,h),nn(a,s,i),Qc(s,u),Hc(n,s,T),Hc(o,a,T)}for(let O=0;O<16;O++)i[O+16]=n[O],i[O+32]=o[O],i[O+48]=s[O],i[O+64]=a[O];let p=i.subarray(32),w=i.subarray(16);vU(p,p),nn(w,w,p);let N=new Uint8Array(32);return mU(N,w),N}ct.scalarMult=Gw;function qx(r){return Gw(r,Ux)}ct.scalarMultBase=qx;function Vx(r){if(r.length!==ct.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${ct.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(r);return{publicKey:qx(e),secretKey:e}}ct.generateKeyPairFromSeed=Vx;function EU(r){let e=(0,pU.randomBytes)(32,r),t=Vx(e);return(0,gU.wipe)(e),t}ct.generateKeyPair=EU;function AU(r,e,t=!1){if(r.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let i=Gw(r,e);if(t){let n=0;for(let s=0;se[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength{f()});function Gx(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{f()});function zx(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=eu(r.length);for(let i=0;i{f();Qh()});var Wx={};ot(Wx,{compare:()=>Qx,concat:()=>jh,equals:()=>Gx,fromString:()=>Di,toString:()=>en,xor:()=>zx});var $x=me(()=>{f();jx();sw();Kx();Pw();Ow();kx()});var a2=B(it=>{"use strict";f();var Yx=it&&it.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new i2:typeof navigator<"u"?Kw(navigator.userAgent):o2()}it.detect=CU;function n2(r){return r!==""&&bU.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function SU(r){var e=n2(r);return e?e[0]:null}it.browserName=SU;function Kw(r){var e=n2(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new r2;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length{"use strict";f();Object.defineProperty(We,"__esModule",{value:!0});We.getLocalStorage=We.getLocalStorageOrThrow=We.getCrypto=We.getCryptoOrThrow=We.getLocation=We.getLocationOrThrow=We.getNavigator=We.getNavigatorOrThrow=We.getDocument=We.getDocumentOrThrow=We.getFromWindowOrThrow=We.getFromWindow=void 0;function ro(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}We.getFromWindow=ro;function uu(r){let e=ro(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}We.getFromWindowOrThrow=uu;function TU(){return uu("document")}We.getDocumentOrThrow=TU;function NU(){return ro("document")}We.getDocument=NU;function DU(){return uu("navigator")}We.getNavigatorOrThrow=DU;function OU(){return ro("navigator")}We.getNavigator=OU;function PU(){return uu("location")}We.getLocationOrThrow=PU;function BU(){return ro("location")}We.getLocation=BU;function MU(){return uu("crypto")}We.getCryptoOrThrow=MU;function RU(){return ro("crypto")}We.getCrypto=RU;function LU(){return uu("localStorage")}We.getLocalStorageOrThrow=LU;function FU(){return ro("localStorage")}We.getLocalStorage=FU});var c2=B(id=>{"use strict";f();Object.defineProperty(id,"__esModule",{value:!0});id.getWindowMetadata=void 0;var u2=zw();function UU(){let r,e;try{r=u2.getDocumentOrThrow(),e=u2.getLocationOrThrow()}catch{return null}function t(){let w=r.getElementsByTagName("link"),N=[];for(let O=0;O-1){let z=T.getAttribute("href");if(z)if(z.toLowerCase().indexOf("https:")===-1&&z.toLowerCase().indexOf("http:")===-1&&z.indexOf("//")!==0){let $=e.protocol+"//"+e.host;if(z.indexOf("/")===0)$+=z;else{let se=e.pathname.split("/");se.pop();let Y=se.join("/");$+=Y+"/"+z}N.push($)}else if(z.indexOf("//")===0){let $=e.protocol+z;N.push($)}else N.push(z)}}return N}function i(...w){let N=r.getElementsByTagName("meta");for(let O=0;OT.getAttribute(z)).filter(z=>z?w.includes(z):!1);if(V.length&&V){let z=T.getAttribute("content");if(z)return z}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}let o=n(),a=s(),u=e.origin,h=t();return{description:a,url:u,icons:h,name:o}}id.getWindowMetadata=UU});var f2=B((pee,l2)=>{"use strict";f();l2.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var y2=B((yee,g2)=>{"use strict";f();var p2="%[a-f0-9]{2}",h2=new RegExp("("+p2+")|([^%]+?)","gi"),d2=new RegExp("("+p2+")+","gi");function kw(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],kw(t),kw(i))}function qU(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(h2)||[],t=1;t{"use strict";f();m2.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var E2=B((Eee,v2)=>{"use strict";f();v2.exports=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s{"use strict";f();var HU=f2(),QU=y2(),I2=w2(),jU=E2(),GU=r=>r==null,Ww=Symbol("encodeFragmentIdentifier");function KU(r){switch(r.arrayFormat){case"index":return e=>(t,i)=>{let n=t.length;return i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[",n,"]"].join("")]:[...t,[yt(e,r),"[",yt(n,r),"]=",yt(i,r)].join("")]};case"bracket":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[]"].join("")]:[...t,[yt(e,r),"[]=",yt(i,r)].join("")];case"colon-list-separator":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),":list="].join("")]:[...t,[yt(e,r),":list=",yt(i,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(i,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?i:(n=n===null?"":n,i.length===0?[[yt(t,r),e,yt(n,r)].join("")]:[[i,yt(n,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,yt(e,r)]:[...t,[yt(e,r),"=",yt(i,r)].join("")]}}function zU(r){let e;switch(r.arrayFormat){case"index":return(t,i,n)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){n[t]=i;return}n[t]===void 0&&(n[t]={}),n[t][e[1]]=i};case"bracket":return(t,i,n)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"colon-list-separator":return(t,i,n)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"comma":case"separator":return(t,i,n)=>{let s=typeof i=="string"&&i.includes(r.arrayFormatSeparator),o=typeof i=="string"&&!s&&sn(i,r).includes(r.arrayFormatSeparator);i=o?sn(i,r):i;let a=s||o?i.split(r.arrayFormatSeparator).map(u=>sn(u,r)):i===null?i:sn(i,r);n[t]=a};case"bracket-separator":return(t,i,n)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){n[t]=i&&sn(i,r);return}let o=i===null?[]:i.split(r.arrayFormatSeparator).map(a=>sn(a,r));if(n[t]===void 0){n[t]=o;return}n[t]=[].concat(n[t],o)};default:return(t,i,n)=>{if(n[t]===void 0){n[t]=i;return}n[t]=[].concat(n[t],i)}}}function _2(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function yt(r,e){return e.encode?e.strict?HU(r):encodeURIComponent(r):r}function sn(r,e){return e.decode?QU(r):r}function b2(r){return Array.isArray(r)?r.sort():typeof r=="object"?b2(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function C2(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function kU(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function S2(r){r=C2(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function A2(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function x2(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),_2(e.arrayFormatSeparator);let t=zU(e),i=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return i;for(let n of r.split("&")){if(n==="")continue;let[s,o]=I2(e.decode?n.replace(/\+/g," "):n,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:sn(o,e),t(sn(s,e),o,i)}for(let n of Object.keys(i)){let s=i[n];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=A2(s[o],e);else i[n]=A2(s,e)}return e.sort===!1?i:(e.sort===!0?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((n,s)=>{let o=i[s];return Boolean(o)&&typeof o=="object"&&!Array.isArray(o)?n[s]=b2(o):n[s]=o,n},Object.create(null))}Er.extract=S2;Er.parse=x2;Er.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),_2(e.arrayFormatSeparator);let t=o=>e.skipNull&&GU(r[o])||e.skipEmptyString&&r[o]==="",i=KU(e),n={};for(let o of Object.keys(r))t(o)||(n[o]=r[o]);let s=Object.keys(n);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=r[o];return a===void 0?"":a===null?yt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?yt(o,e)+"[]":a.reduce(i(o),[]).join("&"):yt(o,e)+"="+yt(a,e)}).filter(o=>o.length>0).join("&")};Er.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,i]=I2(r,"#");return Object.assign({url:t.split("?")[0]||"",query:x2(S2(r),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:sn(i,e)}:{})};Er.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[Ww]:!0},e);let t=C2(r.url).split("?")[0]||"",i=Er.extract(r.url),n=Er.parse(i,{sort:!1}),s=Object.assign(n,r.query),o=Er.stringify(s,e);o&&(o=`?${o}`);let a=kU(r.url);return r.fragmentIdentifier&&(a=`#${e[Ww]?yt(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${o}${a}`};Er.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[Ww]:!1},t);let{url:i,query:n,fragmentIdentifier:s}=Er.parseUrl(r,t);return Er.stringifyUrl({url:i,query:jU(n,e),fragmentIdentifier:s},t)};Er.exclude=(r,e,t)=>{let i=Array.isArray(e)?n=>!e.includes(n):(n,s)=>!e(n,s);return Er.pick(r,i,t)}});var N2=me(()=>{f()});function qn(r,e,t="string"){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function WU(r,e){let t=!0;return e.forEach(i=>{i in r||(t=!1)}),t}function $U(r,e){return Array.isArray(r)?r.length===e:Object.keys(r).length===e}function YU(r,e){return Array.isArray(r)?r.length>=e:Object.keys(r).length>=e}function jc(r,e,t){return(!t.length?$U(r,e.length):YU(r,e.length))?WU(r,e):!1}function Gc(r,e,t="_"){let i=r.split(t);return i[i.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var $w=me(()=>{f()});function JU(r){return nd(r.method)&&sd(r.params)}function nd(r){return Gc(r,"subscribe")}function sd(r){return jc(r,["topic"],[])}function XU(r){return od(r.method)&&ad(r.params)}function od(r){return Gc(r,"publish")}function ad(r){return jc(r,["message","topic","ttl"],["prompt","tag"])}function ZU(r){return ud(r.method)&&cd(r.params)}function ud(r){return Gc(r,"unsubscribe")}function cd(r){return jc(r,["id","topic"],[])}function eq(r){return ld(r.method)&&fd(r.params)}function ld(r){return Gc(r,"subscription")}function fd(r){return jc(r,["id","data"],[])}var Yw=me(()=>{f();$w()});function tq(r){if(!nd(r.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!sd(r.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=r.params;return qn(e,"topic"),e}function rq(r){if(!od(r.method))throw new Error("JSON-RPC Request has invalid publish method");if(!ad(r.params))throw new Error("JSON-RPC Request has invalid publish params");let e=r.params;return qn(e,"topic"),qn(e,"message"),qn(e,"ttl","number"),e}function iq(r){if(!ud(r.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!cd(r.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=r.params;return qn(e,"id"),e}function nq(r){if(!ld(r.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!fd(r.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=r.params;return qn(e,"id"),qn(e,"data"),e}var D2=me(()=>{f();$w();Yw()});var sq,O2=me(()=>{f();sq={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 P2={};ot(P2,{RELAY_JSONRPC:()=>sq,isPublishMethod:()=>od,isPublishParams:()=>ad,isPublishRequest:()=>XU,isSubscribeMethod:()=>nd,isSubscribeParams:()=>sd,isSubscribeRequest:()=>JU,isSubscriptionMethod:()=>ld,isSubscriptionParams:()=>fd,isSubscriptionRequest:()=>eq,isUnsubscribeMethod:()=>ud,isUnsubscribeParams:()=>cd,isUnsubscribeRequest:()=>ZU,parsePublishRequest:()=>rq,parseSubscribeRequest:()=>tq,parseSubscriptionRequest:()=>nq,parseUnsubscribeRequest:()=>iq});var B2=me(()=>{f();N2();D2();O2();Yw()});var Ed=B(re=>{"use strict";f();Object.defineProperty(re,"__esModule",{value:!0});var V2=Nx(),oq=Rx(),H2=Tc(),Zw=Fx(),aq=Hx(),nt=($x(),at(Wx)),uq=a2(),Kc=Ys(),zc=zw(),cq=c2(),lq=T2(),fq=(B2(),at(P2));function Q2(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var j2=Q2(aq),hd=Q2(lq),gd=":";function G2(r){let[e,t]=r.split(gd);return{namespace:e,reference:t}}function K2(r){let{namespace:e,reference:t}=r;return[e,t].join(gd)}function e1(r){let[e,t,i]=r.split(gd);return{namespace:e,reference:t,address:i}}function z2(r){let{namespace:e,reference:t,address:i}=r;return[e,t,i].join(gd)}function t1(r,e){let t=[];return r.forEach(i=>{let n=e(i);t.includes(n)||t.push(n)}),t}function k2(r){let{address:e}=e1(r);return e}function W2(r){let{namespace:e,reference:t}=e1(r);return K2({namespace:e,reference:t})}function hq(r,e){let{namespace:t,reference:i}=G2(e);return z2({namespace:t,reference:i,address:r})}function dq(r){return t1(r,k2)}function $2(r){return t1(r,W2)}function pq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.accounts)}),t}function gq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...$2(n.accounts))}),t}function yq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...kc(i,n))}),t}function kc(r,e){return r.includes(":")?[r]:e.chains||[]}var yd=r=>r?.split(":"),Y2=r=>{let e=r&&yd(r);if(e)return e[3]},mq=r=>{let e=r&&yd(r);if(e)return e[2]+":"+e[3]},J2=r=>{let e=r&&yd(r);if(e)return e.pop()},wq=(r,e)=>{let t=`${r.domain} wants you to sign in with your Ethereum account:`,i=J2(e),n=r.statement,s=`URI: ${r.aud}`,o=`Version: ${r.version}`,a=`Chain ID: ${Y2(e)}`,u=`Nonce: ${r.nonce}`,h=`Issued At: ${r.iat}`,p=r.resources&&r.resources.length>0?`Resources: +`});var lx=me(()=>{f();cx();Kh();Fn();Cw();Rc()});var Tw,tZ,fx=me(()=>{f();US();qS();VS();HS();QS();yw();jS();vw();GS();zS();tx();nx();sx();ox();lx();Tw={...lw,...fw,...hw,...dw,...pw,...gw,...mw,...ww,...Ew,...Aw},tZ={...Sw,...xw}});function dx(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var hx,Nw,G4,Wh,Dw=me(()=>{f();fx();Qh();hx=dx("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Nw=dx("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=tu(r.length);for(let t=0;t{f();Dw()});function Di(r,e="utf8"){let t=Wh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):t.decoder.decode(`${t.prefix}${r}`)}var Pw=me(()=>{f();Dw()});function Fc(r){return Sc(tn(Di(r,Za),Rh))}function Uc(r){return tn(Di(xc(r),Rh),Za)}function Bw(r){let e=Di(Vh,eu),t=qh+tn(jh([e,r]),eu);return[Fh,Uh,t].join(Lh)}function Mw(r){let[e,t,i]=r.split(Lh);if(e!==Fh||t!==Uh)throw new Error('Issuer must be a DID with method "key"');if(i.slice(0,1)!==qh)throw new Error("Issuer must be a key in mulicodec format");let s=Di(i.slice(1),eu);if(tn(s.slice(0,2),eu)!==Vh)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 px(r){return tn(r,Za)}function gx(r){return Di(r,Za)}function Rw(r){return Di([Uc(r.header),Uc(r.payload)].join(eo),Oc)}function K4(r){let e=tn(r,Oc).split(eo),t=Fc(e[0]),i=Fc(e[1]);return{header:t,payload:i}}function Lw(r){return[Uc(r.header),Uc(r.payload),px(r.signature)].join(eo)}function Fw(r){let e=r.split(eo),t=Fc(e[0]),i=Fc(e[1]),n=gx(e[2]),s=Di(e.slice(0,2).join(eo),Oc);return{header:t,payload:i,signature:n,data:s}}var Uw=me(()=>{f();sw();Ow();Pw();xh();Hh()});function z4(r=(0,yx.randomBytes)(32)){return au.generateKeyPairFromSeed(r)}async function k4(r,e,t,i,n=(0,mx.fromMiliseconds)(Date.now())){let s={alg:Bh,typ:Mh},o=Bw(i.publicKey),a=n+t,u={iss:o,sub:r,aud:e,iat:n,exp:a},h=Rw({header:s,payload:u}),p=au.sign(i.secretKey,h);return Lw({header:s,payload:u,signature:p})}async function W4(r){let{header:e,payload:t,data:i,signature:n}=Fw(r);if(e.alg!==Bh||e.typ!==Mh)throw new Error("JWT must use EdDSA algorithm");let s=Mw(t.iss);return au.verify(s,i,n)}var au,yx,mx,wx=me(()=>{f();au=_e(TS()),yx=_e(Tc()),mx=_e(Ys());Hh();Uw()});var vx=me(()=>{f()});var Ex={};ot(Ex,{DATA_ENCODING:()=>Oc,DID_DELIMITER:()=>Lh,DID_METHOD:()=>Uh,DID_PREFIX:()=>Fh,JSON_ENCODING:()=>Rh,JWT_DELIMITER:()=>eo,JWT_ENCODING:()=>Za,JWT_IRIDIUM_ALG:()=>Bh,JWT_IRIDIUM_TYP:()=>Mh,KEY_PAIR_SEED_LENGTH:()=>DS,MULTICODEC_ED25519_BASE:()=>qh,MULTICODEC_ED25519_ENCODING:()=>eu,MULTICODEC_ED25519_HEADER:()=>Vh,MULTICODEC_ED25519_LENGTH:()=>NS,decodeData:()=>K4,decodeIss:()=>Mw,decodeJSON:()=>Fc,decodeJWT:()=>Fw,decodeSig:()=>gx,encodeData:()=>Rw,encodeIss:()=>Bw,encodeJSON:()=>Uc,encodeJWT:()=>Lw,encodeSig:()=>px,generateKeyPair:()=>z4,signJWT:()=>k4,verifyJWT:()=>W4});var Ax=me(()=>{f();wx();Hh();vx();Uw()});var _x=B($h=>{"use strict";f();Object.defineProperty($h,"__esModule",{value:!0});var cr=$a(),qw=qr(),$4=20;function Y4(r,e,t){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=t[3]<<24|t[2]<<16|t[1]<<8|t[0],u=t[7]<<24|t[6]<<16|t[5]<<8|t[4],h=t[11]<<24|t[10]<<16|t[9]<<8|t[8],p=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=t[19]<<24|t[18]<<16|t[17]<<8|t[16],N=t[23]<<24|t[22]<<16|t[21]<<8|t[20],O=t[27]<<24|t[26]<<16|t[25]<<8|t[24],T=t[31]<<24|t[30]<<16|t[29]<<8|t[28],V=e[3]<<24|e[2]<<16|e[1]<<8|e[0],z=e[7]<<24|e[6]<<16|e[5]<<8|e[4],$=e[11]<<24|e[10]<<16|e[9]<<8|e[8],se=e[15]<<24|e[14]<<16|e[13]<<8|e[12],Y=i,j=n,W=s,k=o,R=a,F=u,G=h,ce=p,J=w,X=N,A=O,c=T,d=V,g=z,m=$,v=se,S=0;S<$4;S+=2)Y=Y+R|0,d^=Y,d=d>>>32-16|d<<16,J=J+d|0,R^=J,R=R>>>32-12|R<<12,j=j+F|0,g^=j,g=g>>>32-16|g<<16,X=X+g|0,F^=X,F=F>>>32-12|F<<12,W=W+G|0,m^=W,m=m>>>32-16|m<<16,A=A+m|0,G^=A,G=G>>>32-12|G<<12,k=k+ce|0,v^=k,v=v>>>32-16|v<<16,c=c+v|0,ce^=c,ce=ce>>>32-12|ce<<12,W=W+G|0,m^=W,m=m>>>32-8|m<<8,A=A+m|0,G^=A,G=G>>>32-7|G<<7,k=k+ce|0,v^=k,v=v>>>32-8|v<<8,c=c+v|0,ce^=c,ce=ce>>>32-7|ce<<7,j=j+F|0,g^=j,g=g>>>32-8|g<<8,X=X+g|0,F^=X,F=F>>>32-7|F<<7,Y=Y+R|0,d^=Y,d=d>>>32-8|d<<8,J=J+d|0,R^=J,R=R>>>32-7|R<<7,Y=Y+F|0,v^=Y,v=v>>>32-16|v<<16,A=A+v|0,F^=A,F=F>>>32-12|F<<12,j=j+G|0,d^=j,d=d>>>32-16|d<<16,c=c+d|0,G^=c,G=G>>>32-12|G<<12,W=W+ce|0,g^=W,g=g>>>32-16|g<<16,J=J+g|0,ce^=J,ce=ce>>>32-12|ce<<12,k=k+R|0,m^=k,m=m>>>32-16|m<<16,X=X+m|0,R^=X,R=R>>>32-12|R<<12,W=W+ce|0,g^=W,g=g>>>32-8|g<<8,J=J+g|0,ce^=J,ce=ce>>>32-7|ce<<7,k=k+R|0,m^=k,m=m>>>32-8|m<<8,X=X+m|0,R^=X,R=R>>>32-7|R<<7,j=j+G|0,d^=j,d=d>>>32-8|d<<8,c=c+d|0,G^=c,G=G>>>32-7|G<<7,Y=Y+F|0,v^=Y,v=v>>>32-8|v<<8,A=A+v|0,F^=A,F=F>>>32-7|F<<7;cr.writeUint32LE(Y+i|0,r,0),cr.writeUint32LE(j+n|0,r,4),cr.writeUint32LE(W+s|0,r,8),cr.writeUint32LE(k+o|0,r,12),cr.writeUint32LE(R+a|0,r,16),cr.writeUint32LE(F+u|0,r,20),cr.writeUint32LE(G+h|0,r,24),cr.writeUint32LE(ce+p|0,r,28),cr.writeUint32LE(J+w|0,r,32),cr.writeUint32LE(X+N|0,r,36),cr.writeUint32LE(A+O|0,r,40),cr.writeUint32LE(c+T|0,r,44),cr.writeUint32LE(d+V|0,r,48),cr.writeUint32LE(g+z|0,r,52),cr.writeUint32LE(m+$|0,r,56),cr.writeUint32LE(v+se|0,r,60)}function Ix(r,e,t,i,n){if(n===void 0&&(n=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}});var Yh=B(uu=>{"use strict";f();Object.defineProperty(uu,"__esModule",{value:!0});function Z4(r,e,t){return~(r-1)&e|r-1&t}uu.select=Z4;function eU(r,e){return(r|0)-(e|0)-1>>>31&1}uu.lessOrEqual=eU;function bx(r,e){if(r.length!==e.length)return 0;for(var t=0,i=0;i>>8}uu.compare=bx;function tU(r,e){return r.length===0||e.length===0?!1:bx(r,e)!==0}uu.equal=tU});var Sx=B(rn=>{"use strict";f();Object.defineProperty(rn,"__esModule",{value:!0});var rU=Yh(),Jh=qr();rn.DIGEST_LENGTH=16;var Cx=function(){function r(e){this.digestLength=rn.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 t=e[0]|e[1]<<8;this._r[0]=t&8191;var i=e[2]|e[3]<<8;this._r[1]=(t>>>13|i<<3)&8191;var n=e[4]|e[5]<<8;this._r[2]=(i>>>10|n<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(n>>>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 h=e[14]|e[15]<<8;this._r[8]=(u>>>8|h<<8)&8191,this._r[9]=h>>>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 r.prototype._blocks=function(e,t,i){for(var n=this._fin?0:2048,s=this._h[0],o=this._h[1],a=this._h[2],u=this._h[3],h=this._h[4],p=this._h[5],w=this._h[6],N=this._h[7],O=this._h[8],T=this._h[9],V=this._r[0],z=this._r[1],$=this._r[2],se=this._r[3],Y=this._r[4],j=this._r[5],W=this._r[6],k=this._r[7],R=this._r[8],F=this._r[9];i>=16;){var G=e[t+0]|e[t+1]<<8;s+=G&8191;var ce=e[t+2]|e[t+3]<<8;o+=(G>>>13|ce<<3)&8191;var J=e[t+4]|e[t+5]<<8;a+=(ce>>>10|J<<6)&8191;var X=e[t+6]|e[t+7]<<8;u+=(J>>>7|X<<9)&8191;var A=e[t+8]|e[t+9]<<8;h+=(X>>>4|A<<12)&8191,p+=A>>>1&8191;var c=e[t+10]|e[t+11]<<8;w+=(A>>>14|c<<2)&8191;var d=e[t+12]|e[t+13]<<8;N+=(c>>>11|d<<5)&8191;var g=e[t+14]|e[t+15]<<8;O+=(d>>>8|g<<8)&8191,T+=g>>>5|n;var m=0,v=m;v+=s*V,v+=o*(5*F),v+=a*(5*R),v+=u*(5*k),v+=h*(5*W),m=v>>>13,v&=8191,v+=p*(5*j),v+=w*(5*Y),v+=N*(5*se),v+=O*(5*$),v+=T*(5*z),m+=v>>>13,v&=8191;var S=m;S+=s*z,S+=o*V,S+=a*(5*F),S+=u*(5*R),S+=h*(5*k),m=S>>>13,S&=8191,S+=p*(5*W),S+=w*(5*j),S+=N*(5*Y),S+=O*(5*se),S+=T*(5*$),m+=S>>>13,S&=8191;var D=m;D+=s*$,D+=o*z,D+=a*V,D+=u*(5*F),D+=h*(5*R),m=D>>>13,D&=8191,D+=p*(5*k),D+=w*(5*W),D+=N*(5*j),D+=O*(5*Y),D+=T*(5*se),m+=D>>>13,D&=8191;var I=m;I+=s*se,I+=o*$,I+=a*z,I+=u*V,I+=h*(5*F),m=I>>>13,I&=8191,I+=p*(5*R),I+=w*(5*k),I+=N*(5*W),I+=O*(5*j),I+=T*(5*Y),m+=I>>>13,I&=8191;var l=m;l+=s*Y,l+=o*se,l+=a*$,l+=u*z,l+=h*V,m=l>>>13,l&=8191,l+=p*(5*F),l+=w*(5*R),l+=N*(5*k),l+=O*(5*W),l+=T*(5*j),m+=l>>>13,l&=8191;var C=m;C+=s*j,C+=o*Y,C+=a*se,C+=u*$,C+=h*z,m=C>>>13,C&=8191,C+=p*V,C+=w*(5*F),C+=N*(5*R),C+=O*(5*k),C+=T*(5*W),m+=C>>>13,C&=8191;var Z=m;Z+=s*W,Z+=o*j,Z+=a*Y,Z+=u*se,Z+=h*$,m=Z>>>13,Z&=8191,Z+=p*z,Z+=w*V,Z+=N*(5*F),Z+=O*(5*R),Z+=T*(5*k),m+=Z>>>13,Z&=8191;var ie=m;ie+=s*k,ie+=o*W,ie+=a*j,ie+=u*Y,ie+=h*se,m=ie>>>13,ie&=8191,ie+=p*$,ie+=w*z,ie+=N*V,ie+=O*(5*F),ie+=T*(5*R),m+=ie>>>13,ie&=8191;var ee=m;ee+=s*R,ee+=o*k,ee+=a*W,ee+=u*j,ee+=h*Y,m=ee>>>13,ee&=8191,ee+=p*se,ee+=w*$,ee+=N*z,ee+=O*V,ee+=T*(5*F),m+=ee>>>13,ee&=8191;var ae=m;ae+=s*F,ae+=o*R,ae+=a*k,ae+=u*W,ae+=h*j,m=ae>>>13,ae&=8191,ae+=p*Y,ae+=w*se,ae+=N*$,ae+=O*z,ae+=T*V,m+=ae>>>13,ae&=8191,m=(m<<2)+m|0,m=m+v|0,v=m&8191,m=m>>>13,S+=m,s=v,o=S,a=D,u=I,h=l,p=C,w=Z,N=ie,O=ee,T=ae,t+=16,i-=16}this._h[0]=s,this._h[1]=o,this._h[2]=a,this._h[3]=u,this._h[4]=h,this._h[5]=p,this._h[6]=w,this._h[7]=N,this._h[8]=O,this._h[9]=T},r.prototype.finish=function(e,t){t===void 0&&(t=0);var i=new Uint16Array(10),n,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(n=this._h[1]>>>13,this._h[1]&=8191,a=2;a<10;a++)this._h[a]+=n,n=this._h[a]>>>13,this._h[a]&=8191;for(this._h[0]+=n*5,n=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=n,n=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=n,i[0]=this._h[0]+5,n=i[0]>>>13,i[0]&=8191,a=1;a<10;a++)i[a]=this._h[a]+n,n=i[a]>>>13,i[a]&=8191;for(i[9]-=1<<13,s=(n^1)-1,a=0;a<10;a++)i[a]&=s;for(s=~s,a=0;a<10;a++)this._h[a]=this._h[a]&s|i[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[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,i=e.length,n;if(this._leftover){n=16-this._leftover,n>i&&(n=i);for(var s=0;s=16&&(n=i-i%16,this._blocks(e,t,n),t+=n,i-=n),i){for(var s=0;s{"use strict";f();Object.defineProperty(nn,"__esModule",{value:!0});var Xh=_x(),sU=Sx(),qc=qr(),xx=$a(),oU=Yh();nn.KEY_LENGTH=32;nn.NONCE_LENGTH=12;nn.TAG_LENGTH=16;var Tx=new Uint8Array(16),aU=function(){function r(e){if(this.nonceLength=nn.NONCE_LENGTH,this.tagLength=nn.TAG_LENGTH,e.length!==nn.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return r.prototype.seal=function(e,t,i,n){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);Xh.stream(this._key,s,o,4);var a=t.length+this.tagLength,u;if(n){if(n.length!==a)throw new Error("ChaCha20Poly1305: incorrect destination length");u=n}else u=new Uint8Array(a);return Xh.streamXOR(this._key,s,t,u,4),this._authenticate(u.subarray(u.length-this.tagLength,u.length),o,u.subarray(0,u.length-this.tagLength),i),qc.wipe(s),u},r.prototype.open=function(e,t,i,n){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&s.update(Tx.subarray(n.length%16))),s.update(i),i.length%16>0&&s.update(Tx.subarray(i.length%16));var o=new Uint8Array(8);n&&xx.writeUint64LE(n.length,o),s.update(o),xx.writeUint64LE(i.length,o),s.update(o);for(var a=s.digest(),u=0;u{"use strict";f();Object.defineProperty(Vw,"__esModule",{value:!0});function uU(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}Vw.isSerializableHash=uU});var Px=B(Vc=>{"use strict";f();Object.defineProperty(Vc,"__esModule",{value:!0});var Oi=Dx(),cU=Yh(),lU=qr(),Ox=function(){function r(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(i).clean():i.set(t);for(var n=0;n{"use strict";f();Object.defineProperty(Hw,"__esModule",{value:!0});var Bx=Px(),Mx=qr(),hU=function(){function r(e,t,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=Bx.hmac(this._hash,i,t);this._hmac=new Bx.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.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},r.prototype.expand=function(e){for(var t=new Uint8Array(e),i=0;i{"use strict";f();Object.defineProperty(qn,"__esModule",{value:!0});var ed=$a(),Zh=qr();qn.DIGEST_LENGTH=32;qn.BLOCK_SIZE=64;var Lx=function(){function r(){this.digestLength=qn.DIGEST_LENGTH,this.blockSize=qn.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 r.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},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Zh.wipe(this._buffer),Zh.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[i++],t--;this._bufferLength===this.blockSize&&(Qw(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(i=Qw(this._temp,this._state,e,i,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[i++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,i=this._bufferLength,n=t/536870912|0,s=t<<3,o=t%64<56?64:128;this._buffer[i]=128;for(var a=i+1;a0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.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},r.prototype.cleanSavedState=function(e){Zh.wipe(e.state),e.buffer&&Zh.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();qn.SHA256=Lx;var dU=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 Qw(r,e,t,i,n){for(;n>=64;){for(var s=e[0],o=e[1],a=e[2],u=e[3],h=e[4],p=e[5],w=e[6],N=e[7],O=0;O<16;O++){var T=i+O*4;r[O]=ed.readUint32BE(t,T)}for(var O=16;O<64;O++){var V=r[O-2],z=(V>>>17|V<<32-17)^(V>>>19|V<<32-19)^V>>>10;V=r[O-15];var $=(V>>>7|V<<32-7)^(V>>>18|V<<32-18)^V>>>3;r[O]=(z+r[O-7]|0)+($+r[O-16]|0)}for(var O=0;O<64;O++){var z=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&p^~h&w)|0)+(N+(dU[O]+r[O]|0)|0)|0,$=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&o^s&a^o&a)|0;N=w,w=p,p=h,h=u+z|0,u=a,a=o,o=s,s=z+$|0}e[0]+=s,e[1]+=o,e[2]+=a,e[3]+=u,e[4]+=h,e[5]+=p,e[6]+=w,e[7]+=N,i+=64,n-=64}return i}function pU(r){var e=new Lx;e.update(r);var t=e.digest();return e.clean(),t}qn.hash=pU});var Hx=B(ct=>{"use strict";f();Object.defineProperty(ct,"__esModule",{value:!0});ct.sharedKey=ct.generateKeyPair=ct.generateKeyPairFromSeed=ct.scalarMultBase=ct.scalarMult=ct.SHARED_KEY_LENGTH=ct.SECRET_KEY_LENGTH=ct.PUBLIC_KEY_LENGTH=void 0;var gU=Tc(),yU=qr();ct.PUBLIC_KEY_LENGTH=32;ct.SECRET_KEY_LENGTH=32;ct.SHARED_KEY_LENGTH=32;function Pi(r){let e=new Float64Array(16);if(r)for(let t=0;t>16&1),t[o-1]&=65535;t[15]=i[15]-32767-(t[14]>>16&1);let s=t[15]>>16&1;t[14]&=65535,Hc(i,t,1-s)}for(let n=0;n<16;n++)r[2*n]=i[n]&255,r[2*n+1]=i[n]>>8}function vU(r,e){for(let t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function td(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]+t[i]}function rd(r,e,t){for(let i=0;i<16;i++)r[i]=e[i]-t[i]}function sn(r,e,t){let i,n,s=0,o=0,a=0,u=0,h=0,p=0,w=0,N=0,O=0,T=0,V=0,z=0,$=0,se=0,Y=0,j=0,W=0,k=0,R=0,F=0,G=0,ce=0,J=0,X=0,A=0,c=0,d=0,g=0,m=0,v=0,S=0,D=t[0],I=t[1],l=t[2],C=t[3],Z=t[4],ie=t[5],ee=t[6],ae=t[7],E=t[8],b=t[9],x=t[10],L=t[11],P=t[12],U=t[13],q=t[14],M=t[15];i=e[0],s+=i*D,o+=i*I,a+=i*l,u+=i*C,h+=i*Z,p+=i*ie,w+=i*ee,N+=i*ae,O+=i*E,T+=i*b,V+=i*x,z+=i*L,$+=i*P,se+=i*U,Y+=i*q,j+=i*M,i=e[1],o+=i*D,a+=i*I,u+=i*l,h+=i*C,p+=i*Z,w+=i*ie,N+=i*ee,O+=i*ae,T+=i*E,V+=i*b,z+=i*x,$+=i*L,se+=i*P,Y+=i*U,j+=i*q,W+=i*M,i=e[2],a+=i*D,u+=i*I,h+=i*l,p+=i*C,w+=i*Z,N+=i*ie,O+=i*ee,T+=i*ae,V+=i*E,z+=i*b,$+=i*x,se+=i*L,Y+=i*P,j+=i*U,W+=i*q,k+=i*M,i=e[3],u+=i*D,h+=i*I,p+=i*l,w+=i*C,N+=i*Z,O+=i*ie,T+=i*ee,V+=i*ae,z+=i*E,$+=i*b,se+=i*x,Y+=i*L,j+=i*P,W+=i*U,k+=i*q,R+=i*M,i=e[4],h+=i*D,p+=i*I,w+=i*l,N+=i*C,O+=i*Z,T+=i*ie,V+=i*ee,z+=i*ae,$+=i*E,se+=i*b,Y+=i*x,j+=i*L,W+=i*P,k+=i*U,R+=i*q,F+=i*M,i=e[5],p+=i*D,w+=i*I,N+=i*l,O+=i*C,T+=i*Z,V+=i*ie,z+=i*ee,$+=i*ae,se+=i*E,Y+=i*b,j+=i*x,W+=i*L,k+=i*P,R+=i*U,F+=i*q,G+=i*M,i=e[6],w+=i*D,N+=i*I,O+=i*l,T+=i*C,V+=i*Z,z+=i*ie,$+=i*ee,se+=i*ae,Y+=i*E,j+=i*b,W+=i*x,k+=i*L,R+=i*P,F+=i*U,G+=i*q,ce+=i*M,i=e[7],N+=i*D,O+=i*I,T+=i*l,V+=i*C,z+=i*Z,$+=i*ie,se+=i*ee,Y+=i*ae,j+=i*E,W+=i*b,k+=i*x,R+=i*L,F+=i*P,G+=i*U,ce+=i*q,J+=i*M,i=e[8],O+=i*D,T+=i*I,V+=i*l,z+=i*C,$+=i*Z,se+=i*ie,Y+=i*ee,j+=i*ae,W+=i*E,k+=i*b,R+=i*x,F+=i*L,G+=i*P,ce+=i*U,J+=i*q,X+=i*M,i=e[9],T+=i*D,V+=i*I,z+=i*l,$+=i*C,se+=i*Z,Y+=i*ie,j+=i*ee,W+=i*ae,k+=i*E,R+=i*b,F+=i*x,G+=i*L,ce+=i*P,J+=i*U,X+=i*q,A+=i*M,i=e[10],V+=i*D,z+=i*I,$+=i*l,se+=i*C,Y+=i*Z,j+=i*ie,W+=i*ee,k+=i*ae,R+=i*E,F+=i*b,G+=i*x,ce+=i*L,J+=i*P,X+=i*U,A+=i*q,c+=i*M,i=e[11],z+=i*D,$+=i*I,se+=i*l,Y+=i*C,j+=i*Z,W+=i*ie,k+=i*ee,R+=i*ae,F+=i*E,G+=i*b,ce+=i*x,J+=i*L,X+=i*P,A+=i*U,c+=i*q,d+=i*M,i=e[12],$+=i*D,se+=i*I,Y+=i*l,j+=i*C,W+=i*Z,k+=i*ie,R+=i*ee,F+=i*ae,G+=i*E,ce+=i*b,J+=i*x,X+=i*L,A+=i*P,c+=i*U,d+=i*q,g+=i*M,i=e[13],se+=i*D,Y+=i*I,j+=i*l,W+=i*C,k+=i*Z,R+=i*ie,F+=i*ee,G+=i*ae,ce+=i*E,J+=i*b,X+=i*x,A+=i*L,c+=i*P,d+=i*U,g+=i*q,m+=i*M,i=e[14],Y+=i*D,j+=i*I,W+=i*l,k+=i*C,R+=i*Z,F+=i*ie,G+=i*ee,ce+=i*ae,J+=i*E,X+=i*b,A+=i*x,c+=i*L,d+=i*P,g+=i*U,m+=i*q,v+=i*M,i=e[15],j+=i*D,W+=i*I,k+=i*l,R+=i*C,F+=i*Z,G+=i*ie,ce+=i*ee,J+=i*ae,X+=i*E,A+=i*b,c+=i*x,d+=i*L,g+=i*P,m+=i*U,v+=i*q,S+=i*M,s+=38*W,o+=38*k,a+=38*R,u+=38*F,h+=38*G,p+=38*ce,w+=38*J,N+=38*X,O+=38*A,T+=38*c,V+=38*d,z+=38*g,$+=38*m,se+=38*v,Y+=38*S,n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),n=1,i=s+n+65535,n=Math.floor(i/65536),s=i-n*65536,i=o+n+65535,n=Math.floor(i/65536),o=i-n*65536,i=a+n+65535,n=Math.floor(i/65536),a=i-n*65536,i=u+n+65535,n=Math.floor(i/65536),u=i-n*65536,i=h+n+65535,n=Math.floor(i/65536),h=i-n*65536,i=p+n+65535,n=Math.floor(i/65536),p=i-n*65536,i=w+n+65535,n=Math.floor(i/65536),w=i-n*65536,i=N+n+65535,n=Math.floor(i/65536),N=i-n*65536,i=O+n+65535,n=Math.floor(i/65536),O=i-n*65536,i=T+n+65535,n=Math.floor(i/65536),T=i-n*65536,i=V+n+65535,n=Math.floor(i/65536),V=i-n*65536,i=z+n+65535,n=Math.floor(i/65536),z=i-n*65536,i=$+n+65535,n=Math.floor(i/65536),$=i-n*65536,i=se+n+65535,n=Math.floor(i/65536),se=i-n*65536,i=Y+n+65535,n=Math.floor(i/65536),Y=i-n*65536,i=j+n+65535,n=Math.floor(i/65536),j=i-n*65536,s+=n-1+37*(n-1),r[0]=s,r[1]=o,r[2]=a,r[3]=u,r[4]=h,r[5]=p,r[6]=w,r[7]=N,r[8]=O,r[9]=T,r[10]=V,r[11]=z,r[12]=$,r[13]=se,r[14]=Y,r[15]=j}function Qc(r,e){sn(r,e,e)}function EU(r,e){let t=Pi();for(let i=0;i<16;i++)t[i]=e[i];for(let i=253;i>=0;i--)Qc(t,t),i!==2&&i!==4&&sn(t,t,e);for(let i=0;i<16;i++)r[i]=t[i]}function Gw(r,e){let t=new Uint8Array(32),i=new Float64Array(80),n=Pi(),s=Pi(),o=Pi(),a=Pi(),u=Pi(),h=Pi();for(let O=0;O<31;O++)t[O]=r[O];t[31]=r[31]&127|64,t[0]&=248,vU(i,e);for(let O=0;O<16;O++)s[O]=i[O];n[0]=a[0]=1;for(let O=254;O>=0;--O){let T=t[O>>>3]>>>(O&7)&1;Hc(n,s,T),Hc(o,a,T),td(u,n,o),rd(n,n,o),td(o,s,a),rd(s,s,a),Qc(a,u),Qc(h,n),sn(n,o,n),sn(o,s,u),td(u,n,o),rd(n,n,o),Qc(s,n),rd(o,a,h),sn(n,o,mU),td(n,n,a),sn(o,o,n),sn(n,a,h),sn(a,s,i),Qc(s,u),Hc(n,s,T),Hc(o,a,T)}for(let O=0;O<16;O++)i[O+16]=n[O],i[O+32]=o[O],i[O+48]=s[O],i[O+64]=a[O];let p=i.subarray(32),w=i.subarray(16);EU(p,p),sn(w,w,p);let N=new Uint8Array(32);return wU(N,w),N}ct.scalarMult=Gw;function qx(r){return Gw(r,Ux)}ct.scalarMultBase=qx;function Vx(r){if(r.length!==ct.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${ct.SECRET_KEY_LENGTH} bytes`);let e=new Uint8Array(r);return{publicKey:qx(e),secretKey:e}}ct.generateKeyPairFromSeed=Vx;function AU(r){let e=(0,gU.randomBytes)(32,r),t=Vx(e);return(0,yU.wipe)(e),t}ct.generateKeyPair=AU;function IU(r,e,t=!1){if(r.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ct.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");let i=Gw(r,e);if(t){let n=0;for(let s=0;se[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength{f()});function Gx(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t{f()});function zx(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=tu(r.length);for(let i=0;i{f();Qh()});var Wx={};ot(Wx,{compare:()=>Qx,concat:()=>jh,equals:()=>Gx,fromString:()=>Di,toString:()=>tn,xor:()=>zx});var $x=me(()=>{f();jx();sw();Kx();Pw();Ow();kx()});var a2=B(it=>{"use strict";f();var Yx=it&&it.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new i2:typeof navigator<"u"?Kw(navigator.userAgent):o2()}it.detect=SU;function n2(r){return r!==""&&CU.reduce(function(e,t){var i=t[0],n=t[1];if(e)return e;var s=n.exec(r);return!!s&&[i,s]},!1)}function xU(r){var e=n2(r);return e?e[0]:null}it.browserName=xU;function Kw(r){var e=n2(r);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new r2;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length{"use strict";f();Object.defineProperty(We,"__esModule",{value:!0});We.getLocalStorage=We.getLocalStorageOrThrow=We.getCrypto=We.getCryptoOrThrow=We.getLocation=We.getLocationOrThrow=We.getNavigator=We.getNavigatorOrThrow=We.getDocument=We.getDocumentOrThrow=We.getFromWindowOrThrow=We.getFromWindow=void 0;function ro(r){let e;return typeof window<"u"&&typeof window[r]<"u"&&(e=window[r]),e}We.getFromWindow=ro;function cu(r){let e=ro(r);if(!e)throw new Error(`${r} is not defined in Window`);return e}We.getFromWindowOrThrow=cu;function NU(){return cu("document")}We.getDocumentOrThrow=NU;function DU(){return ro("document")}We.getDocument=DU;function OU(){return cu("navigator")}We.getNavigatorOrThrow=OU;function PU(){return ro("navigator")}We.getNavigator=PU;function BU(){return cu("location")}We.getLocationOrThrow=BU;function MU(){return ro("location")}We.getLocation=MU;function RU(){return cu("crypto")}We.getCryptoOrThrow=RU;function LU(){return ro("crypto")}We.getCrypto=LU;function FU(){return cu("localStorage")}We.getLocalStorageOrThrow=FU;function UU(){return ro("localStorage")}We.getLocalStorage=UU});var c2=B(id=>{"use strict";f();Object.defineProperty(id,"__esModule",{value:!0});id.getWindowMetadata=void 0;var u2=zw();function qU(){let r,e;try{r=u2.getDocumentOrThrow(),e=u2.getLocationOrThrow()}catch{return null}function t(){let w=r.getElementsByTagName("link"),N=[];for(let O=0;O-1){let z=T.getAttribute("href");if(z)if(z.toLowerCase().indexOf("https:")===-1&&z.toLowerCase().indexOf("http:")===-1&&z.indexOf("//")!==0){let $=e.protocol+"//"+e.host;if(z.indexOf("/")===0)$+=z;else{let se=e.pathname.split("/");se.pop();let Y=se.join("/");$+=Y+"/"+z}N.push($)}else if(z.indexOf("//")===0){let $=e.protocol+z;N.push($)}else N.push(z)}}return N}function i(...w){let N=r.getElementsByTagName("meta");for(let O=0;OT.getAttribute(z)).filter(z=>z?w.includes(z):!1);if(V.length&&V){let z=T.getAttribute("content");if(z)return z}}return""}function n(){let w=i("name","og:site_name","og:title","twitter:title");return w||(w=r.title),w}function s(){return i("description","og:description","twitter:description","keywords")}let o=n(),a=s(),u=e.origin,h=t();return{description:a,url:u,icons:h,name:o}}id.getWindowMetadata=qU});var f2=B((gee,l2)=>{"use strict";f();l2.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var y2=B((mee,g2)=>{"use strict";f();var p2="%[a-f0-9]{2}",h2=new RegExp("("+p2+")|([^%]+?)","gi"),d2=new RegExp("("+p2+")+","gi");function kw(r,e){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),i=r.slice(e);return Array.prototype.concat.call([],kw(t),kw(i))}function VU(r){try{return decodeURIComponent(r)}catch{for(var e=r.match(h2)||[],t=1;t{"use strict";f();m2.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var E2=B((Aee,v2)=>{"use strict";f();v2.exports=function(r,e){for(var t={},i=Object.keys(r),n=Array.isArray(e),s=0;s{"use strict";f();var QU=f2(),jU=y2(),I2=w2(),GU=E2(),KU=r=>r==null,Ww=Symbol("encodeFragmentIdentifier");function zU(r){switch(r.arrayFormat){case"index":return e=>(t,i)=>{let n=t.length;return i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[",n,"]"].join("")]:[...t,[yt(e,r),"[",yt(n,r),"]=",yt(i,r)].join("")]};case"bracket":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),"[]"].join("")]:[...t,[yt(e,r),"[]=",yt(i,r)].join("")];case"colon-list-separator":return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,[yt(e,r),":list="].join("")]:[...t,[yt(e,r),":list=",yt(i,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(i,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?i:(n=n===null?"":n,i.length===0?[[yt(t,r),e,yt(n,r)].join("")]:[[i,yt(n,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?t:i===null?[...t,yt(e,r)]:[...t,[yt(e,r),"=",yt(i,r)].join("")]}}function kU(r){let e;switch(r.arrayFormat){case"index":return(t,i,n)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){n[t]=i;return}n[t]===void 0&&(n[t]={}),n[t][e[1]]=i};case"bracket":return(t,i,n)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"colon-list-separator":return(t,i,n)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){n[t]=i;return}if(n[t]===void 0){n[t]=[i];return}n[t]=[].concat(n[t],i)};case"comma":case"separator":return(t,i,n)=>{let s=typeof i=="string"&&i.includes(r.arrayFormatSeparator),o=typeof i=="string"&&!s&&on(i,r).includes(r.arrayFormatSeparator);i=o?on(i,r):i;let a=s||o?i.split(r.arrayFormatSeparator).map(u=>on(u,r)):i===null?i:on(i,r);n[t]=a};case"bracket-separator":return(t,i,n)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){n[t]=i&&on(i,r);return}let o=i===null?[]:i.split(r.arrayFormatSeparator).map(a=>on(a,r));if(n[t]===void 0){n[t]=o;return}n[t]=[].concat(n[t],o)};default:return(t,i,n)=>{if(n[t]===void 0){n[t]=i;return}n[t]=[].concat(n[t],i)}}}function _2(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function yt(r,e){return e.encode?e.strict?QU(r):encodeURIComponent(r):r}function on(r,e){return e.decode?jU(r):r}function b2(r){return Array.isArray(r)?r.sort():typeof r=="object"?b2(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}function C2(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function WU(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}function S2(r){r=C2(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function A2(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function x2(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),_2(e.arrayFormatSeparator);let t=kU(e),i=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return i;for(let n of r.split("&")){if(n==="")continue;let[s,o]=I2(e.decode?n.replace(/\+/g," "):n,"=");o=o===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?o:on(o,e),t(on(s,e),o,i)}for(let n of Object.keys(i)){let s=i[n];if(typeof s=="object"&&s!==null)for(let o of Object.keys(s))s[o]=A2(s[o],e);else i[n]=A2(s,e)}return e.sort===!1?i:(e.sort===!0?Object.keys(i).sort():Object.keys(i).sort(e.sort)).reduce((n,s)=>{let o=i[s];return Boolean(o)&&typeof o=="object"&&!Array.isArray(o)?n[s]=b2(o):n[s]=o,n},Object.create(null))}Er.extract=S2;Er.parse=x2;Er.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),_2(e.arrayFormatSeparator);let t=o=>e.skipNull&&KU(r[o])||e.skipEmptyString&&r[o]==="",i=zU(e),n={};for(let o of Object.keys(r))t(o)||(n[o]=r[o]);let s=Object.keys(n);return e.sort!==!1&&s.sort(e.sort),s.map(o=>{let a=r[o];return a===void 0?"":a===null?yt(o,e):Array.isArray(a)?a.length===0&&e.arrayFormat==="bracket-separator"?yt(o,e)+"[]":a.reduce(i(o),[]).join("&"):yt(o,e)+"="+yt(a,e)}).filter(o=>o.length>0).join("&")};Er.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,i]=I2(r,"#");return Object.assign({url:t.split("?")[0]||"",query:x2(S2(r),e)},e&&e.parseFragmentIdentifier&&i?{fragmentIdentifier:on(i,e)}:{})};Er.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[Ww]:!0},e);let t=C2(r.url).split("?")[0]||"",i=Er.extract(r.url),n=Er.parse(i,{sort:!1}),s=Object.assign(n,r.query),o=Er.stringify(s,e);o&&(o=`?${o}`);let a=WU(r.url);return r.fragmentIdentifier&&(a=`#${e[Ww]?yt(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${o}${a}`};Er.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[Ww]:!1},t);let{url:i,query:n,fragmentIdentifier:s}=Er.parseUrl(r,t);return Er.stringifyUrl({url:i,query:GU(n,e),fragmentIdentifier:s},t)};Er.exclude=(r,e,t)=>{let i=Array.isArray(e)?n=>!e.includes(n):(n,s)=>!e(n,s);return Er.pick(r,i,t)}});var N2=me(()=>{f()});function Vn(r,e,t="string"){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function $U(r,e){let t=!0;return e.forEach(i=>{i in r||(t=!1)}),t}function YU(r,e){return Array.isArray(r)?r.length===e:Object.keys(r).length===e}function JU(r,e){return Array.isArray(r)?r.length>=e:Object.keys(r).length>=e}function jc(r,e,t){return(!t.length?YU(r,e.length):JU(r,e.length))?$U(r,e):!1}function Gc(r,e,t="_"){let i=r.split(t);return i[i.length-1].trim().toLowerCase()===e.trim().toLowerCase()}var $w=me(()=>{f()});function XU(r){return nd(r.method)&&sd(r.params)}function nd(r){return Gc(r,"subscribe")}function sd(r){return jc(r,["topic"],[])}function ZU(r){return od(r.method)&&ad(r.params)}function od(r){return Gc(r,"publish")}function ad(r){return jc(r,["message","topic","ttl"],["prompt","tag"])}function eq(r){return ud(r.method)&&cd(r.params)}function ud(r){return Gc(r,"unsubscribe")}function cd(r){return jc(r,["id","topic"],[])}function tq(r){return ld(r.method)&&fd(r.params)}function ld(r){return Gc(r,"subscription")}function fd(r){return jc(r,["id","data"],[])}var Yw=me(()=>{f();$w()});function rq(r){if(!nd(r.method))throw new Error("JSON-RPC Request has invalid subscribe method");if(!sd(r.params))throw new Error("JSON-RPC Request has invalid subscribe params");let e=r.params;return Vn(e,"topic"),e}function iq(r){if(!od(r.method))throw new Error("JSON-RPC Request has invalid publish method");if(!ad(r.params))throw new Error("JSON-RPC Request has invalid publish params");let e=r.params;return Vn(e,"topic"),Vn(e,"message"),Vn(e,"ttl","number"),e}function nq(r){if(!ud(r.method))throw new Error("JSON-RPC Request has invalid unsubscribe method");if(!cd(r.params))throw new Error("JSON-RPC Request has invalid unsubscribe params");let e=r.params;return Vn(e,"id"),e}function sq(r){if(!ld(r.method))throw new Error("JSON-RPC Request has invalid subscription method");if(!fd(r.params))throw new Error("JSON-RPC Request has invalid subscription params");let e=r.params;return Vn(e,"id"),Vn(e,"data"),e}var D2=me(()=>{f();$w();Yw()});var oq,O2=me(()=>{f();oq={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 P2={};ot(P2,{RELAY_JSONRPC:()=>oq,isPublishMethod:()=>od,isPublishParams:()=>ad,isPublishRequest:()=>ZU,isSubscribeMethod:()=>nd,isSubscribeParams:()=>sd,isSubscribeRequest:()=>XU,isSubscriptionMethod:()=>ld,isSubscriptionParams:()=>fd,isSubscriptionRequest:()=>tq,isUnsubscribeMethod:()=>ud,isUnsubscribeParams:()=>cd,isUnsubscribeRequest:()=>eq,parsePublishRequest:()=>iq,parseSubscribeRequest:()=>rq,parseSubscriptionRequest:()=>sq,parseUnsubscribeRequest:()=>nq});var B2=me(()=>{f();N2();D2();O2();Yw()});var Ed=B(re=>{"use strict";f();Object.defineProperty(re,"__esModule",{value:!0});var V2=Nx(),aq=Rx(),H2=Tc(),Zw=Fx(),uq=Hx(),nt=($x(),at(Wx)),cq=a2(),Kc=Ys(),zc=zw(),lq=c2(),fq=T2(),hq=(B2(),at(P2));function Q2(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var j2=Q2(uq),hd=Q2(fq),gd=":";function G2(r){let[e,t]=r.split(gd);return{namespace:e,reference:t}}function K2(r){let{namespace:e,reference:t}=r;return[e,t].join(gd)}function e1(r){let[e,t,i]=r.split(gd);return{namespace:e,reference:t,address:i}}function z2(r){let{namespace:e,reference:t,address:i}=r;return[e,t,i].join(gd)}function t1(r,e){let t=[];return r.forEach(i=>{let n=e(i);t.includes(n)||t.push(n)}),t}function k2(r){let{address:e}=e1(r);return e}function W2(r){let{namespace:e,reference:t}=e1(r);return K2({namespace:e,reference:t})}function dq(r,e){let{namespace:t,reference:i}=G2(e);return z2({namespace:t,reference:i,address:r})}function pq(r){return t1(r,k2)}function $2(r){return t1(r,W2)}function gq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...n.accounts)}),t}function yq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...$2(n.accounts))}),t}function mq(r,e=[]){let t=[];return Object.keys(r).forEach(i=>{if(e.length&&!e.includes(i))return;let n=r[i];t.push(...kc(i,n))}),t}function kc(r,e){return r.includes(":")?[r]:e.chains||[]}var yd=r=>r?.split(":"),Y2=r=>{let e=r&&yd(r);if(e)return e[3]},wq=r=>{let e=r&&yd(r);if(e)return e[2]+":"+e[3]},J2=r=>{let e=r&&yd(r);if(e)return e.pop()},vq=(r,e)=>{let t=`${r.domain} wants you to sign in with your Ethereum account:`,i=J2(e),n=r.statement,s=`URI: ${r.aud}`,o=`Version: ${r.version}`,a=`Chain ID: ${Y2(e)}`,u=`Nonce: ${r.nonce}`,h=`Issued At: ${r.iat}`,p=r.resources&&r.resources.length>0?`Resources: ${r.resources.map(w=>`- ${w}`).join(` `)}`:void 0;return[t,i,"",n,"",s,o,a,u,h,p].filter(w=>w!=null).join(` -`)},r1="base10",dr="base16",dd="base64pad",md="utf8",i1=0,lu=1,vq=0,M2=1,Jw=12,n1=32;function Eq(){let r=j2.generateKeyPair();return{privateKey:nt.toString(r.secretKey,dr),publicKey:nt.toString(r.publicKey,dr)}}function Aq(){let r=H2.randomBytes(n1);return nt.toString(r,dr)}function Iq(r,e){let t=j2.sharedKey(nt.fromString(r,dr),nt.fromString(e,dr)),i=new oq.HKDF(Zw.SHA256,t).expand(n1);return nt.toString(i,dr)}function _q(r){let e=Zw.hash(nt.fromString(r,dr));return nt.toString(e,dr)}function bq(r){let e=Zw.hash(nt.fromString(r,md));return nt.toString(e,dr)}function X2(r){return nt.fromString(`${r}`,r1)}function Wc(r){return Number(nt.toString(r,r1))}function Cq(r){let e=X2(typeof r.type<"u"?r.type:i1);if(Wc(e)===lu&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof r.senderPublicKey<"u"?nt.fromString(r.senderPublicKey,dr):void 0,i=typeof r.iv<"u"?nt.fromString(r.iv,dr):H2.randomBytes(Jw),n=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)).seal(i,nt.fromString(r.message,md));return Z2({type:e,sealed:n,iv:i,senderPublicKey:t})}function Sq(r){let e=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)),{sealed:t,iv:i}=s1(r.encoded),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return nt.toString(n,md)}function Z2(r){if(Wc(r.type)===lu){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nt.toString(nt.concat([r.type,r.senderPublicKey,r.iv,r.sealed]),dd)}return nt.toString(nt.concat([r.type,r.iv,r.sealed]),dd)}function s1(r){let e=nt.fromString(r,dd),t=e.slice(vq,M2),i=M2;if(Wc(t)===lu){let a=i+n1,u=a+Jw,h=e.slice(i,a),p=e.slice(a,u),w=e.slice(u);return{type:t,sealed:w,iv:p,senderPublicKey:h}}let n=i+Jw,s=e.slice(i,n),o=e.slice(n);return{type:t,sealed:o,iv:s}}function xq(r,e){let t=s1(r);return eT({type:Wc(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?nt.toString(t.senderPublicKey,dr):void 0,receiverPublicKey:e?.receiverPublicKey})}function eT(r){let e=r?.type||i1;if(e===lu){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function Tq(r){return r.type===lu&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var Nq=Object.defineProperty,R2=Object.getOwnPropertySymbols,Dq=Object.prototype.hasOwnProperty,Oq=Object.prototype.propertyIsEnumerable,L2=(r,e,t)=>e in r?Nq(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F2=(r,e)=>{for(var t in e||(e={}))Dq.call(e,t)&&L2(r,t,e[t]);if(R2)for(var t of R2(e))Oq.call(e,t)&&L2(r,t,e[t]);return r},tT="ReactNative",cu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pd=" ",Pq=":",rT="/",o1=2,Bq=1e3,iT="js";function a1(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}function nT(){return!zc.getDocument()&&!!zc.getNavigator()&&navigator.product===tT}function sT(){return!a1()&&!!zc.getNavigator()}function u1(){return nT()?cu.reactNative:a1()?cu.node:sT()?cu.browser:cu.unknown}function oT(r,e){let t=hd.parse(r);return t=F2(F2({},t),e),r=hd.stringify(t),r}function Mq(){return cq.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Rq(r,e){var t;let i=u1(),n={protocol:r,version:e,env:i};return i==="browser"&&(n.host=((t=zc.getLocation())==null?void 0:t.host)||"unknown"),n}function aT(){let r=uq.detect();if(r===null)return"unknown";let e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function uT(){var r;let e=u1();return e===cu.browser?[e,((r=zc.getLocation())==null?void 0:r.host)||"unknown"].join(":"):e}function cT(r,e,t){let i=aT(),n=uT();return[[r,e].join("-"),[iT,t].join("-"),i,n].join("/")}function Lq({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s}){let o=t.split("?"),a=cT(r,e,i),u={auth:n,ua:a,projectId:s},h=oT(o[1]||"",u);return o[0]+"?"+h}function Fq(r){let e=(r.match(/^[^:]+(?=:\/\/)/gi)||[])[0],t=typeof e<"u"?r.split("://")[1]:r;return e=e==="wss"?"https":"http",[e,t].join("://")}function Uq(r,e,t){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function lT(r,e=o1){return fT(r.split(rT),e)}function qq(r){return lT(r).join(pd)}function on(r,e){return r.filter(t=>e.includes(t)).length===r.length}function fT(r,e=o1){return r.slice(Math.max(r.length-e,0))}function Vq(r){return Object.fromEntries(r.entries())}function Hq(r){return new Map(Object.entries(r))}function Qq(r,e){let t={};return Object.keys(r).forEach(i=>{t[i]=e(r[i])}),t}var jq=r=>r;function hT(r){return r.trim().replace(/^\w/,e=>e.toUpperCase())}function Gq(r){return r.split(pd).map(e=>hT(e)).join(pd)}function Kq(r){let e=Kc.toMiliseconds(r||Kc.FIVE_MINUTES),t,i,n;return{resolve:s=>{n&&t&&(clearTimeout(n),t(s))},reject:s=>{n&&i&&(clearTimeout(n),i(s))},done:()=>new Promise((s,o)=>{n=setTimeout(o,e),t=s,i=o})}}function zq(r,e){return new Promise(async(t,i)=>{let n=setTimeout(()=>i(),e),s=await r;clearTimeout(n),t(s)})}function c1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function kq(r){return c1("topic",r)}function Wq(r){return c1("id",r)}function $q(r){let[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Yq(r,e){return Kc.fromMiliseconds((e||Date.now())+Kc.toMiliseconds(r))}function Jq(r){return Date.now()>=Kc.toMiliseconds(r)}function Xq(r,e){return`${r}${e?`:${e}`:""}`}var dT="irn";function Zq(r){return r?.relay||{protocol:dT}}function eV(r){let e=fq.RELAY_JSONRPC[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var tV=Object.defineProperty,U2=Object.getOwnPropertySymbols,rV=Object.prototype.hasOwnProperty,iV=Object.prototype.propertyIsEnumerable,q2=(r,e,t)=>e in r?tV(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,nV=(r,e)=>{for(var t in e||(e={}))rV.call(e,t)&&q2(r,t,e[t]);if(U2)for(var t of U2(e))iV.call(e,t)&&q2(r,t,e[t]);return r};function pT(r,e="-"){let t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){let s=n.replace(i,""),o=r[n];t[s]=o}}),t}function sV(r){let e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",o=hd.parse(s);return{protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:pT(o)}}function gT(r,e="-"){let t="relay",i={};return Object.keys(r).forEach(n=>{let s=t+e+n;r[n]&&(i[s]=r[n])}),i}function oV(r){return`${r.protocol}:${r.topic}@${r.version}?`+hd.stringify(nV({symKey:r.symKey},gT(r.relay)))}function fu(r){let e=[];return r.forEach(t=>{let[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function yT(r){let e=[];return Object.values(r).forEach(t=>{e.push(...fu(t.accounts))}),e}function mT(r,e){let t=[];return Object.values(r).forEach(i=>{fu(i.accounts).includes(e)&&t.push(...i.methods)}),t}function wT(r,e){let t=[];return Object.values(r).forEach(i=>{fu(i.accounts).includes(e)&&t.push(...i.events)}),t}function aV(r,e){let t=CT(r,e);if(t)throw new Error(t.message);let i={};for(let[n,s]of Object.entries(r))i[n]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return i}var uV={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}},cV={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 Vn(r,e){let{message:t,code:i}=cV[r];return{message:e?`${t} ${e}`:t,code:i}}function io(r,e){let{message:t,code:i}=uV[r];return{message:e?`${t} ${e}`:t,code:i}}function $c(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function l1(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Hn(r){return typeof r>"u"}function Sr(r,e){return e&&Hn(r)?!0:typeof r=="string"&&Boolean(r.trim().length)}function wd(r,e){return e&&Hn(r)?!0:typeof r=="number"&&!isNaN(r)}function lV(r,e){let{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t),s=!0;return on(n,i)?(i.forEach(o=>{let{accounts:a,methods:u,events:h}=r.namespaces[o],p=fu(a),w=t[o];(!on(kc(o,w),p)||!on(w.methods,u)||!on(w.events,h))&&(s=!1)}),s):!1}function vd(r){return Sr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function vT(r){if(Sr(r,!1)&&r.includes(":")){let e=r.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&vd(t)}}return!1}function fV(r){if(Sr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function hV(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function dV(r){return r?.topic}function pV(r,e){let t=null;return Sr(r?.publicKey,!1)||(t=Vn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Xw(r){let e=!0;return $c(r)?r.length&&(e=r.every(t=>Sr(t,!1))):e=!1,e}function ET(r,e,t){let i=null;return $c(e)?e.forEach(n=>{i||(!vd(n)||!n.includes(r))&&(i=io("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):i=io("UNSUPPORTED_CHAINS",`${t}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),i}function AT(r,e){let t=null;return Object.entries(r).forEach(([i,n])=>{if(t)return;let s=ET(i,kc(i,n),`${e} requiredNamespace`);s&&(t=s)}),t}function IT(r,e){let t=null;return $c(r)?r.forEach(i=>{t||vT(i)||(t=io("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=io("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function _T(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=IT(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function bT(r,e){let t=null;return Xw(r?.methods)?Xw(r?.events)||(t=io("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=io("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function f1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=bT(i,`${e}, namespace`);n&&(t=n)}),t}function gV(r,e,t){let i=null;if(r&&l1(r)){let n=f1(r,e);n&&(i=n);let s=AT(r,e);s&&(i=s)}else i=Vn("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function CT(r,e){let t=null;if(r&&l1(r)){let i=f1(r,e);i&&(t=i);let n=_T(r,e);n&&(t=n)}else t=Vn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function ST(r){return Sr(r.protocol,!0)}function yV(r,e){let t=!1;return e&&!r?t=!0:r&&$c(r)&&r.length&&r.forEach(i=>{t=ST(i)}),t}function mV(r){return typeof r=="number"}function wV(r){return typeof r<"u"&&typeof r!==null}function vV(r){return!(!r||typeof r!="object"||!r.code||!wd(r.code,!1)||!r.message||!Sr(r.message,!1))}function EV(r){return!(Hn(r)||!Sr(r.method,!1))}function AV(r){return!(Hn(r)||Hn(r.result)&&Hn(r.error)||!wd(r.id,!1)||!Sr(r.jsonrpc,!1))}function IV(r){return!(Hn(r)||!Sr(r.name,!1))}function _V(r,e){return!(!vd(e)||!yT(r).includes(e))}function bV(r,e,t){return Sr(t,!1)?mT(r,e).includes(t):!1}function CV(r,e,t){return Sr(t,!1)?wT(r,e).includes(t):!1}function SV(r,e,t,i){let n=null,s=Object.keys(r),o=Object.keys(e);return on(s,o)?s.forEach(a=>{if(n)return;let u=fu(e[a].accounts);on(kc(a,r[a]),u)?on(r[a].methods,e[a].methods)?on(r[a].events,e[a].events)||(n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${a}`)):n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${a}`):n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace chains for ${a}`)}):n=Vn("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy ${i}`),n}function xV(r,e){return wd(r,!1)&&r<=e.max&&r>=e.min}re.BASE10=r1,re.BASE16=dr,re.BASE64=dd,re.COLON=Pq,re.DEFAULT_DEPTH=o1,re.EMPTY_SPACE=pd,re.ENV_MAP=cu,re.ONE_THOUSAND=Bq,re.REACT_NATIVE_PRODUCT=tT,re.RELAYER_DEFAULT_PROTOCOL=dT,re.SDK_TYPE=iT,re.SLASH=rT,re.TYPE_0=i1,re.TYPE_1=lu,re.UTF8=md,re.appendToQueryString=oT,re.assertType=Uq,re.calcExpiry=Yq,re.capitalize=Gq,re.capitalizeWord=hT,re.createDelayedPromise=Kq,re.createExpiringPromise=zq,re.decodeTypeByte=Wc,re.decrypt=Sq,re.deriveSymKey=Iq,re.deserialize=s1,re.encodeTypeByte=X2,re.encrypt=Cq,re.engineEvent=Xq,re.enumify=jq,re.formatAccountId=z2,re.formatAccountWithChain=hq,re.formatChainId=K2,re.formatExpirerTarget=c1,re.formatIdTarget=Wq,re.formatMessage=wq,re.formatMessageContext=qq,re.formatRelayParams=gT,re.formatRelayRpcUrl=Lq,re.formatTopicTarget=kq,re.formatUA=cT,re.formatUri=oV,re.generateKeyPair=Eq,re.generateRandomBytes32=Aq,re.getAccountsChains=fu,re.getAccountsFromNamespaces=pq,re.getAddressFromAccount=k2,re.getAddressesFromAccounts=dq,re.getAppMetadata=Mq,re.getChainFromAccount=W2,re.getChainsFromAccounts=$2,re.getChainsFromNamespace=kc,re.getChainsFromNamespaces=gq,re.getChainsFromRequiredNamespaces=yq,re.getDidAddress=J2,re.getDidAddressSegments=yd,re.getDidChainId=Y2,re.getEnvironment=u1,re.getHttpUrl=Fq,re.getInternalError=Vn,re.getJavascriptID=uT,re.getJavascriptOS=aT,re.getLastItems=fT,re.getNamespacedDidChainId=mq,re.getNamespacesChains=yT,re.getNamespacesEventsForChainId=wT,re.getNamespacesMethodsForChainId=mT,re.getRelayClientMetadata=Rq,re.getRelayProtocolApi=eV,re.getRelayProtocolName=Zq,re.getRequiredNamespacesFromNamespaces=aV,re.getSdkError=io,re.getUniqueValues=t1,re.hasOverlap=on,re.hashKey=_q,re.hashMessage=bq,re.isBrowser=sT,re.isConformingNamespaces=SV,re.isExpired=Jq,re.isNode=a1,re.isProposalStruct=hV,re.isReactNative=nT,re.isSessionCompatible=lV,re.isSessionStruct=dV,re.isTypeOneEnvelope=Tq,re.isUndefined=Hn,re.isValidAccountId=vT,re.isValidAccounts=IT,re.isValidActions=bT,re.isValidArray=$c,re.isValidChainId=vd,re.isValidChains=ET,re.isValidController=pV,re.isValidErrorReason=vV,re.isValidEvent=IV,re.isValidId=mV,re.isValidNamespaceAccounts=_T,re.isValidNamespaceActions=f1,re.isValidNamespaceChains=AT,re.isValidNamespaceMethodsOrEvents=Xw,re.isValidNamespaces=CT,re.isValidNamespacesChainId=_V,re.isValidNamespacesEvent=CV,re.isValidNamespacesRequest=bV,re.isValidNumber=wd,re.isValidObject=l1,re.isValidParams=wV,re.isValidRelay=ST,re.isValidRelays=yV,re.isValidRequest=EV,re.isValidRequestExpiry=xV,re.isValidRequiredNamespaces=gV,re.isValidResponse=AV,re.isValidString=Sr,re.isValidUrl=fV,re.mapEntries=Qq,re.mapToObj=Vq,re.objToMap=Hq,re.parseAccountId=e1,re.parseChainId=G2,re.parseContextNames=lT,re.parseExpirerTarget=$q,re.parseRelayParams=pT,re.parseUri=sV,re.serialize=Z2,re.validateDecoding=xq,re.validateEncoding=eT});var xT,TT,NT,DT,Ad,Yc,h1,Id,Qn,Jc,_d=me(()=>{f();xT="PARSE_ERROR",TT="INVALID_REQUEST",NT="METHOD_NOT_FOUND",DT="INVALID_PARAMS",Ad="INTERNAL_ERROR",Yc="SERVER_ERROR",h1=[-32700,-32600,-32601,-32602,-32603],Id=[-32e3,-32099],Qn={[xT]:{code:-32700,message:"Parse error"},[TT]:{code:-32600,message:"Invalid Request"},[NT]:{code:-32601,message:"Method not found"},[DT]:{code:-32602,message:"Invalid params"},[Ad]:{code:-32603,message:"Internal error"},[Yc]:{code:-32e3,message:"Server error"}},Jc=Yc});function TV(r){return r<=Id[0]&&r>=Id[1]}function bd(r){return h1.includes(r)}function OT(r){return typeof r=="number"}function Cd(r){return Object.keys(Qn).includes(r)?Qn[r]:Qn[Jc]}function Sd(r){let e=Object.values(Qn).find(t=>t.code===r);return e||Qn[Jc]}function NV(r){if(typeof r.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof r.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!OT(r.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${r.error.code}`};if(bd(r.error.code)){let e=Sd(r.error.code);if(e.message!==Qn[Jc].message&&r.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${r.error.code}`}}return{valid:!0}}function d1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var p1=me(()=>{f();_d()});var BT=B(jn=>{"use strict";f();Object.defineProperty(jn,"__esModule",{value:!0});jn.isBrowserCryptoAvailable=jn.getSubtleCrypto=jn.getBrowerCrypto=void 0;function g1(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}jn.getBrowerCrypto=g1;function PT(){let r=g1();return r.subtle||r.webkitSubtle}jn.getSubtleCrypto=PT;function DV(){return!!g1()&&!!PT()}jn.isBrowserCryptoAvailable=DV});var LT=B(Gn=>{"use strict";f();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.isBrowser=Gn.isNode=Gn.isReactNative=void 0;function MT(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Gn.isReactNative=MT;function RT(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}Gn.isNode=RT;function OV(){return!MT()&&!RT()}Gn.isBrowser=OV});var y1=B(xd=>{"use strict";f();Object.defineProperty(xd,"__esModule",{value:!0});var FT=(br(),at(_r));FT.__exportStar(BT(),xd);FT.__exportStar(LT(),xd)});var $t={};ot($t,{isNodeJs:()=>qT});var UT,qT,VT=me(()=>{f();UT=_e(y1());er($t,_e(y1()));qT=UT.isNode});function HT(){let r=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return r+e}function m1(r,e,t){return{id:t||HT(),jsonrpc:"2.0",method:r,params:e}}function PV(r,e){return{id:r,jsonrpc:"2.0",result:e}}function w1(r,e,t){return{id:r,jsonrpc:"2.0",error:QT(e,t)}}function QT(r,e){return typeof r>"u"?Cd(Ad):(typeof r=="string"&&(r=Object.assign(Object.assign({},Cd(Yc)),{message:r})),typeof e<"u"&&(r.data=e),bd(r.code)&&(r=Sd(r.code)),r)}var jT=me(()=>{f();p1();_d()});function BV(r){return r.includes("*")?Nd(r):!/\W/g.test(r)}function Td(r){return r==="*"}function Nd(r){return Td(r)?!0:!(!r.includes("*")||r.split("*").length!==2||r.split("*").filter(e=>e.trim()==="").length!==1)}function MV(r){return!Td(r)&&Nd(r)&&!r.split("*")[0].trim()}function RV(r){return!Td(r)&&Nd(r)&&!r.split("*")[1].trim()}var GT=me(()=>{f()});var KT=me(()=>{f()});var hu,v1=me(()=>{f();hu=class{}});var E1,Dd,Xc,zT=me(()=>{f();v1();E1=class extends hu{constructor(e){super()}},Dd=class extends hu{constructor(){super()}},Xc=class extends Dd{constructor(e){super()}}});var kT=me(()=>{f()});var WT=me(()=>{f();KT();v1();zT();kT()});var $T=me(()=>{f();WT()});function UV(r){let e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function YT(r,e){let t=UV(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function qV(r){return YT(r,LV)}function Od(r){return YT(r,FV)}function A1(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}var LV,FV,JT=me(()=>{f();LV="^https?:",FV="^wss?:"});function I1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function VV(r){return I1(r)&&"method"in r}function _1(r){return I1(r)&&(XT(r)||Pd(r))}function XT(r){return"result"in r}function Pd(r){return"error"in r}function HV(r){return"error"in r&&r.valid===!1}var ZT=me(()=>{f()});var lr={};ot(lr,{DEFAULT_ERROR:()=>Jc,IBaseJsonRpcProvider:()=>Dd,IEvents:()=>hu,IJsonRpcConnection:()=>E1,IJsonRpcProvider:()=>Xc,INTERNAL_ERROR:()=>Ad,INVALID_PARAMS:()=>DT,INVALID_REQUEST:()=>TT,METHOD_NOT_FOUND:()=>NT,PARSE_ERROR:()=>xT,RESERVED_ERROR_CODES:()=>h1,SERVER_ERROR:()=>Yc,SERVER_ERROR_CODE_RANGE:()=>Id,STANDARD_ERROR_MAP:()=>Qn,formatErrorMessage:()=>QT,formatJsonRpcError:()=>w1,formatJsonRpcRequest:()=>m1,formatJsonRpcResult:()=>PV,getError:()=>Cd,getErrorByCode:()=>Sd,isHttpUrl:()=>qV,isJsonRpcError:()=>Pd,isJsonRpcPayload:()=>I1,isJsonRpcRequest:()=>VV,isJsonRpcResponse:()=>_1,isJsonRpcResult:()=>XT,isJsonRpcValidationInvalid:()=>HV,isLocalhostUrl:()=>A1,isNodeJs:()=>qT,isReservedErrorCode:()=>bd,isServerErrorCode:()=>TV,isValidDefaultRoute:()=>Td,isValidErrorCode:()=>OT,isValidLeadingWildcardRoute:()=>MV,isValidRoute:()=>BV,isValidTrailingWildcardRoute:()=>RV,isValidWildcardRoute:()=>Nd,isWsUrl:()=>Od,parseConnectionError:()=>d1,payloadId:()=>HT,validateJsonRpcError:()=>NV});var Zc=me(()=>{f();_d();p1();VT();er(lr,$t);jT();GT();$T();JT();ZT()});var eN,Bd,tN,b1=me(()=>{f();eN=_e($s());Zc();Bd=class extends Xc{constructor(e){super(e),this.events=new eN.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(m1(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Pd(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),_1(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}},tN=Bd});var rN={};ot(rN,{JsonRpcProvider:()=>Bd,default:()=>QV});var QV,iN=me(()=>{f();b1();b1();QV=tN});var sN=B((jte,nN)=>{"use strict";f();nN.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var aN,oN,jV,GV,KV,Md,uN,C1=me(()=>{f();aN=_e($s());xh();Zc();oN=10,jV=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:sN(),GV=()=>typeof window<"u",KV=jV(),Md=class{constructor(e){if(this.url=e,this.events=new aN.EventEmitter,this.registering=!1,!Od(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=()=>{this.onClose(),e()},this.socket.close()})}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(xc(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Od(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,lr.isReactNative)()?void 0:{rejectUnauthorized:!A1(e)},s=new KV(e,[],n);GV()?s.onerror=o=>{let a=o;i(this.emitError(a.error))}:s.on("error",o=>{i(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=()=>this.onClose(),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t=typeof e.data=="string"?Sc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let i=this.parseError(t),n=i.message||i.toString(),s=w1(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return d1(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>oN&&this.events.setMaxListeners(oN)}emitError(e){let t=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",t),t}},uN=Md});var cN={};ot(cN,{WsConnection:()=>Md,default:()=>zV});var zV,lN=me(()=>{f();C1();C1();zV=uN});var KN=B((el,pu)=>{f();var kV=200,L1="__lodash_hash_undefined__",Qd=1,IN=2,_N=9007199254740991,Rd="[object Arguments]",N1="[object Array]",WV="[object AsyncFunction]",bN="[object Boolean]",CN="[object Date]",SN="[object Error]",xN="[object Function]",$V="[object GeneratorFunction]",Ld="[object Map]",TN="[object Number]",YV="[object Null]",du="[object Object]",fN="[object Promise]",JV="[object Proxy]",NN="[object RegExp]",Fd="[object Set]",DN="[object String]",XV="[object Symbol]",ZV="[object Undefined]",D1="[object WeakMap]",ON="[object ArrayBuffer]",Ud="[object DataView]",e7="[object Float32Array]",t7="[object Float64Array]",r7="[object Int8Array]",i7="[object Int16Array]",n7="[object Int32Array]",s7="[object Uint8Array]",o7="[object Uint8ClampedArray]",a7="[object Uint16Array]",u7="[object Uint32Array]",c7=/[\\^$.*+?()[\]{}|]/g,l7=/^\[object .+?Constructor\]$/,f7=/^(?:0|[1-9]\d*)$/,Xe={};Xe[e7]=Xe[t7]=Xe[r7]=Xe[i7]=Xe[n7]=Xe[s7]=Xe[o7]=Xe[a7]=Xe[u7]=!0;Xe[Rd]=Xe[N1]=Xe[ON]=Xe[bN]=Xe[Ud]=Xe[CN]=Xe[SN]=Xe[xN]=Xe[Ld]=Xe[TN]=Xe[du]=Xe[NN]=Xe[Fd]=Xe[DN]=Xe[D1]=!1;var PN=typeof global=="object"&&global&&global.Object===Object&&global,h7=typeof self=="object"&&self&&self.Object===Object&&self,an=PN||h7||Function("return this")(),BN=typeof el=="object"&&el&&!el.nodeType&&el,hN=BN&&typeof pu=="object"&&pu&&!pu.nodeType&&pu,MN=hN&&hN.exports===BN,S1=MN&&PN.process,dN=function(){try{return S1&&S1.binding&&S1.binding("util")}catch{}}(),pN=dN&&dN.isTypedArray;function d7(r,e){for(var t=-1,i=r==null?0:r.length,n=0,s=[];++t-1}function j7(r,e){var t=this.__data__,i=Gd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}un.prototype.clear=q7;un.prototype.delete=V7;un.prototype.get=H7;un.prototype.has=Q7;un.prototype.set=j7;function oo(r){var e=-1,t=r==null?0:r.length;for(this.clear();++ea))return!1;var h=s.get(r);if(h&&s.get(e))return h==e;var p=-1,w=!0,N=t&IN?new Vd:void 0;for(s.set(r,e),s.set(e,r);++p-1&&r%1==0&&r-1&&r%1==0&&r<=_N}function jN(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function il(r){return r!=null&&typeof r=="object"}var GN=pN?m7(pN):oH;function EH(r){return wH(r)?rH(r):aH(r)}function AH(){return[]}function IH(){return!1}pu.exports=vH});var z3=B(Ee=>{"use strict";f();Object.defineProperty(Ee,"__esModule",{value:!0});var uo=$s(),_H=lh(),bH=TC(),ip=GC(),st=bm(),kn=Hm(),zN=(xh(),at(JC)),CH=(Ax(),at(Ex)),fe=Ed(),Ht=Ys(),SH=(iN(),at(rN)),ti=(Zc(),at(lr)),xH=(lN(),at(cN)),TH=KN();function ol(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}function NH(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var DH=ol(uo),c3=ol(_H),OH=ol(bH),zd=NH(CH),PH=ol(xH),BH=ol(TH);function MH(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var RH=MH,LH=RH,l3=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},FH=r=>new TextEncoder().encode(r),UH=r=>new TextDecoder().decode(r),q1=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},V1=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 f3(this,e)}},H1=class{constructor(e){this.decoders=e}or(e){return f3(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},f3=(r,e)=>new H1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Q1=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new q1(e,t,i),this.decoder=new V1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},np=({name:r,prefix:e,encode:t,decode:i})=>new Q1(r,e,t,i),al=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=LH(t,e);return np({prefix:r,name:e,encode:i,decode:s=>l3(n(s))})},qH=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},VH=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<np({prefix:e,name:r,encode(n){return VH(n,i,t)},decode(n){return qH(n,i,t,r)}}),HH=np({prefix:"\0",name:"identity",encode:r=>UH(r),decode:r=>FH(r)}),QH=Object.freeze({__proto__:null,identity:HH}),jH=tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),GH=Object.freeze({__proto__:null,base2:jH}),KH=tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),zH=Object.freeze({__proto__:null,base8:KH}),kH=al({prefix:"9",name:"base10",alphabet:"0123456789"}),WH=Object.freeze({__proto__:null,base10:kH}),$H=tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),YH=tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),JH=Object.freeze({__proto__:null,base16:$H,base16upper:YH}),XH=tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ZH=tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),eQ=tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tQ=tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rQ=tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iQ=tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nQ=tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sQ=tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),oQ=tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),aQ=Object.freeze({__proto__:null,base32:XH,base32upper:ZH,base32pad:eQ,base32padupper:tQ,base32hex:rQ,base32hexupper:iQ,base32hexpad:nQ,base32hexpadupper:sQ,base32z:oQ}),uQ=al({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cQ=al({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),lQ=Object.freeze({__proto__:null,base36:uQ,base36upper:cQ}),fQ=al({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hQ=al({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),dQ=Object.freeze({__proto__:null,base58btc:fQ,base58flickr:hQ}),pQ=tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gQ=tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),yQ=tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mQ=tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),wQ=Object.freeze({__proto__:null,base64:pQ,base64pad:gQ,base64url:yQ,base64urlpad:mQ}),h3=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}"),vQ=h3.reduce((r,e,t)=>(r[t]=e,r),[]),EQ=h3.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function AQ(r){return r.reduce((e,t)=>(e+=vQ[t],e),"")}function IQ(r){let e=[];for(let t of r){let i=EQ[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var _Q=np({prefix:"\u{1F680}",name:"base256emoji",encode:AQ,decode:IQ}),bQ=Object.freeze({__proto__:null,base256emoji:_Q}),CQ=d3,kN=128,SQ=127,xQ=~SQ,TQ=Math.pow(2,31);function d3(r,e,t){e=e||[],t=t||0;for(var i=t;r>=TQ;)e[t++]=r&255|kN,r/=128;for(;r&xQ;)e[t++]=r&255|kN,r>>>=7;return e[t]=r|0,d3.bytes=t-i+1,e}var NQ=j1,DQ=128,WN=127;function j1(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw j1.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WN)<=DQ);return j1.bytes=s-i,t}var OQ=Math.pow(2,7),PQ=Math.pow(2,14),BQ=Math.pow(2,21),MQ=Math.pow(2,28),RQ=Math.pow(2,35),LQ=Math.pow(2,42),FQ=Math.pow(2,49),UQ=Math.pow(2,56),qQ=Math.pow(2,63),VQ=function(r){return r(p3.encode(r,e,t),e),YN=r=>p3.encodingLength(r),G1=(r,e)=>{let t=e.byteLength,i=YN(r),n=i+YN(t),s=new Uint8Array(n+t);return $N(r,s,0),$N(t,s,i),s.set(e,n),new K1(r,t,e,s)},K1=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}},g3=({name:r,code:e,encode:t})=>new z1(r,e,t),z1=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?G1(this.code,t):t.then(i=>G1(this.code,i))}else throw Error("Unknown type, must be binary type")}},y3=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),QQ=g3({name:"sha2-256",code:18,encode:y3("SHA-256")}),jQ=g3({name:"sha2-512",code:19,encode:y3("SHA-512")}),GQ=Object.freeze({__proto__:null,sha256:QQ,sha512:jQ}),m3=0,KQ="identity",w3=l3,zQ=r=>G1(m3,w3(r)),kQ={code:m3,name:KQ,encode:w3,digest:zQ},WQ=Object.freeze({__proto__:null,identity:kQ});new TextEncoder,new TextDecoder;var JN={...QH,...GH,...zH,...WH,...JH,...aQ,...lQ,...dQ,...wQ,...bQ};({...GQ,...WQ});function $Q(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function v3(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var XN=v3("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),F1=v3("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=$Q(r.length);for(let t=0;t{if(!this.initialized){let i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();let n=this.keychain.get(i);if(typeof n>"u"){let{message:s}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$d=class{constructor(e,t,i){this.core=e,this.logger=t,this.name=_3,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();let n=await this.getClientSeed(),s=zd.generateKeyPair(n);return zd.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let n=fe.generateKeyPair();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();let s=await this.getClientSeed(),o=zd.generateKeyPair(s),a=fe.generateRandomBytes32(),u=b3;return await zd.signJWT(a,n,u,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();let a=this.getPrivateKey(n),u=fe.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();let o=s||fe.hashKey(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();let a=fe.validateEncoding(o),u=zN.safeJsonStringify(s);if(fe.isTypeOneEnvelope(a)){let N=a.senderPublicKey,O=a.receiverPublicKey;n=await this.generateSharedKey(N,O)}let h=this.getSymKey(n),{type:p,senderPublicKey:w}=a;return fe.encrypt({type:p,symKey:h,message:u,senderPublicKey:w})},this.decode=async(n,s,o)=>{this.isInitialized();let a=fe.validateDecoding(s,o);if(fe.isTypeOneEnvelope(a)){let p=a.receiverPublicKey,w=a.senderPublicKey;n=await this.generateSharedKey(p,w)}let u=this.getSymKey(n),h=fe.decrypt({symKey:u,encoded:s});return zN.safeJsonParse(h)},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.keychain=i||new Wd(this.core,this.logger)}get context(){return st.getLoggerContext(this.logger)}getPayloadType(e){let t=fe.deserialize(e);return fe.decodeTypeByte(t.type)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(k1)}catch{e=fe.generateRandomBytes32(),await this.keychain.set(k1,e)}return JQ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Yd=class extends kn.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=x3,this.version=T3,this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();let s=fe.hashMessage(n),o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();let s=this.get(i),o=fe.hashMessage(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=st.generateChildLogger(e,this.name),this.core=t}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$1=class extends kn.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new uo.EventEmitter,this.name=D3,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(i,n,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});try{let o=s?.ttl||N3,a=fe.getRelayProtocolName(s),u=s?.prompt||!1,h=s?.tag||0,p={topic:i,message:n,opts:{ttl:o,relay:a,prompt:u,tag:h}},w=fe.hashMessage(n);this.queue.set(w,p);try{await await fe.createExpiringPromise(this.rpcPublish(i,n,o,a,u,h),this.publishTimeout),this.relayer.events.emit(fr.publish,p)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(fr.connection_stalled);return}this.onPublish(w,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return st.getLoggerContext(this.logger)}rpcPublish(e,t,i,n,s,o){var a,u,h,p;let w={method:fe.getRelayProtocolApi(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o}};return fe.isUndefined((a=w.params)==null?void 0:a.prompt)&&((u=w.params)==null||delete u.prompt),fe.isUndefined((h=w.params)==null?void 0:h.tag)&&((p=w.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:w}),this.relayer.provider.request(w)}onPublish(e,t){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},Y1=class{constructor(){this.map=new Map,this.set=(e,t)=>{let i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let i=this.get(e);if(!this.exists(e,t))return;let n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,ZN=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,e3=(r,e,t)=>e in r?r9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kd=(r,e)=>{for(var t in e||(e={}))s9.call(e,t)&&e3(r,t,e[t]);if(ZN)for(var t of ZN(e))o9.call(e,t)&&e3(r,t,e[t]);return r},U1=(r,e)=>i9(r,n9(e)),Jd=class extends kn.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Y1,this.events=new uo.EventEmitter,this.name=F3,this.version=U3,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=cn,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{let s=fe.getRelayProtocolName(n),o={topic:i,relay:s};this.pending.set(i,o);let a=await this.rpcSubscribe(i,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((n,s)=>{let o=new Ht.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),n(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=q3&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.clientId=""}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,t){let i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{let n=fe.getRelayProtocolName(i);await this.rpcUnsubscribe(e,t,n);let s=fe.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t){let i={method:fe.getRelayProtocolApi(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await fe.createExpiringPromise(this.relayer.provider.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(fr.connection_stalled)}return fe.hashMessage(e+this.clientId)}rpcUnsubscribe(e,t,i){let n={method:fe.getRelayProtocolApi(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.provider.request(n)}onSubscribe(e,t){this.setSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}onResubscribe(e,t){this.addSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,kd({},t)),this.topicMap.set(t.topic,e),this.events.emit(ei.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ei.deleted,U1(kd({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ei.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(ei.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}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 resubscribe(e){if(!this.ids.includes(e.id)){let{topic:t,relay:i}=e,n={topic:t,relay:i};this.pending.set(n.topic,n);let s=await this.rpcSubscribe(n.topic,n.relay);this.onResubscribe(s,n)}}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{let t=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(fr.connect,async()=>{await this.onConnect()}),this.relayer.on(fr.disconnect,()=>{this.onDisconnect()}),this.events.on(ei.created,async e=>{let t=ei.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(ei.deleted,async e=>{let t=ei.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}},a9=Object.defineProperty,t3=Object.getOwnPropertySymbols,u9=Object.prototype.hasOwnProperty,c9=Object.prototype.propertyIsEnumerable,r3=(r,e,t)=>e in r?a9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,l9=(r,e)=>{for(var t in e||(e={}))u9.call(e,t)&&r3(r,t,e[t]);if(t3)for(var t of t3(e))c9.call(e,t)&&r3(r,t,e[t]);return r},Xd=class extends kn.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new uo.EventEmitter,this.name=B3,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?st.generateChildLogger(e.logger,this.name):c3.default(st.getDefaultLoggerOptions({level:e.logger||P3})),this.messages=new Yd(this.logger,e.core),this.subscriber=new Jd(this,this.logger),this.publisher=new $1(this,this.logger),this.relayUrl=e?.relayUrl||X1,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return st.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t})}async subscribe(e,t){this.isInitialized();let i="";return await Promise.all([new Promise(n=>{this.subscriber.once(ei.created,s=>{s.topic===e&&n()})}),new Promise(async n=>{i=await this.subscriber.subscribe(e,t),n()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(fr.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(t=>{this.initialized||t(),this.subscriber.once(ei.resubscribed,()=>{t()})}),await Promise.race([new Promise(async t=>{await this.provider.connect(),this.removeListener(fr.transport_closed,this.rejectTransportOpen),t()}),new Promise(t=>this.once(fr.transport_closed,this.rejectTransportOpen))])])}catch(t){let i=t;if(!/socket hang up/i.test(i.message))throw t;this.logger.error(t),this.events.emit(fr.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(await this.transportClose(),await new Promise(t=>setTimeout(t,W1)),await this.transportOpen(e))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);return new SH.JsonRpcProvider(new PH.default(fe.formatRelayRpcUrl({sdkVersion:R3,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){let{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){let{topic:t,message:i}=e;return await this.subscriber.isSubscribed(t)?this.messages.has(t,i):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ti.isJsonRpcRequest(e)){if(!e.method.endsWith(M3))return;let t=e.params,{topic:i,message:n}=t.data,s={topic:i,message:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(l9({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(fr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=ti.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}registerEventListeners(){this.provider.on(sl.payload,e=>this.onProviderPayload(e)),this.provider.on(sl.connect,()=>{this.events.emit(fr.connect)}),this.provider.on(sl.disconnect,()=>{this.events.emit(fr.disconnect),this.attemptToReconnect()}),this.provider.on(sl.error,e=>this.events.emit(fr.error,e)),this.events.on(fr.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Ht.toMiliseconds(W1))}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},f9=Object.defineProperty,i3=Object.getOwnPropertySymbols,h9=Object.prototype.hasOwnProperty,d9=Object.prototype.propertyIsEnumerable,n3=(r,e,t)=>e in r?f9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,s3=(r,e)=>{for(var t in e||(e={}))h9.call(e,t)&&n3(r,t,e[t]);if(i3)for(var t of i3(e))d9.call(e,t)&&n3(r,t,e[t]);return r},Zd=class extends kn.IStore{constructor(e,t,i,n=cn,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=L3,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{fe.isProposalStruct(o)?this.map.set(o.id,o):fe.isSessionStruct(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!fe.isUndefined(o)&&this.map.set(this.getKey(o),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=>BH.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=s3(s3({},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=st.generateChildLogger(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 t=this.map.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ep=class{constructor(e,t){this.core=e,this.logger=t,this.name=V3,this.version=H3,this.events=new DH.default,this.initialized=!1,this.storagePrefix=cn,this.ignoredPayloadTypes=[fe.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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();let i=fe.generateRandomBytes32(),n=await this.core.crypto.setSymKey(i),s=fe.calcExpiry(Ht.FIVE_MINUTES),o={protocol:O3},a={topic:n,expiry:s,relay:o,active:!1},u=fe.formatUri({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:i,relay:o});return await this.pairings.set(n,a),await this.core.relayer.subscribe(n),this.core.expirer.set(n,s),{topic:n,uri:u}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);let{topic:n,symKey:s,relay:o}=fe.parseUri(i.uri),a=fe.calcExpiry(Ht.FIVE_MINUTES),u={topic:n,relay:o,expiry:a,active:!1};return await this.pairings.set(n,u),await this.core.crypto.setSymKey(s,n),await this.core.relayer.subscribe(n,{relay:o}),this.core.expirer.set(n,a),i.activatePairing&&await this.activate({topic:n}),u},this.activate=async({topic:i})=>{this.isInitialized();let n=fe.calcExpiry(Ht.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:n}),this.core.expirer.set(i,n)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);let{topic:n}=i;if(this.pairings.keys.includes(n)){let s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=fe.createDelayedPromise();this.events.once(fe.engineEvent("pairing_ping",s),({error:h})=>{h?u(h):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);let{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",fe.getSdkError("USER_DISCONNECTED")),await this.deletePairing(n))},this.sendRequest=async(i,n,s)=>{let o=ti.formatJsonRpcRequest(n,s),a=await this.core.crypto.encode(i,o),u=yu[n].req;return this.core.history.set(i,o),await this.core.relayer.publish(i,a,u),o.id},this.sendResult=async(i,n,s)=>{let o=ti.formatJsonRpcResult(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=yu[u.request.method].res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{let o=ti.formatJsonRpcError(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=yu[u.request.method]?yu[u.request.method].res:yu.unregistered_method.res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,fe.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{let i=this.pairings.getAll().filter(n=>fe.isExpired(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{let{topic:n,payload:s}=i,o=s.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{let{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{let{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit("pairing_ping",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{let{id:s}=n;setTimeout(()=>{ti.isJsonRpcResult(n)?this.events.emit(fe.engineEvent("pairing_ping",s),{}):ti.isJsonRpcError(n)&&this.events.emit(fe.engineEvent("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{let{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.sendResult(s,i,!0),await this.deletePairing(i),this.events.emit("pairing_delete",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{let{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;let a=fe.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(fe.getSdkError("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!fe.isValidParams(i)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!fe.isValidUrl(i.uri)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}},this.isValidPing=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!fe.isValidString(i,!1)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){let{message:n}=fe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(fe.isExpired(this.pairings.get(i).expiry)){await this.deletePairing(i);let{message:n}=fe.getInternalError("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.pairings=new Zd(this.core,this.logger,this.name,this.storagePrefix)}get context(){return st.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(fr.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;let n=await this.core.crypto.decode(t,i);ti.isJsonRpcRequest(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):ti.isJsonRpcResponse(n)&&(await this.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:t}=fe.parseExpirerTarget(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}},tp=class extends kn.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new uo.EventEmitter,this.name=Q3,this.version=j3,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;let o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Zr.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;let n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ti.isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.events.emit(Zr.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Zr.deleted,s)}})},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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(t=>{if(typeof t.response<"u")return;let i={topic:t.topic,request:ti.formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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(Zr.created,e=>{let t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{let t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{let t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},rp=class extends kn.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new uo.EventEmitter,this.name=G3,this.version=K3,this.cached=[],this.initialized=!1,this.storagePrefix=cn,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{let n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();let s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Vr.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();let n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){let n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Vr.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 fe.formatTopicTarget(e);if(typeof e=="number")return fe.formatIdTarget(e);let{message:t}=fe.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 t=this.expirations.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){let{expiry:i}=t;Ht.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let t=Vr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let t=Vr.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let t=Vr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},p9=Object.defineProperty,o3=Object.getOwnPropertySymbols,g9=Object.prototype.hasOwnProperty,y9=Object.prototype.propertyIsEnumerable,a3=(r,e,t)=>e in r?p9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,u3=(r,e)=>{for(var t in e||(e={}))g9.call(e,t)&&a3(r,t,e[t]);if(o3)for(var t of o3(e))y9.call(e,t)&&a3(r,t,e[t]);return r},mu=class extends kn.ICore{constructor(e){super(e),this.protocol=J1,this.version=E3,this.name=sp,this.events=new uo.EventEmitter,this.initialized=!1,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||X1;let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:c3.default(st.getDefaultLoggerOptions({level:e?.logger||A3.logger}));this.logger=st.generateChildLogger(t,this.name),this.heartbeat=new ip.HeartBeat,this.crypto=new $d(this,this.logger,e?.keychain),this.history=new tp(this,this.logger),this.expirer=new rp(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new OH.default(u3(u3({},I3),e?.storageOptions)),this.relayer=new Xd({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ep(this,this.logger)}static async init(e){let t=new mu(e);return await t.initialize(),t}get context(){return st.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}}},m9=mu;Ee.CORE_CONTEXT=sp,Ee.CORE_DEFAULT=A3,Ee.CORE_PROTOCOL=J1,Ee.CORE_STORAGE_OPTIONS=I3,Ee.CORE_STORAGE_PREFIX=cn,Ee.CORE_VERSION=E3,Ee.CRYPTO_CLIENT_SEED=k1,Ee.CRYPTO_CONTEXT=_3,Ee.CRYPTO_JWT_TTL=b3,Ee.Core=m9,Ee.Crypto=$d,Ee.EXPIRER_CONTEXT=G3,Ee.EXPIRER_DEFAULT_TTL=t9,Ee.EXPIRER_EVENTS=Vr,Ee.EXPIRER_STORAGE_VERSION=K3,Ee.Expirer=rp,Ee.HISTORY_CONTEXT=Q3,Ee.HISTORY_EVENTS=Zr,Ee.HISTORY_STORAGE_VERSION=j3,Ee.JsonRpcHistory=tp,Ee.KEYCHAIN_CONTEXT=C3,Ee.KEYCHAIN_STORAGE_VERSION=S3,Ee.KeyChain=Wd,Ee.MESSAGES_CONTEXT=x3,Ee.MESSAGES_STORAGE_VERSION=T3,Ee.MessageTracker=Yd,Ee.PAIRING_CONTEXT=V3,Ee.PAIRING_DEFAULT_TTL=e9,Ee.PAIRING_RPC_OPTS=yu,Ee.PAIRING_STORAGE_VERSION=H3,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=q3,Ee.PUBLISHER_CONTEXT=D3,Ee.PUBLISHER_DEFAULT_TTL=N3,Ee.Pairing=ep,Ee.RELAYER_CONTEXT=B3,Ee.RELAYER_DEFAULT_LOGGER=P3,Ee.RELAYER_DEFAULT_PROTOCOL=O3,Ee.RELAYER_DEFAULT_RELAY_URL=X1,Ee.RELAYER_EVENTS=fr,Ee.RELAYER_PROVIDER_EVENTS=sl,Ee.RELAYER_RECONNECT_TIMEOUT=W1,Ee.RELAYER_SDK_VERSION=R3,Ee.RELAYER_STORAGE_OPTIONS=XQ,Ee.RELAYER_SUBSCRIBER_SUFFIX=M3,Ee.Relayer=Xd,Ee.STORE_STORAGE_VERSION=L3,Ee.SUBSCRIBER_CONTEXT=F3,Ee.SUBSCRIBER_DEFAULT_TTL=ZQ,Ee.SUBSCRIBER_EVENTS=ei,Ee.SUBSCRIBER_STORAGE_VERSION=U3,Ee.Store=Zd,Ee.Subscriber=Jd,Ee.default=mu});var rD=B(lt=>{"use strict";f();Object.defineProperty(lt,"__esModule",{value:!0});var w9=lh(),Wn=z3(),Z1=bm(),$3=Hm(),te=Ed(),Y3=$s(),ft=Ys(),Qt=(Zc(),at(lr));function J3(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var v9=J3(w9),E9=J3(Y3),sv="wc",ov=2,av="client",up=`${sv}@${ov}:${av}:`,op={name:av,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},A9={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"},I9={database:":memory:"},_9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},b9="history",C9="0.3",X3="proposal",S9=ft.THIRTY_DAYS,Z3="session",ul=ft.SEVEN_DAYS,eD="engine",wu={wc_sessionPropose:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1115}}},ap={min:ft.FIVE_MINUTES,max:ft.SEVEN_DAYS},tD="request",x9=Object.defineProperty,T9=Object.defineProperties,N9=Object.getOwnPropertyDescriptors,k3=Object.getOwnPropertySymbols,D9=Object.prototype.hasOwnProperty,O9=Object.prototype.propertyIsEnumerable,W3=(r,e,t)=>e in r?x9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hr=(r,e)=>{for(var t in e||(e={}))D9.call(e,t)&&W3(r,t,e[t]);if(k3)for(var t of k3(e))O9.call(e,t)&&W3(r,t,e[t]);return r},ev=(r,e)=>T9(r,N9(e)),tv=class extends $3.IEngine{constructor(e){super(e),this.name=eD,this.events=new E9.default,this.initialized=!1,this.ignoredPayloadTypes=[te.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(wu)}),this.initialized=!0)},this.connect=async t=>{this.isInitialized();let i=ev(Hr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);let{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=i,h=n,p,w=!1;if(h&&(w=this.client.core.pairing.pairings.get(h).active),!h||!w){let{topic:Y,uri:j}=await this.client.core.pairing.create();h=Y,p=j}let N=await this.client.core.crypto.generateKeyPair(),O=Hr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Wn.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:N,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:T,resolve:V,done:z}=te.createDelayedPromise();if(this.events.once(te.engineEvent("session_connect"),async({error:Y,session:j})=>{if(Y)T(Y);else if(j){j.self.publicKey=N;let W=ev(Hr({},j),{requiredNamespaces:j.requiredNamespaces,optionalNamespaces:j.optionalNamespaces});await this.client.session.set(j.topic,W),await this.setExpiry(j.topic,j.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:j.peer.metadata}),V(W)}}),!h){let{message:Y}=te.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(Y)}let $=await this.sendRequest(h,"wc_sessionPropose",O),se=te.calcExpiry(ft.FIVE_MINUTES);return await this.setProposal($,Hr({id:$,expiry:se},O)),{uri:p,approval:z}},this.pair=async t=>(this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{this.isInitialized(),await this.isValidApprove(t);let{id:i,relayProtocol:n,namespaces:s,sessionProperties:o}=t,a=this.client.proposal.get(i),{pairingTopic:u,proposer:h,requiredNamespaces:p,optionalNamespaces:w}=a;te.isValidObject(p)||(p=te.getRequiredNamespacesFromNamespaces(s,"approve()"));let N=await this.client.core.crypto.generateKeyPair(),O=h.publicKey,T=await this.client.core.crypto.generateSharedKey(N,O);u&&i&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:h.metadata}),await this.sendResult(i,u,{relay:{protocol:n??"irn"},responderPublicKey:N}),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let V=Hr({relay:{protocol:n??"irn"},namespaces:s,requiredNamespaces:p,optionalNamespaces:w,controller:{publicKey:N,metadata:this.client.metadata},expiry:te.calcExpiry(ul)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(T);let z=await this.sendRequest(T,"wc_sessionSettle",V),{done:$,resolve:se,reject:Y}=te.createDelayedPromise();this.events.once(te.engineEvent("session_approve",z),({error:W})=>{W?Y(W):se(this.client.session.get(T))});let j=ev(Hr({},V),{topic:T,acknowledged:!1,self:V.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:N});return await this.client.session.set(T,j),await this.setExpiry(T,te.calcExpiry(ul)),{topic:T,acknowledged:$}},this.reject=async t=>{this.isInitialized(),await this.isValidReject(t);let{id:i,reason:n}=t,{pairingTopic:s}=this.client.proposal.get(i);s&&(await this.sendError(i,s,n),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.isValidUpdate(t);let{topic:i,namespaces:n}=t,s=await this.sendRequest(i,"wc_sessionUpdate",{namespaces:n}),{done:o,resolve:a,reject:u}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_update",s),({error:h})=>{h?u(h):a()}),await this.client.session.update(i,{namespaces:n}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.isValidExtend(t);let{topic:i}=t,n=await this.sendRequest(i,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_extend",n),({error:u})=>{u?a(u):o()}),await this.setExpiry(i,te.calcExpiry(ul)),{acknowledged:s}},this.request=async t=>{this.isInitialized(),await this.isValidRequest(t);let{chainId:i,request:n,topic:s,expiry:o}=t,a=await this.sendRequest(s,"wc_sessionRequest",{request:n,chainId:i},o),{done:u,resolve:h,reject:p}=te.createDelayedPromise(o);return this.events.once(te.engineEvent("session_request",a),({error:w,result:N})=>{w?p(w):h(N)}),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i}),await u()},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);let{topic:i,response:n}=t,{id:s}=n;Qt.isJsonRpcResult(n)?await this.sendResult(s,i,n.result):Qt.isJsonRpcError(n)&&await this.sendError(s,i,n.error),this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0})},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);let{topic:i}=t;if(this.client.session.keys.includes(i)){let n=await this.sendRequest(i,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();this.events.once(te.engineEvent("session_ping",n),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.isValidEmit(t);let{topic:i,event:n,chainId:s}=t;await this.sendRequest(i,"wc_sessionEvent",{event:n,chainId:s})},this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);let{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest(i,"wc_sessionDelete",te.getSdkError("USER_DISCONNECTED")),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>te.isSessionCompatible(i,t))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(t,i)=>{let{self:n}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await Promise.all([this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.deleteSymKey(t),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,te.getSdkError("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.setPendingSessionRequest=async t=>{let i=wu.wc_sessionRequest.req.ttl,{id:n,topic:s,params:o}=t;await this.client.pendingRequest.set(n,{id:n,topic:s,params:o}),i&&this.client.core.expirer.set(n,te.calcExpiry(i))},this.sendRequest=async(t,i,n,s)=>{let o=Qt.formatJsonRpcRequest(i,n),a=await this.client.core.crypto.encode(t,o),u=wu[i].req;return s&&(u.ttl=s),this.client.core.history.set(t,o),this.client.core.relayer.publish(t,a,u),o.id},this.sendResult=async(t,i,n)=>{let s=Qt.formatJsonRpcResult(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=wu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.sendError=async(t,i,n)=>{let s=Qt.formatJsonRpcError(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=wu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let t=[],i=[];this.client.session.getAll().forEach(n=>{te.isExpired(n.expiry)&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{te.isExpired(n.expiry)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession(n)),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=t=>{let{topic:i,payload:n}=t,s=n.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(i,n);case"wc_sessionSettle":return this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return this.onSessionExtendRequest(i,n);case"wc_sessionPing":return this.onSessionPingRequest(i,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return this.onSessionRequest(i,n);case"wc_sessionEvent":return this.onSessionEventRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async t=>{let{topic:i,payload:n}=t,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidConnect(Hr({},i.params));let o=te.calcExpiry(ft.FIVE_MINUTES),a=Hr({id:s,pairingTopic:t,expiry:o},n);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(t,i)=>{let{id:n}=i;if(Qt.isJsonRpcResult(i)){let{result:s}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(n);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 h=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});let p=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:t})}else Qt.isJsonRpcError(i)&&(await this.client.proposal.delete(n,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:h,requiredNamespaces:p,optionalNamespaces:w,sessionProperties:N}=i.params,O=Hr({topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,requiredNamespaces:p,optionalNamespaces:w,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},N&&{sessionProperties:N});await this.sendResult(i.id,t,!0),this.events.emit(te.engineEvent("session_connect"),{session:O})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(te.engineEvent("session_approve",n),{})):Qt.isJsonRpcError(i)&&(await this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidUpdate(Hr({topic:t},n)),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult(s,t,!0),this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_update",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{let{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,te.calcExpiry(ul)),await this.sendResult(n,t,!0),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_extend",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{let{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult(n,t,!0),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{let{id:n}=i;setTimeout(()=>{Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_ping",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{let{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),this.client.core.relayer.once(Wn.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(t)}),await this.sendResult(n,t,!0),this.client.events.emit("session_delete",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidRequest(Hr({topic:t},s)),await this.setPendingSessionRequest({id:n,topic:t,params:s}),this.client.events.emit("session_request",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_request",n),{result:i.result}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidEmit(Hr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.isValidConnect=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(u)}let{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:a}=t;if(te.isUndefined(i)||await this.isValidPairingTopic(i),!te.isValidRelays(a,!0)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!te.isUndefined(n)&&te.isValidObject(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!te.isUndefined(s)&&te.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(t,i)=>{let n=te.isValidRequiredNamespaces(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!te.isValidParams(t))throw new Error(te.getInternalError("MISSING_OR_INVALID",`approve() params: ${t}`).message);let{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=t;await this.isValidProposalId(i);let a=this.client.proposal.get(i),u=te.isValidNamespaces(n,"approve()");if(u)throw new Error(u.message);let h=te.isConformingNamespaces(a.requiredNamespaces,n,"approve()","requiredNamespaces");if(h)throw new Error(h.message);if(!te.isValidString(s,!0)){let{message:p}=te.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(p)}if(Object.keys(n).length>Object.keys(a.requiredNamespaces).length){let p=Object.keys(a.optionalNamespaces).filter(O=>n[O]),w={};for(let O in a.optionalNamespaces)p.includes(O)&&(w[O]=a.optionalNamespaces[O]);let N=te.isConformingNamespaces(w,n,"approve()","optionalNamespaces");if(N)throw new Error(N.message)}te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}let{id:i,reason:n}=t;if(await this.isValidProposalId(i),!te.isValidErrorReason(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!te.isValidParams(t)){let{message:h}=te.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}let{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!te.isValidRelay(i)){let{message:h}=te.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}let a=te.isValidController(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=te.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(te.isExpired(o)){let{message:h}=te.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}let{topic:i,namespaces:n}=t;await this.isValidSessionTopic(i);let s=this.client.session.get(i),o=te.isValidNamespaces(n,"update()");if(o)throw new Error(o.message);let a=te.isConformingNamespaces(s.requiredNamespaces,n,"update()","requiredNamespaces");if(a)throw new Error(a.message)},this.isValidExtend=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(u)}let{topic:i,request:n,chainId:s,expiry:o}=t;await this.isValidSessionTopic(i);let{namespaces:a}=this.client.session.get(i);if(!te.isValidNamespacesChainId(a,s)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!te.isValidRequest(n)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(u)}if(!te.isValidNamespacesRequest(a,s,n.method)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(u)}if(o&&!te.isValidRequestExpiry(o,ap)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ap.min} and ${ap.max}`);throw new Error(u)}},this.isValidRespond=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(s)}let{topic:i,response:n}=t;if(await this.isValidSessionTopic(i),!te.isValidResponse(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidPing=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!te.isValidParams(t)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}let{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!te.isValidNamespacesChainId(o,s)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!te.isValidEvent(n)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!te.isValidNamespacesEvent(o,s,n.name)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!te.isValidString(n,!1)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`${i} must be in Record format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on(Wn.RELAYER_EVENTS.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;let n=await this.client.core.crypto.decode(t,i);Qt.isJsonRpcRequest(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):Qt.isJsonRpcResponse(n)&&(await this.client.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.client.core.expirer.on(Wn.EXPIRER_EVENTS.expired,async e=>{let{topic:t,id:i}=te.parseExpirerTarget(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,te.getInternalError("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}isValidPairingTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=te.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=te.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(t)}}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(te.isValidString(e,!1)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!te.isValidId(e)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=te.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},rv=class extends Wn.Store{constructor(e,t){super(e,t,X3,up),this.core=e,this.logger=t}},iv=class extends Wn.Store{constructor(e,t){super(e,t,Z3,up),this.core=e,this.logger=t}},nv=class extends Wn.Store{constructor(e,t){super(e,t,tD,up),this.core=e,this.logger=t}},vu=class extends $3.ISignClient{constructor(e){super(e),this.protocol=sv,this.version=ov,this.name=op.name,this.events=new Y3.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||op.name,this.metadata=e?.metadata||te.getAppMetadata();let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:v9.default(Z1.getDefaultLoggerOptions({level:e?.logger||op.logger}));this.core=e?.core||new Wn.Core(e),this.logger=Z1.generateChildLogger(t,this.name),this.session=new iv(this.core,this.logger),this.proposal=new rv(this.core,this.logger),this.pendingRequest=new nv(this.core,this.logger),this.engine=new tv(this)}static async init(e){let t=new vu(e);return await t.initialize(),t}get context(){return Z1.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.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},P9=vu;lt.ENGINE_CONTEXT=eD,lt.ENGINE_RPC_OPTS=wu,lt.HISTORY_CONTEXT=b9,lt.HISTORY_EVENTS=_9,lt.HISTORY_STORAGE_VERSION=C9,lt.PROPOSAL_CONTEXT=X3,lt.PROPOSAL_EXPIRY=S9,lt.REQUEST_CONTEXT=tD,lt.SESSION_CONTEXT=Z3,lt.SESSION_EXPIRY=ul,lt.SESSION_REQUEST_EXPIRY_BOUNDARIES=ap,lt.SIGN_CLIENT_CONTEXT=av,lt.SIGN_CLIENT_DEFAULT=op,lt.SIGN_CLIENT_EVENTS=A9,lt.SIGN_CLIENT_PROTOCOL=sv,lt.SIGN_CLIENT_STORAGE_OPTIONS=I9,lt.SIGN_CLIENT_STORAGE_PREFIX=up,lt.SIGN_CLIENT_VERSION=ov,lt.SignClient=P9,lt.default=vu});var iD=B(Mi=>{"use strict";f();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.WALLETCONNECT_OLD_METHOD_PREFIX=Mi.WALLETCONNECT_OLD_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE="multiversx";Mi.WALLETCONNECT_OLD_NAMESPACE="elrond";Mi.WALLETCONNECT_OLD_METHOD_PREFIX="erd"});var nD=B($n=>{"use strict";f();Object.defineProperty($n,"__esModule",{value:!0});$n.OldOperation=$n.Operation=void 0;var B9;(function(r){r.SIGN_TRANSACTION="multiversx_signTransaction",r.SIGN_TRANSACTIONS="multiversx_signTransactions",r.SIGN_MESSAGE="multiversx_signMessage",r.SIGN_LOGIN_TOKEN="multiversx_signLoginToken"})(B9=$n.Operation||($n.Operation={}));var M9;(function(r){r.SIGN_TRANSACTION="erd_signTransaction",r.SIGN_TRANSACTIONS="erd_signTransactions",r.SIGN_MESSAGE="erd_signMessage",r.SIGN_LOGIN_TOKEN="erd_signLoginToken"})(M9=$n.OldOperation||($n.OldOperation={}))});var sD=B(cp=>{"use strict";f();Object.defineProperty(cp,"__esModule",{value:!0});cp.Logger=void 0;var uv=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};cp.Logger=uv});var oD=B(Eu=>{"use strict";f();Object.defineProperty(Eu,"__esModule",{value:!0});Eu.Signature=Eu.Address=void 0;var cv=class{constructor(e){this.value=e}bech32(){return this.value}};Eu.Address=cv;var cl=class{constructor(e){this.buffer=e}static fromHex(e){return new cl(y.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Eu.Signature=cl});var hv=B(ri=>{"use strict";f();Object.defineProperty(ri,"__esModule",{value:!0});ri.WalletConnectV2ProviderErrorMessagesEnum=ri.ErrBadAddress=ri.ErrNotImplemented=ri.Err=void 0;var ll=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};ri.Err=ll;var lv=class extends ll{constructor(){super("Method not yet implemented")}};ri.ErrNotImplemented=lv;var fv=class extends ll{constructor(e,t){super(`Bad address: ${e}`,t)}};ri.ErrBadAddress=fv;var R9;(function(r){r.unableToInit="WalletConnect is unable to init",r.notInitialized="WalletConnect is not initialized",r.unableToConnect="WalletConnect is unable to connect",r.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",r.unableToSignLoginToken="WalletConnect could not sign login token",r.unableToLogin="WalletConnect is unable to login",r.unableToHandleTopic="WalletConnect: Unable to handle topic update",r.unableToHandleEvent="WalletConnect: Unable to handle events",r.sessionNotConnected="WalletConnect Session is not connected",r.sessionDeleted="WalletConnect Session Deleted",r.sessionExpired="WalletConnect Session Expired",r.alreadyLoggedOut="WalletConnect: Already logged out",r.pingFailed="WalletConnect Ping Failed",r.invalidAddress="WalletConnect: Invalid address",r.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",r.invalidMessageResponse="WalletConnect could not sign the message",r.invalidMessageSignature="WalletConnect: Invalid message signature",r.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",r.invalidCustomRequestResponse="WalletConnect could not send the custom request",r.transactionError="Transaction canceled",r.connectionError="WalletConnect could not establish a connection"})(R9=ri.WalletConnectV2ProviderErrorMessagesEnum||(ri.WalletConnectV2ProviderErrorMessagesEnum={}))});var uD=B(Ri=>{"use strict";f();var L9=Ri&&Ri.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),F9=Ri&&Ri.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),U9=Ri&&Ri.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&L9(e,r,t);return F9(e,r),e};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.UserAddress=void 0;var q9=U9(kl()),aD=hv(),V9="erd",fl=class{constructor(e){this.value=e}static fromBech32(e){let t;try{t=q9.decode(e)}catch(i){throw new aD.ErrBadAddress(e,i)}if(t.prefix!=V9)throw new aD.ErrBadAddress(e);return new fl(e)}bech32(){return this.value}};Ri.UserAddress=fl});var dl=B(Fi=>{"use strict";f();var Yt=Fi&&Fi.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},H9=Fi&&Fi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.WalletConnectV2Provider=Fi.WalletConnectV2ProviderErrorMessagesEnum=void 0;var Q9=H9(rD()),cD=Ed(),Ke=iD(),Li=nD(),Le=sD(),hl=oD(),pe=hv();Object.defineProperty(Fi,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return pe.WalletConnectV2ProviderErrorMessagesEnum}});var lp=uD(),dv=class{constructor(e,t,i,n,s){this.chainId="",this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.options={},this.onClientConnect=e,this.chainId=t,this.walletConnectV2Relay=i,this.walletConnectV2ProjectId=n,this.options=s}reset(){this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.session=void 0}init(){return Yt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{this.reset();let e=yield Q9.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,t)=>e(Boolean(this.isInitialized()&&typeof this.session<"u")))}connect(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"&&(yield this.init()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=[...Object.values(Li.Operation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)):[]],n=[...Object.values(Li.OldOperation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)):[]],s=[`${Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=[`${Ke.WALLETCONNECT_OLD_NAMESPACE}:${this.chainId}`],a=(t=e?.events)!==null&&t!==void 0?t:[];try{let u=yield this.walletConnector.connect({pairingTopic:e?.topic,requiredNamespaces:{[Ke.WALLETCONNECT_OLD_NAMESPACE]:{methods:n,chains:o,events:a}},optionalNamespaces:{[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:a}}});return this.events=a,this.methods=i,u}catch{throw e?.topic?(yield this.logout({topic:e.topic}),Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting)):(Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect))}})}login(e){var t,i;return Yt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout());try{if(e&&e.approval){let n=yield e.approval();if(!((t=n?.namespaces)===null||t===void 0)&&t[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((i=n?.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE),e.token){let s=this.getAddressFromSession(n),{signature:o}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_LOGIN_TOKEN:Li.OldOperation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:s}}});if(!o)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:o})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let i=(t=e?.topic)!==null&&t!==void 0?t:this.getCurrentTopic(this.walletConnector);if(i){yield this.walletConnector.disconnect({topic:i,reason:cD.getSdkError("USER_DISCONNECTED")});let n=this.walletConnector.core.pairing.pairings.getAll({active:!0}).filter(s=>s.topic!==i);this.pairings=n}}catch{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0}),this.reset()}return!0})}getAddress(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(e=this.pairings)!==null&&e!==void 0?e:this.walletConnector.core.pairing.pairings.getAll({active:!0})})}signMessage(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),{signature:i}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_MESSAGE:Li.OldOperation.SIGN_MESSAGE,params:{address:t,message:e.message.toString()}}});if(!i)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new hl.Signature(i),lp.UserAddress.fromBech32(t))}catch{throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.toPlainObject(i);if(this.chainId!==e.getChainID().valueOf())throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTION:Li.OldOperation.SIGN_TRANSACTION,params:{transaction:n}}});if(!s)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(hl.Signature.fromHex(s),lp.UserAddress.fromBech32(t)),e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(i)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTIONS:Li.OldOperation.SIGN_TRANSACTIONS,params:{transactions:n}}});(!s||!Array.isArray(s))&&Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(hl.Signature.fromHex(s[o].signature),lp.UserAddress.fromBech32(t));return e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((t=e?.request)===null||t===void 0)&&t.method){let i=Object.assign({},e.request),{method:n}=i;i.method.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)&&this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_OLD_METHOD_PREFIX,this.namespace)),i.method.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)&&this.namespace===Ke.WALLETCONNECT_OLD_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE,Ke.WALLETCONNECT_OLD_METHOD_PREFIX));let{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},i),{method:n})});if(!s)throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{return yield this.walletConnector.ping({topic:this.getCurrentTopic(this.walletConnector)}),!0}catch{return Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return Yt(this,void 0,void 0,function*(){if(e){if(this.addressIsValid(e.address)){this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin();return}if(Le.Logger.error(`${pe.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector){yield this.walletConnector.disconnect({topic:this.getCurrentTopic(this.walletConnector),reason:cD.getSdkError("USER_DISCONNECTED")});let t=this.walletConnector.core.pairing.pairings.getAll({active:!0});this.pairings=t}}})}onSessionConnected(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session,!((i=(t=e.session)===null||t===void 0?void 0:t.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((s=(n=e.session)===null||n===void 0?void 0:n.namespaces)===null||s===void 0)&&s[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE);let o=this.getAddressFromSession(e.session);return o&&(yield this.loginAccount({address:o,signature:e.signature})),""})}handleTopicUpdateEvent({topic:e}){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.address&&!this.isInitializing&&this.pairings)if(((t=this.pairings)===null||t===void 0?void 0:t.length)===0)this.onClientConnect.onClientLogout();else{let i=this.pairings[this.pairings.length-1];i?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0})}})}handleSessionEvents({topic:e,params:t}){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let{event:i}=t;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let n=i.data;this.onClientConnect.onClientEvent(n)}})}subscribeToEvents(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{let{namespaces:u}=a,h=e.session.get(o),p=Object.assign(Object.assign({},h),{namespaces:u});this.onSessionConnected({session:p})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",()=>{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout()}),e.on("session_expire",()=>{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout()}),(i=(t=e?.core)===null||t===void 0?void 0:t.pairing)===null||i===void 0||i.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(n=e?.core)===null||n===void 0?void 0:n.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=e.pairing.getAll({active:!0}),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let t=this.getCurrentSession(e);if(t)return yield this.onSessionConnected({session:t}),t}})}getCurrentSession(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t])}else throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t]).topic}else throw Le.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}addressIsValid(e){try{return!!lp.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){var t;let i=e.namespaces[(t=this.namespace)!==null&&t!==void 0?t:Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(i&&i.accounts){let n=i.accounts[0],[s,o,a]=n.split(":");return a}return""}};Fi.WalletConnectV2Provider=dv});var fD=B((mre,lD)=>{"use strict";f();lD.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var pD=B((vre,dD)=>{"use strict";f();var hD=typeof Symbol<"u"&&Symbol,j9=fD();dD.exports=function(){return typeof hD!="function"||typeof Symbol!="function"||typeof hD("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:j9()}});var yD=B((Are,gD)=>{"use strict";f();var G9="Function.prototype.bind called on incompatible ",pv=Array.prototype.slice,K9=Object.prototype.toString,z9="[object Function]";gD.exports=function(e){var t=this;if(typeof t!="function"||K9.call(t)!==z9)throw new TypeError(G9+t);for(var i=pv.call(arguments,1),n,s=function(){if(this instanceof n){var p=t.apply(this,i.concat(pv.call(arguments)));return Object(p)===p?p:this}else return t.apply(e,i.concat(pv.call(arguments)))},o=Math.max(0,t.length-i.length),a=[],u=0;u{"use strict";f();var k9=yD();mD.exports=Function.prototype.bind||k9});var vD=B((Cre,wD)=>{"use strict";f();var W9=fp();wD.exports=W9.call(Function.call,Object.prototype.hasOwnProperty)});var pp=B((xre,_D)=>{"use strict";f();var Fe,Cu=SyntaxError,ID=Function,_u=TypeError,gv=function(r){try{return ID('"use strict"; return ('+r+").constructor;")()}catch{}},co=Object.getOwnPropertyDescriptor;if(co)try{co({},"")}catch{co=null}var yv=function(){throw new _u},$9=co?function(){try{return arguments.callee,yv}catch{try{return co(arguments,"callee").get}catch{return yv}}}():yv,Au=pD()(),Yn=Object.getPrototypeOf||function(r){return r.__proto__},Iu={},Y9=typeof Uint8Array>"u"?Fe:Yn(Uint8Array),bu={"%AggregateError%":typeof AggregateError>"u"?Fe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Fe:ArrayBuffer,"%ArrayIteratorPrototype%":Au?Yn([][Symbol.iterator]()):Fe,"%AsyncFromSyncIteratorPrototype%":Fe,"%AsyncFunction%":Iu,"%AsyncGenerator%":Iu,"%AsyncGeneratorFunction%":Iu,"%AsyncIteratorPrototype%":Iu,"%Atomics%":typeof Atomics>"u"?Fe:Atomics,"%BigInt%":typeof BigInt>"u"?Fe:BigInt,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Fe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Fe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Fe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Fe:FinalizationRegistry,"%Function%":ID,"%GeneratorFunction%":Iu,"%Int8Array%":typeof Int8Array>"u"?Fe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Fe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Fe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Au?Yn(Yn([][Symbol.iterator]())):Fe,"%JSON%":typeof JSON=="object"?JSON:Fe,"%Map%":typeof Map>"u"?Fe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Au?Fe:Yn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Fe:Promise,"%Proxy%":typeof Proxy>"u"?Fe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Fe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Fe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Au?Fe:Yn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Fe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Au?Yn(""[Symbol.iterator]()):Fe,"%Symbol%":Au?Symbol:Fe,"%SyntaxError%":Cu,"%ThrowTypeError%":$9,"%TypedArray%":Y9,"%TypeError%":_u,"%Uint8Array%":typeof Uint8Array>"u"?Fe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Fe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Fe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Fe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Fe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Fe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Fe:WeakSet},J9=function r(e){var t;if(e==="%AsyncFunction%")t=gv("async function () {}");else if(e==="%GeneratorFunction%")t=gv("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=gv("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&(t=Yn(n.prototype))}return bu[e]=t,t},ED={"%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"]},pl=fp(),hp=vD(),X9=pl.call(Function.call,Array.prototype.concat),Z9=pl.call(Function.apply,Array.prototype.splice),AD=pl.call(Function.call,String.prototype.replace),dp=pl.call(Function.call,String.prototype.slice),ej=pl.call(Function.call,RegExp.prototype.exec),tj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,rj=/\\(\\)?/g,ij=function(e){var t=dp(e,0,1),i=dp(e,-1);if(t==="%"&&i!=="%")throw new Cu("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Cu("invalid intrinsic syntax, expected opening `%`");var n=[];return AD(e,tj,function(s,o,a,u){n[n.length]=a?AD(u,rj,"$1"):o||s}),n},nj=function(e,t){var i=e,n;if(hp(ED,i)&&(n=ED[i],i="%"+n[0]+"%"),hp(bu,i)){var s=bu[i];if(s===Iu&&(s=J9(i)),typeof s>"u"&&!t)throw new _u("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Cu("intrinsic "+e+" does not exist!")};_D.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new _u("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new _u('"allowMissing" argument must be a boolean');if(ej(/^%?[^%]*%?$/,e)===null)throw new Cu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=ij(e),n=i.length>0?i[0]:"",s=nj("%"+n+"%",t),o=s.name,a=s.value,u=!1,h=s.alias;h&&(n=h[0],Z9(i,X9([0,1],h)));for(var p=1,w=!0;p=i.length){var V=co(a,N);w=!!V,w&&"get"in V&&!("originalValue"in V.get)?a=V.get:a=a[N]}else w=hp(a,N),a=a[N];w&&!u&&(bu[o]=a)}}return a}});var ND=B((Nre,gp)=>{"use strict";f();var mv=fp(),Su=pp(),SD=Su("%Function.prototype.apply%"),xD=Su("%Function.prototype.call%"),TD=Su("%Reflect.apply%",!0)||mv.call(xD,SD),bD=Su("%Object.getOwnPropertyDescriptor%",!0),lo=Su("%Object.defineProperty%",!0),sj=Su("%Math.max%");if(lo)try{lo({},"a",{value:1})}catch{lo=null}gp.exports=function(e){var t=TD(mv,xD,arguments);if(bD&&lo){var i=bD(t,"length");i.configurable&&lo(t,"length",{value:1+sj(0,e.length-(arguments.length-1))})}return t};var CD=function(){return TD(mv,SD,arguments)};lo?lo(gp.exports,"apply",{value:CD}):gp.exports.apply=CD});var BD=B((Ore,PD)=>{"use strict";f();var DD=pp(),OD=ND(),oj=OD(DD("String.prototype.indexOf"));PD.exports=function(e,t){var i=DD(e,!!t);return typeof i=="function"&&oj(e,".prototype.")>-1?OD(i):i}});var MD=B(()=>{f()});var eO=B((Lre,ZD)=>{f();var xv=typeof Map=="function"&&Map.prototype,wv=Object.getOwnPropertyDescriptor&&xv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mp=xv&&wv&&typeof wv.get=="function"?wv.get:null,RD=xv&&Map.prototype.forEach,Tv=typeof Set=="function"&&Set.prototype,vv=Object.getOwnPropertyDescriptor&&Tv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wp=Tv&&vv&&typeof vv.get=="function"?vv.get:null,LD=Tv&&Set.prototype.forEach,aj=typeof WeakMap=="function"&&WeakMap.prototype,yl=aj?WeakMap.prototype.has:null,uj=typeof WeakSet=="function"&&WeakSet.prototype,ml=uj?WeakSet.prototype.has:null,cj=typeof WeakRef=="function"&&WeakRef.prototype,FD=cj?WeakRef.prototype.deref:null,lj=Boolean.prototype.valueOf,fj=Object.prototype.toString,hj=Function.prototype.toString,dj=String.prototype.match,Nv=String.prototype.slice,Xn=String.prototype.replace,pj=String.prototype.toUpperCase,UD=String.prototype.toLowerCase,kD=RegExp.prototype.test,qD=Array.prototype.concat,Ui=Array.prototype.join,gj=Array.prototype.slice,VD=Math.floor,Iv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ev=Object.getOwnPropertySymbols,_v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xu||"symbol")?Symbol.toStringTag:null,WD=Object.prototype.propertyIsEnumerable,HD=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function QD(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||kD.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-VD(-r):VD(r);if(i!==r){var n=String(i),s=Nv.call(e,n.length+1);return Xn.call(n,t,"$&_")+"."+Xn.call(Xn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xn.call(e,t,"$&_")}var bv=MD(),jD=bv.custom,GD=YD(jD)?jD:null;ZD.exports=function r(e,t,i,n){var s=t||{};if(Jn(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Jn(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=Jn(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(Jn(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(Jn(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 XD(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?QD(e,u):u}if(typeof e=="bigint"){var h=String(e)+"n";return a?QD(e,h):h}var p=typeof s.depth>"u"?5:s.depth;if(typeof i>"u"&&(i=0),i>=p&&p>0&&typeof e=="object")return Cv(e)?"[Array]":"[Object]";var w=Bj(s,i);if(typeof n>"u")n=[];else if(JD(n,e)>=0)return"[Circular]";function N(A,c,d){if(c&&(n=gj.call(n),n.push(c)),d){var g={depth:s.depth};return Jn(s,"quoteStyle")&&(g.quoteStyle=s.quoteStyle),r(A,g,i+1,n)}return r(A,s,i+1,n)}if(typeof e=="function"&&!KD(e)){var O=bj(e),T=yp(e,N);return"[Function"+(O?": "+O:" (anonymous)")+"]"+(T.length>0?" { "+Ui.call(T,", ")+" }":"")}if(YD(e)){var V=xu?Xn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_v.call(e);return typeof e=="object"&&!xu?gl(V):V}if(Dj(e)){for(var z="<"+UD.call(String(e.nodeName)),$=e.attributes||[],se=0;se<$.length;se++)z+=" "+$[se].name+"="+$D(yj($[se].value),"double",s);return z+=">",e.childNodes&&e.childNodes.length&&(z+="..."),z+="",z}if(Cv(e)){if(e.length===0)return"[]";var Y=yp(e,N);return w&&!Pj(Y)?"["+Sv(Y,w)+"]":"[ "+Ui.call(Y,", ")+" ]"}if(wj(e)){var j=yp(e,N);return!("cause"in Error.prototype)&&"cause"in e&&!WD.call(e,"cause")?"{ ["+String(e)+"] "+Ui.call(qD.call("[cause]: "+N(e.cause),j),", ")+" }":j.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Ui.call(j,", ")+" }"}if(typeof e=="object"&&o){if(GD&&typeof e[GD]=="function"&&bv)return bv(e,{depth:p-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Cj(e)){var W=[];return RD&&RD.call(e,function(A,c){W.push(N(c,e,!0)+" => "+N(A,e))}),zD("Map",mp.call(e),W,w)}if(Tj(e)){var k=[];return LD&&LD.call(e,function(A){k.push(N(A,e))}),zD("Set",wp.call(e),k,w)}if(Sj(e))return Av("WeakMap");if(Nj(e))return Av("WeakSet");if(xj(e))return Av("WeakRef");if(Ej(e))return gl(N(Number(e)));if(Ij(e))return gl(N(Iv.call(e)));if(Aj(e))return gl(lj.call(e));if(vj(e))return gl(N(String(e)));if(!mj(e)&&!KD(e)){var R=yp(e,N),F=HD?HD(e)===Object.prototype:e instanceof Object||e.constructor===Object,G=e instanceof Object?"":"null prototype",ce=!F&&hr&&Object(e)===e&&hr in e?Nv.call(Zn(e),8,-1):G?"Object":"",J=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=J+(ce||G?"["+Ui.call(qD.call([],ce||[],G||[]),": ")+"] ":"");return R.length===0?X+"{}":w?X+"{"+Sv(R,w)+"}":X+"{ "+Ui.call(R,", ")+" }"}return String(e)};function $D(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function yj(r){return Xn.call(String(r),/"/g,""")}function Cv(r){return Zn(r)==="[object Array]"&&(!hr||!(typeof r=="object"&&hr in r))}function mj(r){return Zn(r)==="[object Date]"&&(!hr||!(typeof r=="object"&&hr in r))}function KD(r){return Zn(r)==="[object RegExp]"&&(!hr||!(typeof r=="object"&&hr in r))}function wj(r){return Zn(r)==="[object Error]"&&(!hr||!(typeof r=="object"&&hr in r))}function vj(r){return Zn(r)==="[object String]"&&(!hr||!(typeof r=="object"&&hr in r))}function Ej(r){return Zn(r)==="[object Number]"&&(!hr||!(typeof r=="object"&&hr in r))}function Aj(r){return Zn(r)==="[object Boolean]"&&(!hr||!(typeof r=="object"&&hr in r))}function YD(r){if(xu)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!_v)return!1;try{return _v.call(r),!0}catch{}return!1}function Ij(r){if(!r||typeof r!="object"||!Iv)return!1;try{return Iv.call(r),!0}catch{}return!1}var _j=Object.prototype.hasOwnProperty||function(r){return r in this};function Jn(r,e){return _j.call(r,e)}function Zn(r){return fj.call(r)}function bj(r){if(r.name)return r.name;var e=dj.call(hj.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function JD(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return XD(Nv.call(r,0,e.maxStringLength),e)+i}var n=Xn.call(Xn.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Oj);return $D(n,"single",e)}function Oj(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+pj.call(e.toString(16))}function gl(r){return"Object("+r+")"}function Av(r){return r+" { ? }"}function zD(r,e,t,i){var n=i?Sv(t,i):Ui.call(t,", ");return r+" ("+e+") {"+n+"}"}function Pj(r){for(var e=0;e=0)return!1;return!0}function Bj(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=Ui.call(Array(r.indent+1)," ");else return null;return{base:t,prev:Ui.call(Array(e+1),t)}}function Sv(r,e){if(r.length===0)return"";var t=` -`+e.prev+e.base;return t+Ui.call(r,","+t)+` -`+e.prev}function yp(r,e){var t=Cv(r),i=[];if(t){i.length=r.length;for(var n=0;n{"use strict";f();var Dv=pp(),Tu=BD(),Mj=eO(),Rj=Dv("%TypeError%"),vp=Dv("%WeakMap%",!0),Ep=Dv("%Map%",!0),Lj=Tu("WeakMap.prototype.get",!0),Fj=Tu("WeakMap.prototype.set",!0),Uj=Tu("WeakMap.prototype.has",!0),qj=Tu("Map.prototype.get",!0),Vj=Tu("Map.prototype.set",!0),Hj=Tu("Map.prototype.has",!0),Ov=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},Qj=function(r,e){var t=Ov(r,e);return t&&t.value},jj=function(r,e,t){var i=Ov(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},Gj=function(r,e){return!!Ov(r,e)};tO.exports=function(){var e,t,i,n={assert:function(s){if(!n.has(s))throw new Rj("Side channel does not contain "+Mj(s))},get:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Lj(e,s)}else if(Ep){if(t)return qj(t,s)}else if(i)return Qj(i,s)},has:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Uj(e,s)}else if(Ep){if(t)return Hj(t,s)}else if(i)return Gj(i,s);return!1},set:function(s,o){vp&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new vp),Fj(e,s,o)):Ep?(t||(t=new Ep),Vj(t,s,o)):(i||(i={key:{},next:null}),jj(i,s,o))}};return n}});var Ap=B((Vre,iO)=>{"use strict";f();var Kj=String.prototype.replace,zj=/%20/g,Pv={RFC1738:"RFC1738",RFC3986:"RFC3986"};iO.exports={default:Pv.RFC3986,formatters:{RFC1738:function(r){return Kj.call(r,zj,"+")},RFC3986:function(r){return String(r)}},RFC1738:Pv.RFC1738,RFC3986:Pv.RFC3986}});var Mv=B((Qre,sO)=>{"use strict";f();var kj=Ap(),Bv=Object.prototype.hasOwnProperty,fo=Array.isArray,qi=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),Wj=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(fo(i)){for(var n=[],s=0;s=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===kj.RFC1738&&(h===40||h===41)){a+=o.charAt(u);continue}if(h<128){a=a+qi[h];continue}if(h<2048){a=a+(qi[192|h>>6]+qi[128|h&63]);continue}if(h<55296||h>=57344){a=a+(qi[224|h>>12]+qi[128|h>>6&63]+qi[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|o.charCodeAt(u)&1023),a+=qi[240|h>>18]+qi[128|h>>12&63]+qi[128|h>>6&63]+qi[128|h&63]}return a},Zj=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],n=0;n{"use strict";f();var uO=rO(),Lv=Mv(),wl=Ap(),nG=Object.prototype.hasOwnProperty,oO={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},ho=Array.isArray,sG=String.prototype.split,oG=Array.prototype.push,cO=function(r,e){oG.apply(r,ho(e)?e:[e])},aG=Date.prototype.toISOString,aO=wl.default,rr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Lv.encode,encodeValuesOnly:!1,format:aO,formatter:wl.formatters[aO],indices:!1,serializeDate:function(e){return aG.call(e)},skipNulls:!1,strictNullHandling:!1},uG=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Rv={},cG=function r(e,t,i,n,s,o,a,u,h,p,w,N,O,T,V){for(var z=e,$=V,se=0,Y=!1;($=$.get(Rv))!==void 0&&!Y;){var j=$.get(e);if(se+=1,typeof j<"u"){if(j===se)throw new RangeError("Cyclic object value");Y=!0}typeof $.get(Rv)>"u"&&(se=0)}if(typeof a=="function"?z=a(t,z):z instanceof Date?z=p(z):i==="comma"&&ho(z)&&(z=Lv.maybeMap(z,function(m){return m instanceof Date?p(m):m})),z===null){if(n)return o&&!O?o(t,rr.encoder,T,"key",w):t;z=""}if(uG(z)||Lv.isBuffer(z)){if(o){var W=O?t:o(t,rr.encoder,T,"key",w);if(i==="comma"&&O){for(var k=sG.call(String(z),","),R="",F=0;F"u")return G;var ce;if(i==="comma"&&ho(z))ce=[{value:z.length>0?z.join(",")||null:void 0}];else if(ho(a))ce=a;else{var J=Object.keys(z);ce=u?J.sort(u):J}for(var X=0;X"u"?rr.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:rr.charsetSentinel,delimiter:typeof e.delimiter>"u"?rr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:rr.encode,encoder:typeof e.encoder=="function"?e.encoder:rr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:rr.encodeValuesOnly,filter:s,format:i,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:rr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:rr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:rr.strictNullHandling}};lO.exports=function(r,e){var t=r,i=lG(e),n,s;typeof i.filter=="function"?(s=i.filter,t=s("",t)):ho(i.filter)&&(s=i.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in oO?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=oO[a];n||(n=Object.keys(t)),i.sort&&n.sort(i.sort);for(var h=uO(),p=0;p0?O+N:""}});var pO=B((zre,dO)=>{"use strict";f();var Nu=Mv(),Fv=Object.prototype.hasOwnProperty,fG=Array.isArray,Jt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Nu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},hG=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},hO=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},dG="utf8=%26%2310003%3B",pG="utf8=%E2%9C%93",gG=function(e,t){var i={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),a=-1,u,h=t.charset;if(t.charsetSentinel)for(u=0;u-1&&(T=fG(T)?[T]:T),Fv.call(i,O)?i[O]=Nu.combine(i[O],T):i[O]=T}return i},yG=function(r,e,t,i){for(var n=i?e:hO(e,t),s=r.length-1;s>=0;--s){var o,a=r[s];if(a==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(u,10);!t.parseArrays&&u===""?o={0:n}:!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=n):u!=="__proto__"&&(o[u]=n)}n=o}return n},mG=function(e,t,i,n){if(e){var s=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=i.depth>0&&o.exec(s),h=u?s.slice(0,u.index):s,p=[];if(h){if(!i.plainObjects&&Fv.call(Object.prototype,h)&&!i.allowPrototypes)return;p.push(h)}for(var w=0;i.depth>0&&(u=a.exec(s))!==null&&w"u"?Jt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Jt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Jt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Jt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Jt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Jt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Jt.comma,decoder:typeof e.decoder=="function"?e.decoder:Jt.decoder,delimiter:typeof e.delimiter=="string"||Nu.isRegExp(e.delimiter)?e.delimiter:Jt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Jt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Jt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Jt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Jt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Jt.strictNullHandling}};dO.exports=function(r,e){var t=wG(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?gG(r,t):r,n=t.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o{"use strict";f();var vG=fO(),EG=pO(),AG=Ap();gO.exports={formats:AG,parse:EG,stringify:vG}});var Uv=B(ht=>{"use strict";f();Object.defineProperty(ht,"__esModule",{value:!0});ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ht.WALLET_PROVIDER_CALLBACK_PARAM=ht.WALLET_PROVIDER_SIGN_MESSAGE_URL=ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ht.WALLET_PROVIDER_SEND_TRANSACTION_URL=ht.WALLET_PROVIDER_DISCONNECT_URL=ht.WALLET_PROVIDER_CONNECT_URL=ht.WALLET_PROVIDER_TESTNET=ht.WALLET_PROVIDER_DEVNET=ht.WALLET_PROVIDER_MAINNET=void 0;ht.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_CONNECT_URL="hook/login";ht.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ht.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ht.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ht.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var mO=B(Du=>{"use strict";f();Object.defineProperty(Du,"__esModule",{value:!0});Du.ErrInvalidTxSignReturnValue=Du.Err=void 0;var Ip=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Du.Err=Ip;var qv=class extends Ip{constructor(){super("Invalid response in transaction sign return url")}};Du.ErrInvalidTxSignReturnValue=qv});var wO=B(_p=>{"use strict";f();Object.defineProperty(_p,"__esModule",{value:!0});_p.PlainSignedTransaction=void 0;var Vv=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.options=void 0,this.signature="",Object.assign(this,e)}};_p.PlainSignedTransaction=Vv});var vl=B(es=>{"use strict";f();var po=es&&es.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},IG=es&&es.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var vO=IG(yO()),go=Uv(),EO=mO(),_G=wO(),Ou=class{constructor(e){this.walletUrl=e}login(e){return po(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(t,e?.redirectDelayMilliseconds),t})}redirect(e,t){return po(this,void 0,void 0,function*(){t?yield this.redirectLater(e,t):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,t){return po(this,void 0,void 0,function*(){yield new Promise(i=>{setTimeout(()=>{window.location.href=e,i(!0)},t)})})}logout(e){return po(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(t,e?.redirectDelayMilliseconds),!0})}signMessage(e,t){return po(this,void 0,void 0,function*(){let i=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:t?.callbackUrl,params:{message:e}});return yield this.redirect(i),i})}signTransactions(e,t){return po(this,void 0,void 0,function*(){let i={};e.map(s=>{let o=Ou.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(o[a])});let n=this.buildWalletUrl({endpoint:go.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:t?.callbackUrl,params:i});window.location.href=n})}signTransaction(e,t){return po(this,void 0,void 0,function*(){yield this.signTransactions([e],t)})}getTransactionsFromWalletUrl(){let e=vO.default.parse(window.location.search.slice(1));return Ou.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(go.WALLET_PROVIDER_CALLBACK_PARAM)&&e[go.WALLET_PROVIDER_CALLBACK_PARAM]===go.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var t;console.info(`Received urlParams: ${e}`);let i=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of i)if(!e[o]||!Array.isArray(e[o]))throw new EO.ErrInvalidTxSignReturnValue;let n=e.nonce.length;for(let o of i)if(e[o].length!==n)throw new EO.ErrInvalidTxSignReturnValue;let s=[];for(let o=0;o{f()});var xO=B((SO,Hv)=>{f();(function(r,e){"use strict";function t(A,c){if(!A)throw new Error(c||"Assertion failed")}function i(A,c){A.super_=c;var d=function(){};d.prototype=c.prototype,A.prototype=new d,A.prototype.constructor=A}function n(A,c,d){if(n.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,A!==null&&((c==="le"||c==="be")&&(d=c,c=10),this._init(A||0,c||10,d||"be"))}typeof r=="object"?r.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=CO().Buffer}catch{}n.isBN=function(c){return c instanceof n?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===n.wordSize&&Array.isArray(c.words)},n.max=function(c,d){return c.cmp(d)>0?c:d},n.min=function(c,d){return c.cmp(d)<0?c:d},n.prototype._init=function(c,d,g){if(typeof c=="number")return this._initNumber(c,d,g);if(typeof c=="object")return this._initArray(c,d,g);d==="hex"&&(d=16),t(d===(d|0)&&d>=2&&d<=36),c=c.toString().replace(/\s+/g,"");var m=0;c[0]==="-"&&(m++,this.negative=1),m=0;m-=3)S=c[m]|c[m-1]<<8|c[m-2]<<16,this.words[v]|=S<>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);else if(g==="le")for(m=0,v=0;m>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);return this._strip()};function o(A,c){var d=A.charCodeAt(c);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;t(!1,"Invalid character in "+A)}function a(A,c,d){var g=o(A,d);return d-1>=c&&(g|=o(A,d-1)<<4),g}n.prototype._parseHex=function(c,d,g){this.length=Math.ceil((c.length-d)/6),this.words=new Array(this.length);for(var m=0;m=d;m-=2)D=a(c,d,m)<=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8;else{var I=c.length-d;for(m=I%2===0?d+1:d;m=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8}this._strip()};function u(A,c,d,g){for(var m=0,v=0,S=Math.min(A.length,d),D=c;D=49?v=I-49+10:I>=17?v=I-17+10:v=I,t(I>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{n.prototype.inspect=p}else n.prototype.inspect=p;function p(){return(this.red?""}var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],N=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(c,d){c=c||10,d=d|0||1;var g;if(c===16||c==="hex"){g="";for(var m=0,v=0,S=0;S>>24-m&16777215,m+=2,m>=26&&(m-=26,S--),v!==0||S!==this.length-1?g=w[6-I.length]+I+g:g=I+g}for(v!==0&&(g=v.toString(16)+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var l=N[c],C=O[c];g="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ie=Z.modrn(C).toString(c);Z=Z.idivn(C),Z.isZero()?g=ie+g:g=w[l-ie.length]+ie+g}for(this.isZero()&&(g="0"+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}t(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(c,d){return this.toArrayLike(s,c,d)}),n.prototype.toArray=function(c,d){return this.toArrayLike(Array,c,d)};var T=function(c,d){return c.allocUnsafe?c.allocUnsafe(d):new c(d)};n.prototype.toArrayLike=function(c,d,g){this._strip();var m=this.byteLength(),v=g||Math.max(1,m);t(m<=v,"byte array longer than desired length"),t(v>0,"Requested array length <= 0");var S=T(c,v),D=d==="le"?"LE":"BE";return this["_toArrayLike"+D](S,m),S},n.prototype._toArrayLikeLE=function(c,d){for(var g=0,m=0,v=0,S=0;v>8&255),g>16&255),S===6?(g>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g=0&&(c[g--]=D>>8&255),g>=0&&(c[g--]=D>>16&255),S===6?(g>=0&&(c[g--]=D>>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g>=0)for(c[g--]=m;g>=0;)c[g--]=0},Math.clz32?n.prototype._countBits=function(c){return 32-Math.clz32(c)}:n.prototype._countBits=function(c){var d=c,g=0;return d>=4096&&(g+=13,d>>>=13),d>=64&&(g+=7,d>>>=7),d>=8&&(g+=4,d>>>=4),d>=2&&(g+=2,d>>>=2),g+d},n.prototype._zeroBits=function(c){if(c===0)return 26;var d=c,g=0;return d&8191||(g+=13,d>>>=13),d&127||(g+=7,d>>>=7),d&15||(g+=4,d>>>=4),d&3||(g+=2,d>>>=2),d&1||g++,g},n.prototype.bitLength=function(){var c=this.words[this.length-1],d=this._countBits(c);return(this.length-1)*26+d};function V(A){for(var c=new Array(A.bitLength()),d=0;d>>m&1}return c}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,d=0;dc.length?this.clone().ior(c):c.clone().ior(this)},n.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},n.prototype.iuand=function(c){var d;this.length>c.length?d=c:d=this;for(var g=0;gc.length?this.clone().iand(c):c.clone().iand(this)},n.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},n.prototype.iuxor=function(c){var d,g;this.length>c.length?(d=this,g=c):(d=c,g=this);for(var m=0;mc.length?this.clone().ixor(c):c.clone().ixor(this)},n.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},n.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var d=Math.ceil(c/26)|0,g=c%26;this._expand(d),g>0&&d--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-g),this._strip()},n.prototype.notn=function(c){return this.clone().inotn(c)},n.prototype.setn=function(c,d){t(typeof c=="number"&&c>=0);var g=c/26|0,m=c%26;return this._expand(g+1),d?this.words[g]=this.words[g]|1<c.length?(g=this,m=c):(g=c,m=this);for(var v=0,S=0;S>>26;for(;v!==0&&S>>26;if(this.length=g.length,v!==0)this.words[this.length]=v,this.length++;else if(g!==this)for(;Sc.length?this.clone().iadd(c):c.clone().iadd(this)},n.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var d=this.iadd(c);return c.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,v;g>0?(m=this,v=c):(m=c,v=this);for(var S=0,D=0;D>26,this.words[D]=d&67108863;for(;S!==0&&D>26,this.words[D]=d&67108863;if(S===0&&D>>26,Z=I&67108863,ie=Math.min(l,c.length-1),ee=Math.max(0,l-A.length+1);ee<=ie;ee++){var ae=l-ee|0;m=A.words[ae]|0,v=c.words[ee]|0,S=m*v+Z,C+=S/67108864|0,Z=S&67108863}d.words[l]=Z|0,I=C|0}return I!==0?d.words[l]=I|0:d.length--,d._strip()}var $=function(c,d,g){var m=c.words,v=d.words,S=g.words,D=0,I,l,C,Z=m[0]|0,ie=Z&8191,ee=Z>>>13,ae=m[1]|0,E=ae&8191,b=ae>>>13,x=m[2]|0,L=x&8191,P=x>>>13,U=m[3]|0,q=U&8191,M=U>>>13,Q=m[4]|0,K=Q&8191,H=Q>>>13,ue=m[5]|0,he=ue&8191,de=ue>>>13,Me=m[6]|0,be=Me&8191,xe=Me>>>13,Be=m[7]|0,Ie=Be&8191,Pe=Be>>>13,us=m[8]|0,Ze=us&8191,et=us>>>13,Ar=m[9]|0,ze=Ar&8191,Ue=Ar>>>13,jt=v[0]|0,Ce=jt&8191,mt=jt>>>13,vE=v[1]|0,wt=vE&8191,vt=vE>>>13,EE=v[2]|0,Et=EE&8191,At=EE>>>13,AE=v[3]|0,It=AE&8191,_t=AE>>>13,IE=v[4]|0,bt=IE&8191,Ct=IE>>>13,_E=v[5]|0,St=_E&8191,xt=_E>>>13,bE=v[6]|0,Tt=bE&8191,Nt=bE>>>13,CE=v[7]|0,Dt=CE&8191,Ot=CE>>>13,SE=v[8]|0,Pt=SE&8191,Bt=SE>>>13,xE=v[9]|0,Mt=xE&8191,Rt=xE>>>13;g.negative=c.negative^d.negative,g.length=19,I=Math.imul(ie,Ce),l=Math.imul(ie,mt),l=l+Math.imul(ee,Ce)|0,C=Math.imul(ee,mt);var Yp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Yp>>>26)|0,Yp&=67108863,I=Math.imul(E,Ce),l=Math.imul(E,mt),l=l+Math.imul(b,Ce)|0,C=Math.imul(b,mt),I=I+Math.imul(ie,wt)|0,l=l+Math.imul(ie,vt)|0,l=l+Math.imul(ee,wt)|0,C=C+Math.imul(ee,vt)|0;var Jp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Jp>>>26)|0,Jp&=67108863,I=Math.imul(L,Ce),l=Math.imul(L,mt),l=l+Math.imul(P,Ce)|0,C=Math.imul(P,mt),I=I+Math.imul(E,wt)|0,l=l+Math.imul(E,vt)|0,l=l+Math.imul(b,wt)|0,C=C+Math.imul(b,vt)|0,I=I+Math.imul(ie,Et)|0,l=l+Math.imul(ie,At)|0,l=l+Math.imul(ee,Et)|0,C=C+Math.imul(ee,At)|0;var Xp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Xp>>>26)|0,Xp&=67108863,I=Math.imul(q,Ce),l=Math.imul(q,mt),l=l+Math.imul(M,Ce)|0,C=Math.imul(M,mt),I=I+Math.imul(L,wt)|0,l=l+Math.imul(L,vt)|0,l=l+Math.imul(P,wt)|0,C=C+Math.imul(P,vt)|0,I=I+Math.imul(E,Et)|0,l=l+Math.imul(E,At)|0,l=l+Math.imul(b,Et)|0,C=C+Math.imul(b,At)|0,I=I+Math.imul(ie,It)|0,l=l+Math.imul(ie,_t)|0,l=l+Math.imul(ee,It)|0,C=C+Math.imul(ee,_t)|0;var Zp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Zp>>>26)|0,Zp&=67108863,I=Math.imul(K,Ce),l=Math.imul(K,mt),l=l+Math.imul(H,Ce)|0,C=Math.imul(H,mt),I=I+Math.imul(q,wt)|0,l=l+Math.imul(q,vt)|0,l=l+Math.imul(M,wt)|0,C=C+Math.imul(M,vt)|0,I=I+Math.imul(L,Et)|0,l=l+Math.imul(L,At)|0,l=l+Math.imul(P,Et)|0,C=C+Math.imul(P,At)|0,I=I+Math.imul(E,It)|0,l=l+Math.imul(E,_t)|0,l=l+Math.imul(b,It)|0,C=C+Math.imul(b,_t)|0,I=I+Math.imul(ie,bt)|0,l=l+Math.imul(ie,Ct)|0,l=l+Math.imul(ee,bt)|0,C=C+Math.imul(ee,Ct)|0;var e0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(e0>>>26)|0,e0&=67108863,I=Math.imul(he,Ce),l=Math.imul(he,mt),l=l+Math.imul(de,Ce)|0,C=Math.imul(de,mt),I=I+Math.imul(K,wt)|0,l=l+Math.imul(K,vt)|0,l=l+Math.imul(H,wt)|0,C=C+Math.imul(H,vt)|0,I=I+Math.imul(q,Et)|0,l=l+Math.imul(q,At)|0,l=l+Math.imul(M,Et)|0,C=C+Math.imul(M,At)|0,I=I+Math.imul(L,It)|0,l=l+Math.imul(L,_t)|0,l=l+Math.imul(P,It)|0,C=C+Math.imul(P,_t)|0,I=I+Math.imul(E,bt)|0,l=l+Math.imul(E,Ct)|0,l=l+Math.imul(b,bt)|0,C=C+Math.imul(b,Ct)|0,I=I+Math.imul(ie,St)|0,l=l+Math.imul(ie,xt)|0,l=l+Math.imul(ee,St)|0,C=C+Math.imul(ee,xt)|0;var t0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(t0>>>26)|0,t0&=67108863,I=Math.imul(be,Ce),l=Math.imul(be,mt),l=l+Math.imul(xe,Ce)|0,C=Math.imul(xe,mt),I=I+Math.imul(he,wt)|0,l=l+Math.imul(he,vt)|0,l=l+Math.imul(de,wt)|0,C=C+Math.imul(de,vt)|0,I=I+Math.imul(K,Et)|0,l=l+Math.imul(K,At)|0,l=l+Math.imul(H,Et)|0,C=C+Math.imul(H,At)|0,I=I+Math.imul(q,It)|0,l=l+Math.imul(q,_t)|0,l=l+Math.imul(M,It)|0,C=C+Math.imul(M,_t)|0,I=I+Math.imul(L,bt)|0,l=l+Math.imul(L,Ct)|0,l=l+Math.imul(P,bt)|0,C=C+Math.imul(P,Ct)|0,I=I+Math.imul(E,St)|0,l=l+Math.imul(E,xt)|0,l=l+Math.imul(b,St)|0,C=C+Math.imul(b,xt)|0,I=I+Math.imul(ie,Tt)|0,l=l+Math.imul(ie,Nt)|0,l=l+Math.imul(ee,Tt)|0,C=C+Math.imul(ee,Nt)|0;var r0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(r0>>>26)|0,r0&=67108863,I=Math.imul(Ie,Ce),l=Math.imul(Ie,mt),l=l+Math.imul(Pe,Ce)|0,C=Math.imul(Pe,mt),I=I+Math.imul(be,wt)|0,l=l+Math.imul(be,vt)|0,l=l+Math.imul(xe,wt)|0,C=C+Math.imul(xe,vt)|0,I=I+Math.imul(he,Et)|0,l=l+Math.imul(he,At)|0,l=l+Math.imul(de,Et)|0,C=C+Math.imul(de,At)|0,I=I+Math.imul(K,It)|0,l=l+Math.imul(K,_t)|0,l=l+Math.imul(H,It)|0,C=C+Math.imul(H,_t)|0,I=I+Math.imul(q,bt)|0,l=l+Math.imul(q,Ct)|0,l=l+Math.imul(M,bt)|0,C=C+Math.imul(M,Ct)|0,I=I+Math.imul(L,St)|0,l=l+Math.imul(L,xt)|0,l=l+Math.imul(P,St)|0,C=C+Math.imul(P,xt)|0,I=I+Math.imul(E,Tt)|0,l=l+Math.imul(E,Nt)|0,l=l+Math.imul(b,Tt)|0,C=C+Math.imul(b,Nt)|0,I=I+Math.imul(ie,Dt)|0,l=l+Math.imul(ie,Ot)|0,l=l+Math.imul(ee,Dt)|0,C=C+Math.imul(ee,Ot)|0;var i0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(i0>>>26)|0,i0&=67108863,I=Math.imul(Ze,Ce),l=Math.imul(Ze,mt),l=l+Math.imul(et,Ce)|0,C=Math.imul(et,mt),I=I+Math.imul(Ie,wt)|0,l=l+Math.imul(Ie,vt)|0,l=l+Math.imul(Pe,wt)|0,C=C+Math.imul(Pe,vt)|0,I=I+Math.imul(be,Et)|0,l=l+Math.imul(be,At)|0,l=l+Math.imul(xe,Et)|0,C=C+Math.imul(xe,At)|0,I=I+Math.imul(he,It)|0,l=l+Math.imul(he,_t)|0,l=l+Math.imul(de,It)|0,C=C+Math.imul(de,_t)|0,I=I+Math.imul(K,bt)|0,l=l+Math.imul(K,Ct)|0,l=l+Math.imul(H,bt)|0,C=C+Math.imul(H,Ct)|0,I=I+Math.imul(q,St)|0,l=l+Math.imul(q,xt)|0,l=l+Math.imul(M,St)|0,C=C+Math.imul(M,xt)|0,I=I+Math.imul(L,Tt)|0,l=l+Math.imul(L,Nt)|0,l=l+Math.imul(P,Tt)|0,C=C+Math.imul(P,Nt)|0,I=I+Math.imul(E,Dt)|0,l=l+Math.imul(E,Ot)|0,l=l+Math.imul(b,Dt)|0,C=C+Math.imul(b,Ot)|0,I=I+Math.imul(ie,Pt)|0,l=l+Math.imul(ie,Bt)|0,l=l+Math.imul(ee,Pt)|0,C=C+Math.imul(ee,Bt)|0;var n0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(n0>>>26)|0,n0&=67108863,I=Math.imul(ze,Ce),l=Math.imul(ze,mt),l=l+Math.imul(Ue,Ce)|0,C=Math.imul(Ue,mt),I=I+Math.imul(Ze,wt)|0,l=l+Math.imul(Ze,vt)|0,l=l+Math.imul(et,wt)|0,C=C+Math.imul(et,vt)|0,I=I+Math.imul(Ie,Et)|0,l=l+Math.imul(Ie,At)|0,l=l+Math.imul(Pe,Et)|0,C=C+Math.imul(Pe,At)|0,I=I+Math.imul(be,It)|0,l=l+Math.imul(be,_t)|0,l=l+Math.imul(xe,It)|0,C=C+Math.imul(xe,_t)|0,I=I+Math.imul(he,bt)|0,l=l+Math.imul(he,Ct)|0,l=l+Math.imul(de,bt)|0,C=C+Math.imul(de,Ct)|0,I=I+Math.imul(K,St)|0,l=l+Math.imul(K,xt)|0,l=l+Math.imul(H,St)|0,C=C+Math.imul(H,xt)|0,I=I+Math.imul(q,Tt)|0,l=l+Math.imul(q,Nt)|0,l=l+Math.imul(M,Tt)|0,C=C+Math.imul(M,Nt)|0,I=I+Math.imul(L,Dt)|0,l=l+Math.imul(L,Ot)|0,l=l+Math.imul(P,Dt)|0,C=C+Math.imul(P,Ot)|0,I=I+Math.imul(E,Pt)|0,l=l+Math.imul(E,Bt)|0,l=l+Math.imul(b,Pt)|0,C=C+Math.imul(b,Bt)|0,I=I+Math.imul(ie,Mt)|0,l=l+Math.imul(ie,Rt)|0,l=l+Math.imul(ee,Mt)|0,C=C+Math.imul(ee,Rt)|0;var s0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(s0>>>26)|0,s0&=67108863,I=Math.imul(ze,wt),l=Math.imul(ze,vt),l=l+Math.imul(Ue,wt)|0,C=Math.imul(Ue,vt),I=I+Math.imul(Ze,Et)|0,l=l+Math.imul(Ze,At)|0,l=l+Math.imul(et,Et)|0,C=C+Math.imul(et,At)|0,I=I+Math.imul(Ie,It)|0,l=l+Math.imul(Ie,_t)|0,l=l+Math.imul(Pe,It)|0,C=C+Math.imul(Pe,_t)|0,I=I+Math.imul(be,bt)|0,l=l+Math.imul(be,Ct)|0,l=l+Math.imul(xe,bt)|0,C=C+Math.imul(xe,Ct)|0,I=I+Math.imul(he,St)|0,l=l+Math.imul(he,xt)|0,l=l+Math.imul(de,St)|0,C=C+Math.imul(de,xt)|0,I=I+Math.imul(K,Tt)|0,l=l+Math.imul(K,Nt)|0,l=l+Math.imul(H,Tt)|0,C=C+Math.imul(H,Nt)|0,I=I+Math.imul(q,Dt)|0,l=l+Math.imul(q,Ot)|0,l=l+Math.imul(M,Dt)|0,C=C+Math.imul(M,Ot)|0,I=I+Math.imul(L,Pt)|0,l=l+Math.imul(L,Bt)|0,l=l+Math.imul(P,Pt)|0,C=C+Math.imul(P,Bt)|0,I=I+Math.imul(E,Mt)|0,l=l+Math.imul(E,Rt)|0,l=l+Math.imul(b,Mt)|0,C=C+Math.imul(b,Rt)|0;var o0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(o0>>>26)|0,o0&=67108863,I=Math.imul(ze,Et),l=Math.imul(ze,At),l=l+Math.imul(Ue,Et)|0,C=Math.imul(Ue,At),I=I+Math.imul(Ze,It)|0,l=l+Math.imul(Ze,_t)|0,l=l+Math.imul(et,It)|0,C=C+Math.imul(et,_t)|0,I=I+Math.imul(Ie,bt)|0,l=l+Math.imul(Ie,Ct)|0,l=l+Math.imul(Pe,bt)|0,C=C+Math.imul(Pe,Ct)|0,I=I+Math.imul(be,St)|0,l=l+Math.imul(be,xt)|0,l=l+Math.imul(xe,St)|0,C=C+Math.imul(xe,xt)|0,I=I+Math.imul(he,Tt)|0,l=l+Math.imul(he,Nt)|0,l=l+Math.imul(de,Tt)|0,C=C+Math.imul(de,Nt)|0,I=I+Math.imul(K,Dt)|0,l=l+Math.imul(K,Ot)|0,l=l+Math.imul(H,Dt)|0,C=C+Math.imul(H,Ot)|0,I=I+Math.imul(q,Pt)|0,l=l+Math.imul(q,Bt)|0,l=l+Math.imul(M,Pt)|0,C=C+Math.imul(M,Bt)|0,I=I+Math.imul(L,Mt)|0,l=l+Math.imul(L,Rt)|0,l=l+Math.imul(P,Mt)|0,C=C+Math.imul(P,Rt)|0;var a0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(a0>>>26)|0,a0&=67108863,I=Math.imul(ze,It),l=Math.imul(ze,_t),l=l+Math.imul(Ue,It)|0,C=Math.imul(Ue,_t),I=I+Math.imul(Ze,bt)|0,l=l+Math.imul(Ze,Ct)|0,l=l+Math.imul(et,bt)|0,C=C+Math.imul(et,Ct)|0,I=I+Math.imul(Ie,St)|0,l=l+Math.imul(Ie,xt)|0,l=l+Math.imul(Pe,St)|0,C=C+Math.imul(Pe,xt)|0,I=I+Math.imul(be,Tt)|0,l=l+Math.imul(be,Nt)|0,l=l+Math.imul(xe,Tt)|0,C=C+Math.imul(xe,Nt)|0,I=I+Math.imul(he,Dt)|0,l=l+Math.imul(he,Ot)|0,l=l+Math.imul(de,Dt)|0,C=C+Math.imul(de,Ot)|0,I=I+Math.imul(K,Pt)|0,l=l+Math.imul(K,Bt)|0,l=l+Math.imul(H,Pt)|0,C=C+Math.imul(H,Bt)|0,I=I+Math.imul(q,Mt)|0,l=l+Math.imul(q,Rt)|0,l=l+Math.imul(M,Mt)|0,C=C+Math.imul(M,Rt)|0;var u0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(u0>>>26)|0,u0&=67108863,I=Math.imul(ze,bt),l=Math.imul(ze,Ct),l=l+Math.imul(Ue,bt)|0,C=Math.imul(Ue,Ct),I=I+Math.imul(Ze,St)|0,l=l+Math.imul(Ze,xt)|0,l=l+Math.imul(et,St)|0,C=C+Math.imul(et,xt)|0,I=I+Math.imul(Ie,Tt)|0,l=l+Math.imul(Ie,Nt)|0,l=l+Math.imul(Pe,Tt)|0,C=C+Math.imul(Pe,Nt)|0,I=I+Math.imul(be,Dt)|0,l=l+Math.imul(be,Ot)|0,l=l+Math.imul(xe,Dt)|0,C=C+Math.imul(xe,Ot)|0,I=I+Math.imul(he,Pt)|0,l=l+Math.imul(he,Bt)|0,l=l+Math.imul(de,Pt)|0,C=C+Math.imul(de,Bt)|0,I=I+Math.imul(K,Mt)|0,l=l+Math.imul(K,Rt)|0,l=l+Math.imul(H,Mt)|0,C=C+Math.imul(H,Rt)|0;var c0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(c0>>>26)|0,c0&=67108863,I=Math.imul(ze,St),l=Math.imul(ze,xt),l=l+Math.imul(Ue,St)|0,C=Math.imul(Ue,xt),I=I+Math.imul(Ze,Tt)|0,l=l+Math.imul(Ze,Nt)|0,l=l+Math.imul(et,Tt)|0,C=C+Math.imul(et,Nt)|0,I=I+Math.imul(Ie,Dt)|0,l=l+Math.imul(Ie,Ot)|0,l=l+Math.imul(Pe,Dt)|0,C=C+Math.imul(Pe,Ot)|0,I=I+Math.imul(be,Pt)|0,l=l+Math.imul(be,Bt)|0,l=l+Math.imul(xe,Pt)|0,C=C+Math.imul(xe,Bt)|0,I=I+Math.imul(he,Mt)|0,l=l+Math.imul(he,Rt)|0,l=l+Math.imul(de,Mt)|0,C=C+Math.imul(de,Rt)|0;var l0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(l0>>>26)|0,l0&=67108863,I=Math.imul(ze,Tt),l=Math.imul(ze,Nt),l=l+Math.imul(Ue,Tt)|0,C=Math.imul(Ue,Nt),I=I+Math.imul(Ze,Dt)|0,l=l+Math.imul(Ze,Ot)|0,l=l+Math.imul(et,Dt)|0,C=C+Math.imul(et,Ot)|0,I=I+Math.imul(Ie,Pt)|0,l=l+Math.imul(Ie,Bt)|0,l=l+Math.imul(Pe,Pt)|0,C=C+Math.imul(Pe,Bt)|0,I=I+Math.imul(be,Mt)|0,l=l+Math.imul(be,Rt)|0,l=l+Math.imul(xe,Mt)|0,C=C+Math.imul(xe,Rt)|0;var f0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(f0>>>26)|0,f0&=67108863,I=Math.imul(ze,Dt),l=Math.imul(ze,Ot),l=l+Math.imul(Ue,Dt)|0,C=Math.imul(Ue,Ot),I=I+Math.imul(Ze,Pt)|0,l=l+Math.imul(Ze,Bt)|0,l=l+Math.imul(et,Pt)|0,C=C+Math.imul(et,Bt)|0,I=I+Math.imul(Ie,Mt)|0,l=l+Math.imul(Ie,Rt)|0,l=l+Math.imul(Pe,Mt)|0,C=C+Math.imul(Pe,Rt)|0;var h0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(h0>>>26)|0,h0&=67108863,I=Math.imul(ze,Pt),l=Math.imul(ze,Bt),l=l+Math.imul(Ue,Pt)|0,C=Math.imul(Ue,Bt),I=I+Math.imul(Ze,Mt)|0,l=l+Math.imul(Ze,Rt)|0,l=l+Math.imul(et,Mt)|0,C=C+Math.imul(et,Rt)|0;var d0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(d0>>>26)|0,d0&=67108863,I=Math.imul(ze,Mt),l=Math.imul(ze,Rt),l=l+Math.imul(Ue,Mt)|0,C=Math.imul(Ue,Rt);var p0=(D+I|0)+((l&8191)<<13)|0;return D=(C+(l>>>13)|0)+(p0>>>26)|0,p0&=67108863,S[0]=Yp,S[1]=Jp,S[2]=Xp,S[3]=Zp,S[4]=e0,S[5]=t0,S[6]=r0,S[7]=i0,S[8]=n0,S[9]=s0,S[10]=o0,S[11]=a0,S[12]=u0,S[13]=c0,S[14]=l0,S[15]=f0,S[16]=h0,S[17]=d0,S[18]=p0,D!==0&&(S[19]=D,g.length++),g};Math.imul||($=z);function se(A,c,d){d.negative=c.negative^A.negative,d.length=A.length+c.length;for(var g=0,m=0,v=0;v>>26)|0,m+=S>>>26,S&=67108863}d.words[v]=D,g=S,S=m}return g!==0?d.words[v]=g:d.length--,d._strip()}function Y(A,c,d){return se(A,c,d)}n.prototype.mulTo=function(c,d){var g,m=this.length+c.length;return this.length===10&&c.length===10?g=$(this,c,d):m<63?g=z(this,c,d):m<1024?g=se(this,c,d):g=Y(this,c,d),g};function j(A,c){this.x=A,this.y=c}j.prototype.makeRBT=function(c){for(var d=new Array(c),g=n.prototype._countBits(c)-1,m=0;m>=1;return m},j.prototype.permute=function(c,d,g,m,v,S){for(var D=0;D>>1)v++;return 1<>>13,g[2*S+1]=v&8191,v=v>>>13;for(S=2*d;S>=26,g+=v/67108864|0,g+=S>>>26,this.words[m]=S&67108863}return g!==0&&(this.words[m]=g,this.length++),d?this.ineg():this},n.prototype.muln=function(c){return this.clone().imuln(c)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(c){var d=V(c);if(d.length===0)return new n(1);for(var g=this,m=0;m=0);var d=c%26,g=(c-d)/26,m=67108863>>>26-d<<26-d,v;if(d!==0){var S=0;for(v=0;v>>26-d}S&&(this.words[v]=S,this.length++)}if(g!==0){for(v=this.length-1;v>=0;v--)this.words[v+g]=this.words[v];for(v=0;v=0);var m;d?m=(d-d%26)/26:m=0;var v=c%26,S=Math.min((c-v)/26,this.length),D=67108863^67108863>>>v<S)for(this.length-=S,l=0;l=0&&(C!==0||l>=m);l--){var Z=this.words[l]|0;this.words[l]=C<<26-v|Z>>>v,C=Z&D}return I&&C!==0&&(I.words[I.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(c,d,g){return t(this.negative===0),this.iushrn(c,d,g)},n.prototype.shln=function(c){return this.clone().ishln(c)},n.prototype.ushln=function(c){return this.clone().iushln(c)},n.prototype.shrn=function(c){return this.clone().ishrn(c)},n.prototype.ushrn=function(c){return this.clone().iushrn(c)},n.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var d=c%26,g=(c-d)/26,m=1<=0);var d=c%26,g=(c-d)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(d!==0&&g++,this.length=Math.min(g,this.length),d!==0){var m=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(I/67108864|0),this.words[v+g]=S&67108863}for(;v>26,this.words[v+g]=S&67108863;if(D===0)return this._strip();for(t(D===-1),D=0,v=0;v>26,this.words[v]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(c,d){var g=this.length-c.length,m=this.clone(),v=c,S=v.words[v.length-1]|0,D=this._countBits(S);g=26-D,g!==0&&(v=v.ushln(g),m.iushln(g),S=v.words[v.length-1]|0);var I=m.length-v.length,l;if(d!=="mod"){l=new n(null),l.length=I+1,l.words=new Array(l.length);for(var C=0;C=0;ie--){var ee=(m.words[v.length+ie]|0)*67108864+(m.words[v.length+ie-1]|0);for(ee=Math.min(ee/S|0,67108863),m._ishlnsubmul(v,ee,ie);m.negative!==0;)ee--,m.negative=0,m._ishlnsubmul(v,1,ie),m.isZero()||(m.negative^=1);l&&(l.words[ie]=ee)}return l&&l._strip(),m._strip(),d!=="div"&&g!==0&&m.iushrn(g),{div:l||null,mod:m}},n.prototype.divmod=function(c,d,g){if(t(!c.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var m,v,S;return this.negative!==0&&c.negative===0?(S=this.neg().divmod(c,d),d!=="mod"&&(m=S.div.neg()),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.iadd(c)),{div:m,mod:v}):this.negative===0&&c.negative!==0?(S=this.divmod(c.neg(),d),d!=="mod"&&(m=S.div.neg()),{div:m,mod:S.mod}):this.negative&c.negative?(S=this.neg().divmod(c.neg(),d),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.isub(c)),{div:S.div,mod:v}):c.length>this.length||this.cmp(c)<0?{div:new n(0),mod:this}:c.length===1?d==="div"?{div:this.divn(c.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new n(this.modrn(c.words[0]))}:this._wordDiv(c,d)},n.prototype.div=function(c){return this.divmod(c,"div",!1).div},n.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},n.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},n.prototype.divRound=function(c){var d=this.divmod(c);if(d.mod.isZero())return d.div;var g=d.div.negative!==0?d.mod.isub(c):d.mod,m=c.ushrn(1),v=c.andln(1),S=g.cmp(m);return S<0||v===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=(1<<26)%c,m=0,v=this.length-1;v>=0;v--)m=(g*m+(this.words[v]|0))%c;return d?-m:m},n.prototype.modn=function(c){return this.modrn(c)},n.prototype.idivn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=0,m=this.length-1;m>=0;m--){var v=(this.words[m]|0)+g*67108864;this.words[m]=v/c|0,g=v%c}return this._strip(),d?this.ineg():this},n.prototype.divn=function(c){return this.clone().idivn(c)},n.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=new n(0),D=new n(1),I=0;d.isEven()&&g.isEven();)d.iushrn(1),g.iushrn(1),++I;for(var l=g.clone(),C=d.clone();!d.isZero();){for(var Z=0,ie=1;!(d.words[0]&ie)&&Z<26;++Z,ie<<=1);if(Z>0)for(d.iushrn(Z);Z-- >0;)(m.isOdd()||v.isOdd())&&(m.iadd(l),v.isub(C)),m.iushrn(1),v.iushrn(1);for(var ee=0,ae=1;!(g.words[0]&ae)&&ee<26;++ee,ae<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(S.isOdd()||D.isOdd())&&(S.iadd(l),D.isub(C)),S.iushrn(1),D.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(S),v.isub(D)):(g.isub(d),S.isub(m),D.isub(v))}return{a:S,b:D,gcd:g.iushln(I)}},n.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=g.clone();d.cmpn(1)>0&&g.cmpn(1)>0;){for(var D=0,I=1;!(d.words[0]&I)&&D<26;++D,I<<=1);if(D>0)for(d.iushrn(D);D-- >0;)m.isOdd()&&m.iadd(S),m.iushrn(1);for(var l=0,C=1;!(g.words[0]&C)&&l<26;++l,C<<=1);if(l>0)for(g.iushrn(l);l-- >0;)v.isOdd()&&v.iadd(S),v.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(v)):(g.isub(d),v.isub(m))}var Z;return d.cmpn(1)===0?Z=m:Z=v,Z.cmpn(0)<0&&Z.iadd(c),Z},n.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var d=this.clone(),g=c.clone();d.negative=0,g.negative=0;for(var m=0;d.isEven()&&g.isEven();m++)d.iushrn(1),g.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;g.isEven();)g.iushrn(1);var v=d.cmp(g);if(v<0){var S=d;d=g,g=S}else if(v===0||g.cmpn(1)===0)break;d.isub(g)}while(!0);return g.iushln(m)},n.prototype.invm=function(c){return this.egcd(c).a.umod(c)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(c){return this.words[0]&c},n.prototype.bincn=function(c){t(typeof c=="number");var d=c%26,g=(c-d)/26,m=1<>>26,D&=67108863,this.words[S]=D}return v!==0&&(this.words[S]=v,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(c){var d=c<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var g;if(this.length>1)g=1;else{d&&(c=-c),t(c<=67108863,"Number is too big");var m=this.words[0]|0;g=m===c?0:mc.length)return 1;if(this.length=0;g--){var m=this.words[g]|0,v=c.words[g]|0;if(m!==v){mv&&(d=1);break}}return d},n.prototype.gtn=function(c){return this.cmpn(c)===1},n.prototype.gt=function(c){return this.cmp(c)===1},n.prototype.gten=function(c){return this.cmpn(c)>=0},n.prototype.gte=function(c){return this.cmp(c)>=0},n.prototype.ltn=function(c){return this.cmpn(c)===-1},n.prototype.lt=function(c){return this.cmp(c)===-1},n.prototype.lten=function(c){return this.cmpn(c)<=0},n.prototype.lte=function(c){return this.cmp(c)<=0},n.prototype.eqn=function(c){return this.cmpn(c)===0},n.prototype.eq=function(c){return this.cmp(c)===0},n.red=function(c){return new J(c)},n.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},n.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(c){return this.red=c,this},n.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},n.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},n.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},n.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},n.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},n.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},n.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},n.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},n.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var W={k256:null,p224:null,p192:null,p25519:null};function k(A,c){this.name=A,this.p=new n(c,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new n(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var d=c,g;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),g=d.bitLength();while(g>this.n);var m=g0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},k.prototype.split=function(c,d){c.iushrn(this.n,0,d)},k.prototype.imulK=function(c){return c.imul(this.k)};function R(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,k),R.prototype.split=function(c,d){for(var g=4194303,m=Math.min(c.length,9),v=0;v>>22,S=D}S>>>=22,c.words[v-10]=S,S===0&&c.length>10?c.length-=10:c.length-=9},R.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var d=0,g=0;g>>=26,c.words[g]=v,d=m}return d!==0&&(c.words[c.length++]=d),c},n._prime=function(c){if(W[c])return W[c];var d;if(c==="k256")d=new R;else if(c==="p224")d=new F;else if(c==="p192")d=new G;else if(c==="p25519")d=new ce;else throw new Error("Unknown prime "+c);return W[c]=d,d};function J(A){if(typeof A=="string"){var c=n._prime(A);this.m=c.p,this.prime=c}else t(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}J.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},J.prototype._verify2=function(c,d){t((c.negative|d.negative)===0,"red works only with positives"),t(c.red&&c.red===d.red,"red works only with red numbers")},J.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(h(c,c.umod(this.m)._forceRed(this)),c)},J.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},J.prototype.add=function(c,d){this._verify2(c,d);var g=c.add(d);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},J.prototype.iadd=function(c,d){this._verify2(c,d);var g=c.iadd(d);return g.cmp(this.m)>=0&&g.isub(this.m),g},J.prototype.sub=function(c,d){this._verify2(c,d);var g=c.sub(d);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},J.prototype.isub=function(c,d){this._verify2(c,d);var g=c.isub(d);return g.cmpn(0)<0&&g.iadd(this.m),g},J.prototype.shl=function(c,d){return this._verify1(c),this.imod(c.ushln(d))},J.prototype.imul=function(c,d){return this._verify2(c,d),this.imod(c.imul(d))},J.prototype.mul=function(c,d){return this._verify2(c,d),this.imod(c.mul(d))},J.prototype.isqr=function(c){return this.imul(c,c.clone())},J.prototype.sqr=function(c){return this.mul(c,c)},J.prototype.sqrt=function(c){if(c.isZero())return c.clone();var d=this.m.andln(3);if(t(d%2===1),d===3){var g=this.m.add(new n(1)).iushrn(2);return this.pow(c,g)}for(var m=this.m.subn(1),v=0;!m.isZero()&&m.andln(1)===0;)v++,m.iushrn(1);t(!m.isZero());var S=new n(1).toRed(this),D=S.redNeg(),I=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);this.pow(l,I).cmp(D)!==0;)l.redIAdd(D);for(var C=this.pow(l,m),Z=this.pow(c,m.addn(1).iushrn(1)),ie=this.pow(c,m),ee=v;ie.cmp(S)!==0;){for(var ae=ie,E=0;ae.cmp(S)!==0;E++)ae=ae.redSqr();t(E=0;v--){for(var C=d.words[v],Z=l-1;Z>=0;Z--){var ie=C>>Z&1;if(S!==m[0]&&(S=this.sqr(S)),ie===0&&D===0){I=0;continue}D<<=1,D|=ie,I++,!(I!==g&&(v!==0||Z!==0))&&(S=this.mul(S,m[D]),I=0,D=0)}l=26}return S},J.prototype.convertTo=function(c){var d=c.umod(this.m);return d===c?d.clone():d},J.prototype.convertFrom=function(c){var d=c.clone();return d.red=null,d},n.mont=function(c){return new X(c)};function X(A){J.call(this,A),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,J),X.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},X.prototype.convertFrom=function(c){var d=this.imod(c.mul(this.rinv));return d.red=null,d},X.prototype.imul=function(c,d){if(c.isZero()||d.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.mul=function(c,d){if(c.isZero()||d.isZero())return new n(0)._forceRed(this);var g=c.mul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.invm=function(c){var d=this.imod(c._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof Hv>"u"||Hv,SO)});var TO=B(Sp=>{"use strict";f();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.TransactionStatus=void 0;var El=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new El("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}};Sp.TransactionStatus=El});var Mu=B(Zt=>{"use strict";f();var bG=Zt&&Zt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),CG=Zt&&Zt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),SG=Zt&&Zt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&bG(e,r,t);return CG(e,r),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.zeroPadStringIfOddLength=Zt.isPaddedHex=Zt.numberToPaddedHex=Zt.Nonce=Zt.Address=void 0;var NO=SG(kl()),xG="erd",Al=class{constructor(e){this.value=e}static fromPubkey(e){let t=NO.toWords(e),i=NO.encode(xG,t);return new Al(i)}bech32(){return this.value}toString(){return this.bech32()}};Zt.Address=Al;var Qv=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return DO(this.value)}};Zt.Nonce=Qv;function DO(r){let e=r.toString(16);return OO(e)}Zt.numberToPaddedHex=DO;function TG(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}Zt.isPaddedHex=TG;function OO(r){return r=r||"",r.length%2==1?"0"+r:r}Zt.zeroPadStringIfOddLength=OO});var BO=B(xp=>{"use strict";f();Object.defineProperty(xp,"__esModule",{value:!0});xp.TransactionReceipt=void 0;var PO=Mu(),Il=class{constructor(){this.value="",this.sender=new PO.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new Il;return t.value=(e.value||0).toString(),t.sender=new PO.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}};xp.TransactionReceipt=Il});var MO=B(Vi=>{"use strict";f();Object.defineProperty(Vi,"__esModule",{value:!0});Vi.ErrContractQuery=Vi.ErrNetworkProvider=Vi.ErrUnexpectedCondition=Vi.Err=void 0;var Ru=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Vi.Err=Ru;var jv=class extends Ru{constructor(e){super(`Unexpected condition: [${e}]`)}};Vi.ErrUnexpectedCondition=jv;var Gv=class extends Ru{constructor(e,t,i){let n=`Request error on url [${e}]: [${t}]`;super(n,i)}};Vi.ErrNetworkProvider=Gv;var Kv=class extends Ru{constructor(e){super(e.message.replace("executeQuery:",""))}};Vi.ErrContractQuery=Kv});var LO=B(Lu=>{"use strict";f();Object.defineProperty(Lu,"__esModule",{value:!0});Lu.TransactionEventTopic=Lu.TransactionEvent=void 0;var RO=Mu(),_l=class{constructor(e){this.address=new RO.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let t=new _l;return t.address=new RO.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map(i=>new Tp(i)),t.data=y.Buffer.from(e.data||"","base64").toString(),t}findFirstOrNoneTopic(e){return this.topics.filter(t=>e(t))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Lu.TransactionEvent=_l;var Tp=class{constructor(e){this.raw=y.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Lu.TransactionEventTopic=Tp});var zv=B(Np=>{"use strict";f();Object.defineProperty(Np,"__esModule",{value:!0});Np.TransactionLogs=void 0;var NG=MO(),FO=Mu(),DG=LO(),bl=class{constructor(e){this.address=new FO.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new bl;return t.address=new FO.Address(e.address),t.events=(e.events||[]).map(i=>DG.TransactionEvent.fromHttpResponse(i)),t}findSingleOrNoneEvent(e,t){let i=this.findEvents(e,t);if(i.length>1)throw new NG.ErrUnexpectedCondition(`more than one event of type ${e}`);return i[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let i=this.events.filter(n=>n.identifier==e);return t&&(i=i.filter(n=>t(n))),i}};Np.TransactionLogs=bl});var qO=B(Uu=>{"use strict";f();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ContractResultItem=Uu.ContractResults=void 0;var UO=zv(),Dp=Mu(),Fu=class{constructor(e){this.items=e,this.items.sort(function(t,i){return t.nonce.valueOf()-i.nonce.valueOf()})}static fromProxyHttpResponse(e){let t=e.map(i=>ln.fromProxyHttpResponse(i));return new Fu(t)}static fromApiHttpResponse(e){let t=e.map(i=>ln.fromApiHttpResponse(i));return new Fu(t)}};Uu.ContractResults=Fu;var ln=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Dp.Address(""),this.sender=new Dp.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new UO.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return ln.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=ln.fromHttpResponse(e);return t.data=y.Buffer.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new ln;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new Dp.Address(e.receiver),t.sender=new Dp.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=UO.TransactionLogs.fromHttpResponse(e.logs||{}),t}};Uu.ContractResultItem=ln});var VO=B(rs=>{"use strict";f();var OG=rs&&rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rs,"__esModule",{value:!0});rs.EsdtContractAddress=rs.MaxUint64AsBigNumber=void 0;var PG=OG(jr()),BG=Mu();rs.MaxUint64AsBigNumber=new PG.default("18446744073709551615");rs.EsdtContractAddress=new BG.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var HO=B(qu=>{"use strict";f();var MG=qu&&qu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qu,"__esModule",{value:!0});qu.ContractQueryResponse=void 0;var RG=MG(jr()),LG=VO(),Cl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,i=e.returnCode||e.ReturnCode,n=e.returnMessage||e.ReturnMessage,s=new RG.default(e.gasRemaining||e.GasRemaining||0),o=LG.MaxUint64AsBigNumber.minus(s).toNumber();return new Cl({returnData:t,returnCode:i,returnMessage:n,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>y.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};qu.ContractQueryResponse=Cl});var QO=B(Op=>{"use strict";f();Object.defineProperty(Op,"__esModule",{value:!0});Op.ContractQueryRequest=void 0;var kv=class{constructor(e){this.query=e}toHttpRequest(){var e;let t={},i=this.query;return t.scAddress=i.address.bech32(),t.caller=!((e=i.caller)===null||e===void 0)&&e.bech32()?i.caller.bech32():void 0,t.funcName=i.func.toString(),t.value=i.value?i.value.toString():void 0,t.args=i.getEncodedArguments(),t}};Op.ContractQueryRequest=kv});var jO=B(Pp=>{"use strict";f();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.Query=void 0;var FG=Gr(),UG=jf(),Wv=class{constructor(e){this.caller=e.caller||new FG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new UG.ArgSerializer().valuesToStrings(this.args)}};Pp.Query=Wv});var e6=B((_ne,ZO)=>{f();ZO.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var is=B(wo=>{f();var $v,qG=[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 qG[e]};wo.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};wo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');$v=e};wo.isKanjiModeEnabled=function(){return typeof $v<"u"};wo.toSJIS=function(e){return $v(e)}});var Rp=B(Qr=>{f();Qr.L={bit:1};Qr.M={bit:0};Qr.Q={bit:3};Qr.H={bit:2};function VG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.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: "+r)}}Qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Qr.from=function(e,t){if(Qr.isValid(e))return e;try{return VG(e)}catch{return t}}});var i6=B((Nne,r6)=>{f();function t6(){this.buffer=[],this.length=0}t6.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};r6.exports=t6});var s6=B((One,n6)=>{f();function Sl(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sl.prototype.set=function(r,e,t,i){let n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)};Sl.prototype.get=function(r,e){return this.data[r*this.size+e]};Sl.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};Sl.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};n6.exports=Sl});var o6=B(Lp=>{f();var HG=is().getSymbolSize;Lp.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,i=HG(e),n=i===145?26:Math.ceil((i-13)/(2*t-2))*2,s=[i-7];for(let o=1;o{f();var QG=is().getSymbolSize,a6=7;u6.getPositions=function(e){let t=QG(e);return[[0,0],[t-a6,0],[0,t-a6]]}});var l6=B($e=>{f();$e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var vo={N1:3,N2:3,N3:40,N4:10};$e.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};$e.from=function(e){return $e.isValid(e)?parseInt(e,10):void 0};$e.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let u=0;u=5&&(i+=vo.N1+(n-5)),o=p,n=1),p=e.get(h,u),p===a?s++:(s>=5&&(i+=vo.N1+(s-5)),a=p,s=1)}n>=5&&(i+=vo.N1+(n-5)),s>=5&&(i+=vo.N1+(s-5))}return i};$e.getPenaltyN2=function(e){let t=e.size,i=0;for(let n=0;n=10&&(n===1488||n===93)&&i++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&i++}return i*vo.N3};$e.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let s=0;s{f();var ns=Rp(),Fp=[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],Up=[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];Yv.getBlocksCount=function(e,t){switch(t){case ns.L:return Fp[(e-1)*4+0];case ns.M:return Fp[(e-1)*4+1];case ns.Q:return Fp[(e-1)*4+2];case ns.H:return Fp[(e-1)*4+3];default:return}};Yv.getTotalCodewordsCount=function(e,t){switch(t){case ns.L:return Up[(e-1)*4+0];case ns.M:return Up[(e-1)*4+1];case ns.Q:return Up[(e-1)*4+2];case ns.H:return Up[(e-1)*4+3];default:return}}});var f6=B(Vp=>{f();var xl=new Uint8Array(512),qp=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)xl[t]=e,qp[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)xl[t]=xl[t-255]})();Vp.log=function(e){if(e<1)throw new Error("log("+e+")");return qp[e]};Vp.exp=function(e){return xl[e]};Vp.mul=function(e,t){return e===0||t===0?0:xl[qp[e]+qp[t]]}});var h6=B(Tl=>{f();var Xv=f6();Tl.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n=0;){let n=i[0];for(let o=0;o{f();var d6=h6();function Zv(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Zv.prototype.initialize=function(e){this.degree=e,this.genPoly=d6.generateECPolynomial(this.degree)};Zv.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=d6.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let s=new Uint8Array(this.degree);return s.set(i,n),s}return i};p6.exports=Zv});var eE=B(y6=>{f();y6.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var tE=B(fn=>{f();var m6="[0-9]+",GG="[A-Z $%*+\\-./:]+",Nl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Nl=Nl.replace(/u/g,"\\u");var KG="(?:(?![A-Z0-9 $%*+\\-./:]|"+Nl+`)(?:.|[\r -]))+`;fn.KANJI=new RegExp(Nl,"g");fn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");fn.BYTE=new RegExp(KG,"g");fn.NUMERIC=new RegExp(m6,"g");fn.ALPHANUMERIC=new RegExp(GG,"g");var zG=new RegExp("^"+Nl+"$"),kG=new RegExp("^"+m6+"$"),WG=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");fn.testKanji=function(e){return zG.test(e)};fn.testNumeric=function(e){return kG.test(e)};fn.testAlphanumeric=function(e){return WG.test(e)}});var ss=B(qt=>{f();var $G=eE(),rE=tE();qt.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};qt.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};qt.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};qt.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};qt.MIXED={bit:-1};qt.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!$G.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};qt.getBestModeForData=function(e){return rE.testNumeric(e)?qt.NUMERIC:rE.testAlphanumeric(e)?qt.ALPHANUMERIC:rE.testKanji(e)?qt.KANJI:qt.BYTE};qt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};qt.isValid=function(e){return e&&e.bit&&e.ccBits};function YG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return qt.NUMERIC;case"alphanumeric":return qt.ALPHANUMERIC;case"kanji":return qt.KANJI;case"byte":return qt.BYTE;default:throw new Error("Unknown mode: "+r)}}qt.from=function(e,t){if(qt.isValid(e))return e;try{return YG(e)}catch{return t}}});var I6=B(Eo=>{f();var Hp=is(),JG=Jv(),w6=Rp(),os=ss(),iE=eE(),E6=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,v6=Hp.getBCHDigit(E6);function XG(r,e,t){for(let i=1;i<=40;i++)if(e<=Eo.getCapacity(i,t,r))return i}function A6(r,e){return os.getCharCountIndicator(r,e)+4}function ZG(r,e){let t=0;return r.forEach(function(i){let n=A6(i.mode,e);t+=n+i.getBitsLength()}),t}function eK(r,e){for(let t=1;t<=40;t++)if(ZG(r,t)<=Eo.getCapacity(t,e,os.MIXED))return t}Eo.from=function(e,t){return iE.isValid(e)?parseInt(e,10):t};Eo.getCapacity=function(e,t,i){if(!iE.isValid(e))throw new Error("Invalid QR Code version");typeof i>"u"&&(i=os.BYTE);let n=Hp.getSymbolTotalCodewords(e),s=JG.getTotalCodewordsCount(e,t),o=(n-s)*8;if(i===os.MIXED)return o;let a=o-A6(i,e);switch(i){case os.NUMERIC:return Math.floor(a/10*3);case os.ALPHANUMERIC:return Math.floor(a/11*2);case os.KANJI:return Math.floor(a/13);case os.BYTE:default:return Math.floor(a/8)}};Eo.getBestVersionForData=function(e,t){let i,n=w6.from(t,w6.M);if(Array.isArray(e)){if(e.length>1)return eK(e,n);if(e.length===0)return 1;i=e[0]}else i=e;return XG(i.mode,i.getLength(),n)};Eo.getEncodedBits=function(e){if(!iE.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Hp.getBCHDigit(t)-v6>=0;)t^=E6<{f();var nE=is(),b6=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,tK=1<<14|1<<12|1<<10|1<<4|1<<1,_6=nE.getBCHDigit(b6);C6.getEncodedBits=function(e,t){let i=e.bit<<3|t,n=i<<10;for(;nE.getBCHDigit(n)-_6>=0;)n^=b6<{f();var rK=ss();function Vu(r){this.mode=rK.NUMERIC,this.data=r.toString()}Vu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);let s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};x6.exports=Vu});var D6=B((sse,N6)=>{f();var iK=ss(),sE=["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 Hu(r){this.mode=iK.ALPHANUMERIC,this.data=r}Hu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Hu.prototype.getLength=function(){return this.data.length};Hu.prototype.getBitsLength=function(){return Hu.getBitsLength(this.data.length)};Hu.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=sE.indexOf(this.data[t])*45;i+=sE.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(sE.indexOf(this.data[t]),6)};N6.exports=Hu});var P6=B((ase,O6)=>{"use strict";f();O6.exports=function(e){for(var t=[],i=e.length,n=0;n=55296&&s<=56319&&i>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}});var M6=B((cse,B6)=>{f();var nK=P6(),sK=ss();function Qu(r){this.mode=sK.BYTE,typeof r=="string"&&(r=nK(r)),this.data=new Uint8Array(r)}Qu.getBitsLength=function(e){return e*8};Qu.prototype.getLength=function(){return this.data.length};Qu.prototype.getBitsLength=function(){return Qu.getBitsLength(this.data.length)};Qu.prototype.write=function(r){for(let e=0,t=this.data.length;e{f();var oK=ss(),aK=is();function ju(r){this.mode=oK.KANJI,this.data=r}ju.getBitsLength=function(e){return e*13};ju.prototype.getLength=function(){return this.data.length};ju.prototype.getBitsLength=function(){return ju.getBitsLength(this.data.length)};ju.prototype.write=function(r){let e;for(e=0;e=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` -Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};R6.exports=ju});var F6=B((dse,oE)=>{"use strict";f();var Dl={single_source_shortest_paths:function(r,e,t){var i={},n={};n[e]=0;var s=Dl.PriorityQueue.make();s.push(e,0);for(var o,a,u,h,p,w,N,O,T;!s.empty();){o=s.pop(),a=o.value,h=o.cost,p=r[a]||{};for(u in p)p.hasOwnProperty(u)&&(w=p[u],N=h+w,O=n[u],T=typeof n[u]>"u",(T||O>N)&&(n[u]=N,s.push(u,N),i[u]=a))}if(typeof t<"u"&&typeof n[t]>"u"){var V=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(V)}return i},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],i=e,n;i;)t.push(i),n=r[i],i=r[i];return t.reverse(),t},find_path:function(r,e,t){var i=Dl.single_source_shortest_paths(r,e,t);return Dl.extract_shortest_path_from_predecessor_list(i,t)},PriorityQueue:{make:function(r){var e=Dl.PriorityQueue,t={},i;r=r||{};for(i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof oE<"u"&&(oE.exports=Dl)});var K6=B(Gu=>{f();var Qe=ss(),V6=T6(),H6=D6(),Q6=M6(),j6=L6(),Ol=tE(),Qp=is(),uK=F6();function U6(r){return unescape(encodeURIComponent(r)).length}function Pl(r,e,t){let i=[],n;for(;(n=r.exec(t))!==null;)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function G6(r){let e=Pl(Ol.NUMERIC,Qe.NUMERIC,r),t=Pl(Ol.ALPHANUMERIC,Qe.ALPHANUMERIC,r),i,n;return Qp.isKanjiModeEnabled()?(i=Pl(Ol.BYTE,Qe.BYTE,r),n=Pl(Ol.KANJI,Qe.KANJI,r)):(i=Pl(Ol.BYTE_KANJI,Qe.BYTE,r),n=[]),e.concat(t,i,n).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function aE(r,e){switch(e){case Qe.NUMERIC:return V6.getBitsLength(r);case Qe.ALPHANUMERIC:return H6.getBitsLength(r);case Qe.KANJI:return j6.getBitsLength(r);case Qe.BYTE:return Q6.getBitsLength(r)}}function cK(r){return r.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function lK(r){let e=[];for(let t=0;t{f();var Gp=is(),uE=Rp(),hK=i6(),dK=s6(),pK=o6(),gK=c6(),fE=l6(),hE=Jv(),yK=g6(),jp=I6(),mK=S6(),wK=ss(),cE=K6();function vK(r,e){let t=r.size,i=gK.getPositions(e);for(let n=0;n=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?r.set(s+a,o+u,!0,!0):r.set(s+a,o+u,!1,!0))}}function EK(r){let e=r.size;for(let t=8;t>a&1)===1,r.set(n,s,o,!0),r.set(s,n,o,!0)}function lE(r,e,t){let i=r.size,n=mK.getEncodedBits(e,t),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?r.set(s,8,o,!0):s<8?r.set(s+1,8,o,!0):r.set(i-15+s,8,o,!0),s<8?r.set(8,i-s-1,o,!0):s<9?r.set(8,15-s-1+1,o,!0):r.set(8,15-s-1,o,!0);r.set(i-8,8,1,!0)}function _K(r,e){let t=r.size,i=-1,n=t-1,s=7,o=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!r.isReserved(n,a-u)){let h=!1;o>>s&1)===1),r.set(n,a-u,h),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function bK(r,e,t){let i=new hK;t.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),wK.getCharCountIndicator(u.mode,r)),u.write(i)});let n=Gp.getSymbolTotalCodewords(r),s=hE.getTotalCodewordsCount(r,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);let a=(o-i.getLengthInBits())/8;for(let u=0;u"u")throw new Error("Missing sender public key for type 1 envelope");let t=typeof r.senderPublicKey<"u"?nt.fromString(r.senderPublicKey,dr):void 0,i=typeof r.iv<"u"?nt.fromString(r.iv,dr):H2.randomBytes(Jw),n=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)).seal(i,nt.fromString(r.message,md));return Z2({type:e,sealed:n,iv:i,senderPublicKey:t})}function xq(r){let e=new V2.ChaCha20Poly1305(nt.fromString(r.symKey,dr)),{sealed:t,iv:i}=s1(r.encoded),n=e.open(i,t);if(n===null)throw new Error("Failed to decrypt");return nt.toString(n,md)}function Z2(r){if(Wc(r.type)===fu){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return nt.toString(nt.concat([r.type,r.senderPublicKey,r.iv,r.sealed]),dd)}return nt.toString(nt.concat([r.type,r.iv,r.sealed]),dd)}function s1(r){let e=nt.fromString(r,dd),t=e.slice(Eq,M2),i=M2;if(Wc(t)===fu){let a=i+n1,u=a+Jw,h=e.slice(i,a),p=e.slice(a,u),w=e.slice(u);return{type:t,sealed:w,iv:p,senderPublicKey:h}}let n=i+Jw,s=e.slice(i,n),o=e.slice(n);return{type:t,sealed:o,iv:s}}function Tq(r,e){let t=s1(r);return eT({type:Wc(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?nt.toString(t.senderPublicKey,dr):void 0,receiverPublicKey:e?.receiverPublicKey})}function eT(r){let e=r?.type||i1;if(e===fu){if(typeof r?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof r?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:r?.senderPublicKey,receiverPublicKey:r?.receiverPublicKey}}function Nq(r){return r.type===fu&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}var Dq=Object.defineProperty,R2=Object.getOwnPropertySymbols,Oq=Object.prototype.hasOwnProperty,Pq=Object.prototype.propertyIsEnumerable,L2=(r,e,t)=>e in r?Dq(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,F2=(r,e)=>{for(var t in e||(e={}))Oq.call(e,t)&&L2(r,t,e[t]);if(R2)for(var t of R2(e))Pq.call(e,t)&&L2(r,t,e[t]);return r},tT="ReactNative",lu={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},pd=" ",Bq=":",rT="/",o1=2,Mq=1e3,iT="js";function a1(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}function nT(){return!zc.getDocument()&&!!zc.getNavigator()&&navigator.product===tT}function sT(){return!a1()&&!!zc.getNavigator()}function u1(){return nT()?lu.reactNative:a1()?lu.node:sT()?lu.browser:lu.unknown}function oT(r,e){let t=hd.parse(r);return t=F2(F2({},t),e),r=hd.stringify(t),r}function Rq(){return lq.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Lq(r,e){var t;let i=u1(),n={protocol:r,version:e,env:i};return i==="browser"&&(n.host=((t=zc.getLocation())==null?void 0:t.host)||"unknown"),n}function aT(){let r=cq.detect();if(r===null)return"unknown";let e=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[e,r.name,r.version].join("-"):[e,r.version].join("-")}function uT(){var r;let e=u1();return e===lu.browser?[e,((r=zc.getLocation())==null?void 0:r.host)||"unknown"].join(":"):e}function cT(r,e,t){let i=aT(),n=uT();return[[r,e].join("-"),[iT,t].join("-"),i,n].join("/")}function Fq({protocol:r,version:e,relayUrl:t,sdkVersion:i,auth:n,projectId:s}){let o=t.split("?"),a=cT(r,e,i),u={auth:n,ua:a,projectId:s},h=oT(o[1]||"",u);return o[0]+"?"+h}function Uq(r){let e=(r.match(/^[^:]+(?=:\/\/)/gi)||[])[0],t=typeof e<"u"?r.split("://")[1]:r;return e=e==="wss"?"https":"http",[e,t].join("://")}function qq(r,e,t){if(!r[e]||typeof r[e]!==t)throw new Error(`Missing or invalid "${e}" param`)}function lT(r,e=o1){return fT(r.split(rT),e)}function Vq(r){return lT(r).join(pd)}function an(r,e){return r.filter(t=>e.includes(t)).length===r.length}function fT(r,e=o1){return r.slice(Math.max(r.length-e,0))}function Hq(r){return Object.fromEntries(r.entries())}function Qq(r){return new Map(Object.entries(r))}function jq(r,e){let t={};return Object.keys(r).forEach(i=>{t[i]=e(r[i])}),t}var Gq=r=>r;function hT(r){return r.trim().replace(/^\w/,e=>e.toUpperCase())}function Kq(r){return r.split(pd).map(e=>hT(e)).join(pd)}function zq(r){let e=Kc.toMiliseconds(r||Kc.FIVE_MINUTES),t,i,n;return{resolve:s=>{n&&t&&(clearTimeout(n),t(s))},reject:s=>{n&&i&&(clearTimeout(n),i(s))},done:()=>new Promise((s,o)=>{n=setTimeout(o,e),t=s,i=o})}}function kq(r,e){return new Promise(async(t,i)=>{let n=setTimeout(()=>i(),e),s=await r;clearTimeout(n),t(s)})}function c1(r,e){if(typeof e=="string"&&e.startsWith(`${r}:`))return e;if(r.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(r.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: ${r}`)}function Wq(r){return c1("topic",r)}function $q(r){return c1("id",r)}function Yq(r){let[e,t]=r.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function Jq(r,e){return Kc.fromMiliseconds((e||Date.now())+Kc.toMiliseconds(r))}function Xq(r){return Date.now()>=Kc.toMiliseconds(r)}function Zq(r,e){return`${r}${e?`:${e}`:""}`}var dT="irn";function eV(r){return r?.relay||{protocol:dT}}function tV(r){let e=hq.RELAY_JSONRPC[r];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${r}`);return e}var rV=Object.defineProperty,U2=Object.getOwnPropertySymbols,iV=Object.prototype.hasOwnProperty,nV=Object.prototype.propertyIsEnumerable,q2=(r,e,t)=>e in r?rV(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,sV=(r,e)=>{for(var t in e||(e={}))iV.call(e,t)&&q2(r,t,e[t]);if(U2)for(var t of U2(e))nV.call(e,t)&&q2(r,t,e[t]);return r};function pT(r,e="-"){let t={},i="relay"+e;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){let s=n.replace(i,""),o=r[n];t[s]=o}}),t}function oV(r){let e=r.indexOf(":"),t=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,e),n=r.substring(e+1,t).split("@"),s=typeof t<"u"?r.substring(t):"",o=hd.parse(s);return{protocol:i,topic:n[0],version:parseInt(n[1],10),symKey:o.symKey,relay:pT(o)}}function gT(r,e="-"){let t="relay",i={};return Object.keys(r).forEach(n=>{let s=t+e+n;r[n]&&(i[s]=r[n])}),i}function aV(r){return`${r.protocol}:${r.topic}@${r.version}?`+hd.stringify(sV({symKey:r.symKey},gT(r.relay)))}function hu(r){let e=[];return r.forEach(t=>{let[i,n]=t.split(":");e.push(`${i}:${n}`)}),e}function yT(r){let e=[];return Object.values(r).forEach(t=>{e.push(...hu(t.accounts))}),e}function mT(r,e){let t=[];return Object.values(r).forEach(i=>{hu(i.accounts).includes(e)&&t.push(...i.methods)}),t}function wT(r,e){let t=[];return Object.values(r).forEach(i=>{hu(i.accounts).includes(e)&&t.push(...i.events)}),t}function uV(r,e){let t=CT(r,e);if(t)throw new Error(t.message);let i={};for(let[n,s]of Object.entries(r))i[n]={methods:s.methods,events:s.events,chains:s.accounts.map(o=>`${o.split(":")[0]}:${o.split(":")[1]}`)};return i}var cV={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}},lV={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 Hn(r,e){let{message:t,code:i}=lV[r];return{message:e?`${t} ${e}`:t,code:i}}function io(r,e){let{message:t,code:i}=cV[r];return{message:e?`${t} ${e}`:t,code:i}}function $c(r,e){return Array.isArray(r)?typeof e<"u"&&r.length?r.every(e):!0:!1}function l1(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function Qn(r){return typeof r>"u"}function Sr(r,e){return e&&Qn(r)?!0:typeof r=="string"&&Boolean(r.trim().length)}function wd(r,e){return e&&Qn(r)?!0:typeof r=="number"&&!isNaN(r)}function fV(r,e){let{requiredNamespaces:t}=e,i=Object.keys(r.namespaces),n=Object.keys(t),s=!0;return an(n,i)?(i.forEach(o=>{let{accounts:a,methods:u,events:h}=r.namespaces[o],p=hu(a),w=t[o];(!an(kc(o,w),p)||!an(w.methods,u)||!an(w.events,h))&&(s=!1)}),s):!1}function vd(r){return Sr(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function vT(r){if(Sr(r,!1)&&r.includes(":")){let e=r.split(":");if(e.length===3){let t=e[0]+":"+e[1];return!!e[2]&&vd(t)}}return!1}function hV(r){if(Sr(r,!1))try{return typeof new URL(r)<"u"}catch{return!1}return!1}function dV(r){var e;return(e=r?.proposer)==null?void 0:e.publicKey}function pV(r){return r?.topic}function gV(r,e){let t=null;return Sr(r?.publicKey,!1)||(t=Hn("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function Xw(r){let e=!0;return $c(r)?r.length&&(e=r.every(t=>Sr(t,!1))):e=!1,e}function ET(r,e,t){let i=null;return $c(e)?e.forEach(n=>{i||(!vd(n)||!n.includes(r))&&(i=io("UNSUPPORTED_CHAINS",`${t}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):i=io("UNSUPPORTED_CHAINS",`${t}, chains ${e} should be an array of strings conforming to "namespace:chainId" format`),i}function AT(r,e){let t=null;return Object.entries(r).forEach(([i,n])=>{if(t)return;let s=ET(i,kc(i,n),`${e} requiredNamespace`);s&&(t=s)}),t}function IT(r,e){let t=null;return $c(r)?r.forEach(i=>{t||vT(i)||(t=io("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=io("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function _T(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=IT(i?.accounts,`${e} namespace`);n&&(t=n)}),t}function bT(r,e){let t=null;return Xw(r?.methods)?Xw(r?.events)||(t=io("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=io("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function f1(r,e){let t=null;return Object.values(r).forEach(i=>{if(t)return;let n=bT(i,`${e}, namespace`);n&&(t=n)}),t}function yV(r,e,t){let i=null;if(r&&l1(r)){let n=f1(r,e);n&&(i=n);let s=AT(r,e);s&&(i=s)}else i=Hn("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function CT(r,e){let t=null;if(r&&l1(r)){let i=f1(r,e);i&&(t=i);let n=_T(r,e);n&&(t=n)}else t=Hn("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function ST(r){return Sr(r.protocol,!0)}function mV(r,e){let t=!1;return e&&!r?t=!0:r&&$c(r)&&r.length&&r.forEach(i=>{t=ST(i)}),t}function wV(r){return typeof r=="number"}function vV(r){return typeof r<"u"&&typeof r!==null}function EV(r){return!(!r||typeof r!="object"||!r.code||!wd(r.code,!1)||!r.message||!Sr(r.message,!1))}function AV(r){return!(Qn(r)||!Sr(r.method,!1))}function IV(r){return!(Qn(r)||Qn(r.result)&&Qn(r.error)||!wd(r.id,!1)||!Sr(r.jsonrpc,!1))}function _V(r){return!(Qn(r)||!Sr(r.name,!1))}function bV(r,e){return!(!vd(e)||!yT(r).includes(e))}function CV(r,e,t){return Sr(t,!1)?mT(r,e).includes(t):!1}function SV(r,e,t){return Sr(t,!1)?wT(r,e).includes(t):!1}function xV(r,e,t,i){let n=null,s=Object.keys(r),o=Object.keys(e);return an(s,o)?s.forEach(a=>{if(n)return;let u=hu(e[a].accounts);an(kc(a,r[a]),u)?an(r[a].methods,e[a].methods)?an(r[a].events,e[a].events)||(n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${a}`)):n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${a}`):n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace chains for ${a}`)}):n=Hn("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy ${i}`),n}function TV(r,e){return wd(r,!1)&&r<=e.max&&r>=e.min}re.BASE10=r1,re.BASE16=dr,re.BASE64=dd,re.COLON=Bq,re.DEFAULT_DEPTH=o1,re.EMPTY_SPACE=pd,re.ENV_MAP=lu,re.ONE_THOUSAND=Mq,re.REACT_NATIVE_PRODUCT=tT,re.RELAYER_DEFAULT_PROTOCOL=dT,re.SDK_TYPE=iT,re.SLASH=rT,re.TYPE_0=i1,re.TYPE_1=fu,re.UTF8=md,re.appendToQueryString=oT,re.assertType=qq,re.calcExpiry=Jq,re.capitalize=Kq,re.capitalizeWord=hT,re.createDelayedPromise=zq,re.createExpiringPromise=kq,re.decodeTypeByte=Wc,re.decrypt=xq,re.deriveSymKey=_q,re.deserialize=s1,re.encodeTypeByte=X2,re.encrypt=Sq,re.engineEvent=Zq,re.enumify=Gq,re.formatAccountId=z2,re.formatAccountWithChain=dq,re.formatChainId=K2,re.formatExpirerTarget=c1,re.formatIdTarget=$q,re.formatMessage=vq,re.formatMessageContext=Vq,re.formatRelayParams=gT,re.formatRelayRpcUrl=Fq,re.formatTopicTarget=Wq,re.formatUA=cT,re.formatUri=aV,re.generateKeyPair=Aq,re.generateRandomBytes32=Iq,re.getAccountsChains=hu,re.getAccountsFromNamespaces=gq,re.getAddressFromAccount=k2,re.getAddressesFromAccounts=pq,re.getAppMetadata=Rq,re.getChainFromAccount=W2,re.getChainsFromAccounts=$2,re.getChainsFromNamespace=kc,re.getChainsFromNamespaces=yq,re.getChainsFromRequiredNamespaces=mq,re.getDidAddress=J2,re.getDidAddressSegments=yd,re.getDidChainId=Y2,re.getEnvironment=u1,re.getHttpUrl=Uq,re.getInternalError=Hn,re.getJavascriptID=uT,re.getJavascriptOS=aT,re.getLastItems=fT,re.getNamespacedDidChainId=wq,re.getNamespacesChains=yT,re.getNamespacesEventsForChainId=wT,re.getNamespacesMethodsForChainId=mT,re.getRelayClientMetadata=Lq,re.getRelayProtocolApi=tV,re.getRelayProtocolName=eV,re.getRequiredNamespacesFromNamespaces=uV,re.getSdkError=io,re.getUniqueValues=t1,re.hasOverlap=an,re.hashKey=bq,re.hashMessage=Cq,re.isBrowser=sT,re.isConformingNamespaces=xV,re.isExpired=Xq,re.isNode=a1,re.isProposalStruct=dV,re.isReactNative=nT,re.isSessionCompatible=fV,re.isSessionStruct=pV,re.isTypeOneEnvelope=Nq,re.isUndefined=Qn,re.isValidAccountId=vT,re.isValidAccounts=IT,re.isValidActions=bT,re.isValidArray=$c,re.isValidChainId=vd,re.isValidChains=ET,re.isValidController=gV,re.isValidErrorReason=EV,re.isValidEvent=_V,re.isValidId=wV,re.isValidNamespaceAccounts=_T,re.isValidNamespaceActions=f1,re.isValidNamespaceChains=AT,re.isValidNamespaceMethodsOrEvents=Xw,re.isValidNamespaces=CT,re.isValidNamespacesChainId=bV,re.isValidNamespacesEvent=SV,re.isValidNamespacesRequest=CV,re.isValidNumber=wd,re.isValidObject=l1,re.isValidParams=vV,re.isValidRelay=ST,re.isValidRelays=mV,re.isValidRequest=AV,re.isValidRequestExpiry=TV,re.isValidRequiredNamespaces=yV,re.isValidResponse=IV,re.isValidString=Sr,re.isValidUrl=hV,re.mapEntries=jq,re.mapToObj=Hq,re.objToMap=Qq,re.parseAccountId=e1,re.parseChainId=G2,re.parseContextNames=lT,re.parseExpirerTarget=Yq,re.parseRelayParams=pT,re.parseUri=oV,re.serialize=Z2,re.validateDecoding=Tq,re.validateEncoding=eT});var xT,TT,NT,DT,Ad,Yc,h1,Id,jn,Jc,_d=me(()=>{f();xT="PARSE_ERROR",TT="INVALID_REQUEST",NT="METHOD_NOT_FOUND",DT="INVALID_PARAMS",Ad="INTERNAL_ERROR",Yc="SERVER_ERROR",h1=[-32700,-32600,-32601,-32602,-32603],Id=[-32e3,-32099],jn={[xT]:{code:-32700,message:"Parse error"},[TT]:{code:-32600,message:"Invalid Request"},[NT]:{code:-32601,message:"Method not found"},[DT]:{code:-32602,message:"Invalid params"},[Ad]:{code:-32603,message:"Internal error"},[Yc]:{code:-32e3,message:"Server error"}},Jc=Yc});function NV(r){return r<=Id[0]&&r>=Id[1]}function bd(r){return h1.includes(r)}function OT(r){return typeof r=="number"}function Cd(r){return Object.keys(jn).includes(r)?jn[r]:jn[Jc]}function Sd(r){let e=Object.values(jn).find(t=>t.code===r);return e||jn[Jc]}function DV(r){if(typeof r.error.code>"u")return{valid:!1,error:"Missing code for JSON-RPC error"};if(typeof r.error.message>"u")return{valid:!1,error:"Missing message for JSON-RPC error"};if(!OT(r.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${r.error.code}`};if(bd(r.error.code)){let e=Sd(r.error.code);if(e.message!==jn[Jc].message&&r.error.message===e.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${r.error.code}`}}return{valid:!0}}function d1(r,e,t){return r.message.includes("getaddrinfo ENOTFOUND")||r.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):r}var p1=me(()=>{f();_d()});var BT=B(Gn=>{"use strict";f();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.isBrowserCryptoAvailable=Gn.getSubtleCrypto=Gn.getBrowerCrypto=void 0;function g1(){return(global===null||global===void 0?void 0:global.crypto)||(global===null||global===void 0?void 0:global.msCrypto)||{}}Gn.getBrowerCrypto=g1;function PT(){let r=g1();return r.subtle||r.webkitSubtle}Gn.getSubtleCrypto=PT;function OV(){return!!g1()&&!!PT()}Gn.isBrowserCryptoAvailable=OV});var LT=B(Kn=>{"use strict";f();Object.defineProperty(Kn,"__esModule",{value:!0});Kn.isBrowser=Kn.isNode=Kn.isReactNative=void 0;function MT(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Kn.isReactNative=MT;function RT(){return typeof _.default<"u"&&typeof _.default.versions<"u"&&typeof _.default.versions.node<"u"}Kn.isNode=RT;function PV(){return!MT()&&!RT()}Kn.isBrowser=PV});var y1=B(xd=>{"use strict";f();Object.defineProperty(xd,"__esModule",{value:!0});var FT=(br(),at(_r));FT.__exportStar(BT(),xd);FT.__exportStar(LT(),xd)});var $t={};ot($t,{isNodeJs:()=>qT});var UT,qT,VT=me(()=>{f();UT=_e(y1());er($t,_e(y1()));qT=UT.isNode});function HT(){let r=Date.now()*Math.pow(10,3),e=Math.floor(Math.random()*Math.pow(10,3));return r+e}function m1(r,e,t){return{id:t||HT(),jsonrpc:"2.0",method:r,params:e}}function BV(r,e){return{id:r,jsonrpc:"2.0",result:e}}function w1(r,e,t){return{id:r,jsonrpc:"2.0",error:QT(e,t)}}function QT(r,e){return typeof r>"u"?Cd(Ad):(typeof r=="string"&&(r=Object.assign(Object.assign({},Cd(Yc)),{message:r})),typeof e<"u"&&(r.data=e),bd(r.code)&&(r=Sd(r.code)),r)}var jT=me(()=>{f();p1();_d()});function MV(r){return r.includes("*")?Nd(r):!/\W/g.test(r)}function Td(r){return r==="*"}function Nd(r){return Td(r)?!0:!(!r.includes("*")||r.split("*").length!==2||r.split("*").filter(e=>e.trim()==="").length!==1)}function RV(r){return!Td(r)&&Nd(r)&&!r.split("*")[0].trim()}function LV(r){return!Td(r)&&Nd(r)&&!r.split("*")[1].trim()}var GT=me(()=>{f()});var KT=me(()=>{f()});var du,v1=me(()=>{f();du=class{}});var E1,Dd,Xc,zT=me(()=>{f();v1();E1=class extends du{constructor(e){super()}},Dd=class extends du{constructor(){super()}},Xc=class extends Dd{constructor(e){super()}}});var kT=me(()=>{f()});var WT=me(()=>{f();KT();v1();zT();kT()});var $T=me(()=>{f();WT()});function qV(r){let e=r.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function YT(r,e){let t=qV(r);return typeof t>"u"?!1:new RegExp(e).test(t)}function VV(r){return YT(r,FV)}function Od(r){return YT(r,UV)}function A1(r){return new RegExp("wss?://localhost(:d{2,5})?").test(r)}var FV,UV,JT=me(()=>{f();FV="^https?:",UV="^wss?:"});function I1(r){return typeof r=="object"&&"id"in r&&"jsonrpc"in r&&r.jsonrpc==="2.0"}function HV(r){return I1(r)&&"method"in r}function _1(r){return I1(r)&&(XT(r)||Pd(r))}function XT(r){return"result"in r}function Pd(r){return"error"in r}function QV(r){return"error"in r&&r.valid===!1}var ZT=me(()=>{f()});var lr={};ot(lr,{DEFAULT_ERROR:()=>Jc,IBaseJsonRpcProvider:()=>Dd,IEvents:()=>du,IJsonRpcConnection:()=>E1,IJsonRpcProvider:()=>Xc,INTERNAL_ERROR:()=>Ad,INVALID_PARAMS:()=>DT,INVALID_REQUEST:()=>TT,METHOD_NOT_FOUND:()=>NT,PARSE_ERROR:()=>xT,RESERVED_ERROR_CODES:()=>h1,SERVER_ERROR:()=>Yc,SERVER_ERROR_CODE_RANGE:()=>Id,STANDARD_ERROR_MAP:()=>jn,formatErrorMessage:()=>QT,formatJsonRpcError:()=>w1,formatJsonRpcRequest:()=>m1,formatJsonRpcResult:()=>BV,getError:()=>Cd,getErrorByCode:()=>Sd,isHttpUrl:()=>VV,isJsonRpcError:()=>Pd,isJsonRpcPayload:()=>I1,isJsonRpcRequest:()=>HV,isJsonRpcResponse:()=>_1,isJsonRpcResult:()=>XT,isJsonRpcValidationInvalid:()=>QV,isLocalhostUrl:()=>A1,isNodeJs:()=>qT,isReservedErrorCode:()=>bd,isServerErrorCode:()=>NV,isValidDefaultRoute:()=>Td,isValidErrorCode:()=>OT,isValidLeadingWildcardRoute:()=>RV,isValidRoute:()=>MV,isValidTrailingWildcardRoute:()=>LV,isValidWildcardRoute:()=>Nd,isWsUrl:()=>Od,parseConnectionError:()=>d1,payloadId:()=>HT,validateJsonRpcError:()=>DV});var Zc=me(()=>{f();_d();p1();VT();er(lr,$t);jT();GT();$T();JT();ZT()});var eN,Bd,tN,b1=me(()=>{f();eN=_e($s());Zc();Bd=class extends Xc{constructor(e){super(e),this.events=new eN.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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(m1(e.method,e.params||[]),t)}async requestStrict(e,t){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Pd(s)?n(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),_1(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}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",()=>this.events.emit("disconnect")),this.connection.on("error",e=>this.events.emit("error",e)),this.hasRegisteredEventListeners=!0)}},tN=Bd});var rN={};ot(rN,{JsonRpcProvider:()=>Bd,default:()=>jV});var jV,iN=me(()=>{f();b1();b1();jV=tN});var sN=B((Gte,nN)=>{"use strict";f();nN.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var aN,oN,GV,KV,zV,Md,uN,C1=me(()=>{f();aN=_e($s());xh();Zc();oN=10,GV=()=>typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:sN(),KV=()=>typeof window<"u",zV=GV(),Md=class{constructor(e){if(this.url=e,this.events=new aN.EventEmitter,this.registering=!1,!Od(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,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=()=>{this.onClose(),e()},this.socket.close()})}async send(e,t){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(xc(e))}catch(i){this.onError(e.id,i)}}register(e=this.url){if(!Od(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{let n=(0,lr.isReactNative)()?void 0:{rejectUnauthorized:!A1(e)},s=new zV(e,[],n);KV()?s.onerror=o=>{let a=o;i(this.emitError(a.error))}:s.on("error",o=>{i(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=()=>this.onClose(),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(){this.socket=void 0,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t=typeof e.data=="string"?Sc(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let i=this.parseError(t),n=i.message||i.toString(),s=w1(e,n);this.events.emit("payload",s)}parseError(e,t=this.url){return d1(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>oN&&this.events.setMaxListeners(oN)}emitError(e){let t=this.parseError(new Error(e?.message||`WebSocket connection failed for URL: ${this.url}`));return this.events.emit("register_error",t),t}},uN=Md});var cN={};ot(cN,{WsConnection:()=>Md,default:()=>kV});var kV,lN=me(()=>{f();C1();C1();kV=uN});var KN=B((el,gu)=>{f();var WV=200,L1="__lodash_hash_undefined__",Qd=1,IN=2,_N=9007199254740991,Rd="[object Arguments]",N1="[object Array]",$V="[object AsyncFunction]",bN="[object Boolean]",CN="[object Date]",SN="[object Error]",xN="[object Function]",YV="[object GeneratorFunction]",Ld="[object Map]",TN="[object Number]",JV="[object Null]",pu="[object Object]",fN="[object Promise]",XV="[object Proxy]",NN="[object RegExp]",Fd="[object Set]",DN="[object String]",ZV="[object Symbol]",e7="[object Undefined]",D1="[object WeakMap]",ON="[object ArrayBuffer]",Ud="[object DataView]",t7="[object Float32Array]",r7="[object Float64Array]",i7="[object Int8Array]",n7="[object Int16Array]",s7="[object Int32Array]",o7="[object Uint8Array]",a7="[object Uint8ClampedArray]",u7="[object Uint16Array]",c7="[object Uint32Array]",l7=/[\\^$.*+?()[\]{}|]/g,f7=/^\[object .+?Constructor\]$/,h7=/^(?:0|[1-9]\d*)$/,Xe={};Xe[t7]=Xe[r7]=Xe[i7]=Xe[n7]=Xe[s7]=Xe[o7]=Xe[a7]=Xe[u7]=Xe[c7]=!0;Xe[Rd]=Xe[N1]=Xe[ON]=Xe[bN]=Xe[Ud]=Xe[CN]=Xe[SN]=Xe[xN]=Xe[Ld]=Xe[TN]=Xe[pu]=Xe[NN]=Xe[Fd]=Xe[DN]=Xe[D1]=!1;var PN=typeof global=="object"&&global&&global.Object===Object&&global,d7=typeof self=="object"&&self&&self.Object===Object&&self,un=PN||d7||Function("return this")(),BN=typeof el=="object"&&el&&!el.nodeType&&el,hN=BN&&typeof gu=="object"&&gu&&!gu.nodeType&&gu,MN=hN&&hN.exports===BN,S1=MN&&PN.process,dN=function(){try{return S1&&S1.binding&&S1.binding("util")}catch{}}(),pN=dN&&dN.isTypedArray;function p7(r,e){for(var t=-1,i=r==null?0:r.length,n=0,s=[];++t-1}function G7(r,e){var t=this.__data__,i=Gd(t,r);return i<0?(++this.size,t.push([r,e])):t[i][1]=e,this}cn.prototype.clear=V7;cn.prototype.delete=H7;cn.prototype.get=Q7;cn.prototype.has=j7;cn.prototype.set=G7;function oo(r){var e=-1,t=r==null?0:r.length;for(this.clear();++ea))return!1;var h=s.get(r);if(h&&s.get(e))return h==e;var p=-1,w=!0,N=t&IN?new Vd:void 0;for(s.set(r,e),s.set(e,r);++p-1&&r%1==0&&r-1&&r%1==0&&r<=_N}function jN(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function il(r){return r!=null&&typeof r=="object"}var GN=pN?w7(pN):aH;function AH(r){return vH(r)?iH(r):uH(r)}function IH(){return[]}function _H(){return!1}gu.exports=EH});var z3=B(Ee=>{"use strict";f();Object.defineProperty(Ee,"__esModule",{value:!0});var uo=$s(),bH=lh(),CH=TC(),ip=GC(),st=bm(),Wn=Hm(),zN=(xh(),at(JC)),SH=(Ax(),at(Ex)),fe=Ed(),Ht=Ys(),xH=(iN(),at(rN)),ti=(Zc(),at(lr)),TH=(lN(),at(cN)),NH=KN();function ol(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}function DH(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(t){if(t!=="default"){var i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return r[t]}})}}),e.default=r,Object.freeze(e)}var OH=ol(uo),c3=ol(bH),PH=ol(CH),zd=DH(SH),BH=ol(TH),MH=ol(NH);function RH(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i>>0,j=new Uint8Array(Y);$!==se;){for(var W=T[$],k=0,R=Y-1;(W!==0||k>>0,j[R]=W%a>>>0,W=W/a>>>0;if(W!==0)throw new Error("Non-zero carry");z=k,$++}for(var F=Y-z;F!==Y&&j[F]===0;)F++;for(var G=u.repeat(V);F>>0,Y=new Uint8Array(se);T[V];){var j=t[T.charCodeAt(V)];if(j===255)return;for(var W=0,k=se-1;(j!==0||W<$)&&k!==-1;k--,W++)j+=a*Y[k]>>>0,Y[k]=j%256>>>0,j=j/256>>>0;if(j!==0)throw new Error("Non-zero carry");$=W,V++}if(T[V]!==" "){for(var R=se-$;R!==se&&Y[R]===0;)R++;for(var F=new Uint8Array(z+(se-R)),G=z;R!==se;)F[G++]=Y[R++];return F}}}function O(T){var V=N(T);if(V)return V;throw new Error(`Non-${e} character`)}return{encode:w,decodeUnsafe:N,decode:O}}var LH=RH,FH=LH,l3=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},UH=r=>new TextEncoder().encode(r),qH=r=>new TextDecoder().decode(r),q1=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},V1=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}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 f3(this,e)}},H1=class{constructor(e){this.decoders=e}or(e){return f3(this,e)}decode(e){let t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},f3=(r,e)=>new H1({...r.decoders||{[r.prefix]:r},...e.decoders||{[e.prefix]:e}}),Q1=class{constructor(e,t,i,n){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=n,this.encoder=new q1(e,t,i),this.decoder=new V1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},np=({name:r,prefix:e,encode:t,decode:i})=>new Q1(r,e,t,i),al=({prefix:r,name:e,alphabet:t})=>{let{encode:i,decode:n}=FH(t,e);return np({prefix:r,name:e,encode:i,decode:s=>l3(n(s))})},VH=(r,e,t,i)=>{let n={};for(let p=0;p=8&&(a-=8,o[h++]=255&u>>a)}if(a>=t||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return o},HH=(r,e,t)=>{let i=e[e.length-1]==="=",n=(1<t;)o-=t,s+=e[n&a>>o];if(o&&(s+=e[n&a<np({prefix:e,name:r,encode(n){return HH(n,i,t)},decode(n){return VH(n,i,t,r)}}),QH=np({prefix:"\0",name:"identity",encode:r=>qH(r),decode:r=>UH(r)}),jH=Object.freeze({__proto__:null,identity:QH}),GH=tr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),KH=Object.freeze({__proto__:null,base2:GH}),zH=tr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),kH=Object.freeze({__proto__:null,base8:zH}),WH=al({prefix:"9",name:"base10",alphabet:"0123456789"}),$H=Object.freeze({__proto__:null,base10:WH}),YH=tr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),JH=tr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),XH=Object.freeze({__proto__:null,base16:YH,base16upper:JH}),ZH=tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eQ=tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),tQ=tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rQ=tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iQ=tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nQ=tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sQ=tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oQ=tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),aQ=tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),uQ=Object.freeze({__proto__:null,base32:ZH,base32upper:eQ,base32pad:tQ,base32padupper:rQ,base32hex:iQ,base32hexupper:nQ,base32hexpad:sQ,base32hexpadupper:oQ,base32z:aQ}),cQ=al({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),lQ=al({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),fQ=Object.freeze({__proto__:null,base36:cQ,base36upper:lQ}),hQ=al({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dQ=al({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),pQ=Object.freeze({__proto__:null,base58btc:hQ,base58flickr:dQ}),gQ=tr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),yQ=tr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mQ=tr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wQ=tr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),vQ=Object.freeze({__proto__:null,base64:gQ,base64pad:yQ,base64url:mQ,base64urlpad:wQ}),h3=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}"),EQ=h3.reduce((r,e,t)=>(r[t]=e,r),[]),AQ=h3.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function IQ(r){return r.reduce((e,t)=>(e+=EQ[t],e),"")}function _Q(r){let e=[];for(let t of r){let i=AQ[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var bQ=np({prefix:"\u{1F680}",name:"base256emoji",encode:IQ,decode:_Q}),CQ=Object.freeze({__proto__:null,base256emoji:bQ}),SQ=d3,kN=128,xQ=127,TQ=~xQ,NQ=Math.pow(2,31);function d3(r,e,t){e=e||[],t=t||0;for(var i=t;r>=NQ;)e[t++]=r&255|kN,r/=128;for(;r&TQ;)e[t++]=r&255|kN,r>>>=7;return e[t]=r|0,d3.bytes=t-i+1,e}var DQ=j1,OQ=128,WN=127;function j1(r,i){var t=0,i=i||0,n=0,s=i,o,a=r.length;do{if(s>=a)throw j1.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=n<28?(o&WN)<=OQ);return j1.bytes=s-i,t}var PQ=Math.pow(2,7),BQ=Math.pow(2,14),MQ=Math.pow(2,21),RQ=Math.pow(2,28),LQ=Math.pow(2,35),FQ=Math.pow(2,42),UQ=Math.pow(2,49),qQ=Math.pow(2,56),VQ=Math.pow(2,63),HQ=function(r){return r(p3.encode(r,e,t),e),YN=r=>p3.encodingLength(r),G1=(r,e)=>{let t=e.byteLength,i=YN(r),n=i+YN(t),s=new Uint8Array(n+t);return $N(r,s,0),$N(t,s,i),s.set(e,n),new K1(r,t,e,s)},K1=class{constructor(e,t,i,n){this.code=e,this.size=t,this.digest=i,this.bytes=n}},g3=({name:r,code:e,encode:t})=>new z1(r,e,t),z1=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?G1(this.code,t):t.then(i=>G1(this.code,i))}else throw Error("Unknown type, must be binary type")}},y3=r=>async e=>new Uint8Array(await crypto.subtle.digest(r,e)),jQ=g3({name:"sha2-256",code:18,encode:y3("SHA-256")}),GQ=g3({name:"sha2-512",code:19,encode:y3("SHA-512")}),KQ=Object.freeze({__proto__:null,sha256:jQ,sha512:GQ}),m3=0,zQ="identity",w3=l3,kQ=r=>G1(m3,w3(r)),WQ={code:m3,name:zQ,encode:w3,digest:kQ},$Q=Object.freeze({__proto__:null,identity:WQ});new TextEncoder,new TextDecoder;var JN={...jH,...KH,...kH,...$H,...XH,...uQ,...fQ,...pQ,...vQ,...CQ};({...KQ,...$Q});function YQ(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function v3(r,e,t,i){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:i}}}var XN=v3("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),F1=v3("ascii","a",r=>{let e="a";for(let t=0;t{r=r.substring(1);let e=YQ(r.length);for(let t=0;t{if(!this.initialized){let i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();let n=this.keychain.get(i);if(typeof n>"u"){let{message:s}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$d=class{constructor(e,t,i){this.core=e,this.logger=t,this.name=_3,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();let n=await this.getClientSeed(),s=zd.generateKeyPair(n);return zd.encodeIss(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();let n=fe.generateKeyPair();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();let s=await this.getClientSeed(),o=zd.generateKeyPair(s),a=fe.generateRandomBytes32(),u=b3;return await zd.signJWT(a,n,u,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();let a=this.getPrivateKey(n),u=fe.deriveSymKey(a,s);return this.setSymKey(u,o)},this.setSymKey=async(n,s)=>{this.isInitialized();let o=s||fe.hashKey(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();let a=fe.validateEncoding(o),u=zN.safeJsonStringify(s);if(fe.isTypeOneEnvelope(a)){let N=a.senderPublicKey,O=a.receiverPublicKey;n=await this.generateSharedKey(N,O)}let h=this.getSymKey(n),{type:p,senderPublicKey:w}=a;return fe.encrypt({type:p,symKey:h,message:u,senderPublicKey:w})},this.decode=async(n,s,o)=>{this.isInitialized();let a=fe.validateDecoding(s,o);if(fe.isTypeOneEnvelope(a)){let p=a.receiverPublicKey,w=a.senderPublicKey;n=await this.generateSharedKey(p,w)}let u=this.getSymKey(n),h=fe.decrypt({symKey:u,encoded:s});return zN.safeJsonParse(h)},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.keychain=i||new Wd(this.core,this.logger)}get context(){return st.getLoggerContext(this.logger)}getPayloadType(e){let t=fe.deserialize(e);return fe.decodeTypeByte(t.type)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(k1)}catch{e=fe.generateRandomBytes32(),await this.keychain.set(k1,e)}return XQ(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},Yd=class extends Wn.IMessageTracker{constructor(e,t){super(e,t),this.logger=e,this.core=t,this.messages=new Map,this.name=x3,this.version=T3,this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();let s=fe.hashMessage(n),o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();let s=this.get(i),o=fe.hashMessage(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=st.generateChildLogger(e,this.name),this.core=t}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fe.mapToObj(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?fe.objToMap(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},$1=class extends Wn.IPublisher{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.events=new uo.EventEmitter,this.name=D3,this.queue=new Map,this.publishTimeout=1e4,this.publish=async(i,n,s)=>{this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});try{let o=s?.ttl||N3,a=fe.getRelayProtocolName(s),u=s?.prompt||!1,h=s?.tag||0,p={topic:i,message:n,opts:{ttl:o,relay:a,prompt:u,tag:h}},w=fe.hashMessage(n);this.queue.set(w,p);try{await await fe.createExpiringPromise(this.rpcPublish(i,n,o,a,u,h),this.publishTimeout),this.relayer.events.emit(fr.publish,p)}catch{this.logger.debug("Publishing Payload stalled"),this.relayer.events.emit(fr.connection_stalled);return}this.onPublish(w,p),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}})}catch(o){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(o),o}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.registerEventListeners()}get context(){return st.getLoggerContext(this.logger)}rpcPublish(e,t,i,n,s,o){var a,u,h,p;let w={method:fe.getRelayProtocolApi(n.protocol).publish,params:{topic:e,message:t,ttl:i,prompt:s,tag:o}};return fe.isUndefined((a=w.params)==null?void 0:a.prompt)&&((u=w.params)==null||delete u.prompt),fe.isUndefined((h=w.params)==null?void 0:h.tag)&&((p=w.params)==null||delete p.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:w}),this.relayer.provider.request(w)}onPublish(e,t){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{let{topic:t,message:i,opts:n}=e;await this.publish(t,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkQueue()})}},Y1=class{constructor(){this.map=new Map,this.set=(e,t)=>{let i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])},this.get=e=>this.map.get(e)||[],this.exists=(e,t)=>this.get(e).includes(t),this.delete=(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let i=this.get(e);if(!this.exists(e,t))return;let n=i.filter(s=>s!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}},i9=Object.defineProperty,n9=Object.defineProperties,s9=Object.getOwnPropertyDescriptors,ZN=Object.getOwnPropertySymbols,o9=Object.prototype.hasOwnProperty,a9=Object.prototype.propertyIsEnumerable,e3=(r,e,t)=>e in r?i9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,kd=(r,e)=>{for(var t in e||(e={}))o9.call(e,t)&&e3(r,t,e[t]);if(ZN)for(var t of ZN(e))a9.call(e,t)&&e3(r,t,e[t]);return r},U1=(r,e)=>n9(r,s9(e)),Jd=class extends Wn.ISubscriber{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,this.subscriptions=new Map,this.topicMap=new Y1,this.events=new uo.EventEmitter,this.name=F3,this.version=U3,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ln,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restart(),this.registerEventListeners(),this.onEnable(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{let s=fe.getRelayProtocolName(n),o={topic:i,relay:s};this.pending.set(i,o);let a=await this.rpcSubscribe(i,s);return this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}}),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof n?.id<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>this.topics.includes(i)?!0:await new Promise((n,s)=>{let o=new Ht.Watch;o.start(this.pendingSubscriptionWatchLabel);let a=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),n(!0)),o.elapsed(this.pendingSubscriptionWatchLabel)>=q3&&(clearInterval(a),o.stop(this.pendingSubscriptionWatchLabel),s(!1))},this.pollingInterval)}),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=st.generateChildLogger(t,this.name),this.clientId=""}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear(),this.initialized=!1}async unsubscribeByTopic(e,t){let i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{let n=fe.getRelayProtocolName(i);await this.rpcUnsubscribe(e,t,n);let s=fe.getSdkError("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,t){let i={method:fe.getRelayProtocolApi(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await fe.createExpiringPromise(this.relayer.provider.request(i),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(fr.connection_stalled)}return fe.hashMessage(e+this.clientId)}rpcUnsubscribe(e,t,i){let n={method:fe.getRelayProtocolApi(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.provider.request(n)}onSubscribe(e,t){this.setSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}onResubscribe(e,t){this.addSubscription(e,U1(kd({},t),{id:e})),this.pending.delete(t.topic)}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),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,t){this.subscriptions.has(e)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t))}addSubscription(e,t){this.subscriptions.set(e,kd({},t)),this.topicMap.set(t.topic,e),this.events.emit(ei.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(ei.deleted,U1(kd({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(ei.sync)}async reset(){this.cached.length&&await Promise.all(this.cached.map(async e=>await this.resubscribe(e))),this.events.emit(ei.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}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 resubscribe(e){if(!this.ids.includes(e.id)){let{topic:t,relay:i}=e,n={topic:t,relay:i};this.pending.set(n.topic,n);let s=await this.rpcSubscribe(n.topic,n.relay);this.onResubscribe(s,n)}}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}checkPending(){this.relayer.transportExplicitlyClosed||this.pending.forEach(async e=>{let t=await this.rpcSubscribe(e.topic,e.relay);this.onSubscribe(t,e)})}registerEventListeners(){this.relayer.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>{this.checkPending()}),this.relayer.on(fr.connect,async()=>{await this.onConnect()}),this.relayer.on(fr.disconnect,()=>{this.onDisconnect()}),this.events.on(ei.created,async e=>{let t=ei.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(ei.deleted,async e=>{let t=ei.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{let t=setInterval(()=>{this.restartInProgress||(clearInterval(t),e())},this.pollingInterval)})}},u9=Object.defineProperty,t3=Object.getOwnPropertySymbols,c9=Object.prototype.hasOwnProperty,l9=Object.prototype.propertyIsEnumerable,r3=(r,e,t)=>e in r?u9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f9=(r,e)=>{for(var t in e||(e={}))c9.call(e,t)&&r3(r,t,e[t]);if(t3)for(var t of t3(e))l9.call(e,t)&&r3(r,t,e[t]);return r},Xd=class extends Wn.IRelayer{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new uo.EventEmitter,this.name=B3,this.transportExplicitlyClosed=!1,this.initialized=!1,this.reconnecting=!1,this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?st.generateChildLogger(e.logger,this.name):c3.default(st.getDefaultLoggerOptions({level:e.logger||P3})),this.messages=new Yd(this.logger,e.core),this.subscriber=new Jd(this,this.logger),this.publisher=new $1(this,this.logger),this.relayUrl=e?.relayUrl||X1,this.projectId=e.projectId,this.provider={}}async init(){this.logger.trace("Initialized"),this.provider=await this.createProvider(),await Promise.all([this.messages.init(),this.transportOpen(),this.subscriber.init()]),this.registerEventListeners(),this.initialized=!0}get context(){return st.getLoggerContext(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t})}async subscribe(e,t){this.isInitialized();let i="";return await Promise.all([new Promise(n=>{this.subscriber.once(ei.created,s=>{s.topic===e&&n()})}),new Promise(async n=>{i=await this.subscriber.subscribe(e,t),n()})]),i}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportClose(){this.transportExplicitlyClosed=!0,this.connected&&(await this.provider.disconnect(),this.events.emit(fr.transport_closed))}async transportOpen(e){if(!this.reconnecting){this.relayUrl=e||this.relayUrl,this.transportExplicitlyClosed=!1,this.reconnecting=!0;try{await Promise.all([new Promise(t=>{this.initialized||t(),this.subscriber.once(ei.resubscribed,()=>{t()})}),await Promise.race([new Promise(async t=>{await this.provider.connect(),this.removeListener(fr.transport_closed,this.rejectTransportOpen),t()}),new Promise(t=>this.once(fr.transport_closed,this.rejectTransportOpen))])])}catch(t){let i=t;if(!/socket hang up/i.test(i.message))throw t;this.logger.error(t),this.events.emit(fr.transport_closed)}finally{this.reconnecting=!1}}}async restartTransport(e){this.transportExplicitlyClosed||(await this.transportClose(),await new Promise(t=>setTimeout(t,W1)),await this.transportOpen(e))}rejectTransportOpen(){throw new Error("closeTransport called before connection was established")}async createProvider(){let e=await this.core.crypto.signJWT(this.relayUrl);return new xH.JsonRpcProvider(new BH.default(fe.formatRelayRpcUrl({sdkVersion:R3,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e})))}async recordMessageEvent(e){let{topic:t,message:i}=e;await this.messages.set(t,i)}async shouldIgnoreMessageEvent(e){let{topic:t,message:i}=e;return await this.subscriber.isSubscribed(t)?this.messages.has(t,i):!0}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ti.isJsonRpcRequest(e)){if(!e.method.endsWith(M3))return;let t=e.params,{topic:i,message:n}=t.data,s={topic:i,message:n};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(f9({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(fr.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=ti.formatJsonRpcResult(e.id,!0);await this.provider.connection.send(t)}registerEventListeners(){this.provider.on(sl.payload,e=>this.onProviderPayload(e)),this.provider.on(sl.connect,()=>{this.events.emit(fr.connect)}),this.provider.on(sl.disconnect,()=>{this.events.emit(fr.disconnect),this.attemptToReconnect()}),this.provider.on(sl.error,e=>this.events.emit(fr.error,e)),this.events.on(fr.connection_stalled,async()=>{await this.restartTransport()})}attemptToReconnect(){this.transportExplicitlyClosed||setTimeout(async()=>{await this.transportOpen()},Ht.toMiliseconds(W1))}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},h9=Object.defineProperty,i3=Object.getOwnPropertySymbols,d9=Object.prototype.hasOwnProperty,p9=Object.prototype.propertyIsEnumerable,n3=(r,e,t)=>e in r?h9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,s3=(r,e)=>{for(var t in e||(e={}))d9.call(e,t)&&n3(r,t,e[t]);if(i3)for(var t of i3(e))p9.call(e,t)&&n3(r,t,e[t]);return r},Zd=class extends Wn.IStore{constructor(e,t,i,n=ln,s=void 0){super(e,t,i,n),this.core=e,this.logger=t,this.name=i,this.map=new Map,this.version=L3,this.cached=[],this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{fe.isProposalStruct(o)?this.map.set(o.id,o):fe.isSessionStruct(o)?this.map.set(o.topic,o):this.getKey&&o!==null&&!fe.isUndefined(o)&&this.map.set(this.getKey(o),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=>MH.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=s3(s3({},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=st.generateChildLogger(t,this.name),this.storagePrefix=n,this.getKey=s}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 t=this.map.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},ep=class{constructor(e,t){this.core=e,this.logger=t,this.name=V3,this.version=H3,this.events=new OH.default,this.initialized=!1,this.storagePrefix=ln,this.ignoredPayloadTypes=[fe.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:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async()=>{this.isInitialized();let i=fe.generateRandomBytes32(),n=await this.core.crypto.setSymKey(i),s=fe.calcExpiry(Ht.FIVE_MINUTES),o={protocol:O3},a={topic:n,expiry:s,relay:o,active:!1},u=fe.formatUri({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:i,relay:o});return await this.pairings.set(n,a),await this.core.relayer.subscribe(n),this.core.expirer.set(n,s),{topic:n,uri:u}},this.pair=async i=>{this.isInitialized(),this.isValidPair(i);let{topic:n,symKey:s,relay:o}=fe.parseUri(i.uri),a=fe.calcExpiry(Ht.FIVE_MINUTES),u={topic:n,relay:o,expiry:a,active:!1};return await this.pairings.set(n,u),await this.core.crypto.setSymKey(s,n),await this.core.relayer.subscribe(n,{relay:o}),this.core.expirer.set(n,a),i.activatePairing&&await this.activate({topic:n}),u},this.activate=async({topic:i})=>{this.isInitialized();let n=fe.calcExpiry(Ht.THIRTY_DAYS);await this.pairings.update(i,{active:!0,expiry:n}),this.core.expirer.set(i,n)},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);let{topic:n}=i;if(this.pairings.keys.includes(n)){let s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:u}=fe.createDelayedPromise();this.events.once(fe.engineEvent("pairing_ping",s),({error:h})=>{h?u(h):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);let{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",fe.getSdkError("USER_DISCONNECTED")),await this.deletePairing(n))},this.sendRequest=async(i,n,s)=>{let o=ti.formatJsonRpcRequest(n,s),a=await this.core.crypto.encode(i,o),u=mu[n].req;return this.core.history.set(i,o),await this.core.relayer.publish(i,a,u),o.id},this.sendResult=async(i,n,s)=>{let o=ti.formatJsonRpcResult(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=mu[u.request.method].res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{let o=ti.formatJsonRpcError(i,s),a=await this.core.crypto.encode(n,o),u=await this.core.history.get(n,i),h=mu[u.request.method]?mu[u.request.method].res:mu.unregistered_method.res;await this.core.relayer.publish(n,a,h),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,fe.getSdkError("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{let i=this.pairings.getAll().filter(n=>fe.isExpired(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{let{topic:n,payload:s}=i,o=s.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{let{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;if(this.pairings.keys.includes(n))switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{let{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit("pairing_ping",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{let{id:s}=n;setTimeout(()=>{ti.isJsonRpcResult(n)?this.events.emit(fe.engineEvent("pairing_ping",s),{}):ti.isJsonRpcError(n)&&this.events.emit(fe.engineEvent("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{let{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.sendResult(s,i,!0),await this.deletePairing(i),this.events.emit("pairing_delete",{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{let{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;let a=fe.getSdkError("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(fe.getSdkError("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=i=>{if(!fe.isValidParams(i)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() params: ${i}`);throw new Error(n)}if(!fe.isValidUrl(i.uri)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw new Error(n)}},this.isValidPing=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!fe.isValidParams(i)){let{message:s}=fe.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}let{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!fe.isValidString(i,!1)){let{message:n}=fe.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){let{message:n}=fe.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(fe.isExpired(this.pairings.get(i).expiry)){await this.deletePairing(i);let{message:n}=fe.getInternalError("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=st.generateChildLogger(t,this.name),this.pairings=new Zd(this.core,this.logger,this.name,this.storagePrefix)}get context(){return st.getLoggerContext(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(fr.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;let n=await this.core.crypto.decode(t,i);ti.isJsonRpcRequest(n)?(this.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):ti.isJsonRpcResponse(n)&&(await this.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.core.expirer.on(Vr.expired,async e=>{let{topic:t}=fe.parseExpirerTarget(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit("pairing_expire",{topic:t}))})}},tp=class extends Wn.IJsonRpcHistory{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.records=new Map,this.events=new uo.EventEmitter,this.name=Q3,this.version=j3,this.cached=[],this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;let o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s};this.records.set(o.id,o),this.events.emit(Zr.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;let n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=ti.isJsonRpcError(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.events.emit(Zr.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Zr.deleted,s)}})},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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(t=>{if(typeof t.response<"u")return;let i={topic:t.topic,request:ti.formatJsonRpcRequest(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),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 t=this.records.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Zr.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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(Zr.created,e=>{let t=Zr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.updated,e=>{let t=Zr.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()}),this.events.on(Zr.deleted,e=>{let t=Zr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},rp=class extends Wn.IExpirer{constructor(e,t){super(e,t),this.core=e,this.logger=t,this.expirations=new Map,this.events=new uo.EventEmitter,this.name=G3,this.version=K3,this.cached=[],this.initialized=!1,this.storagePrefix=ln,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{let n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();let s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Vr.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();let n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){let n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Vr.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=st.generateChildLogger(t,this.name)}get context(){return st.getLoggerContext(this.logger)}get storageKey(){return this.storagePrefix+this.version+"//"+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 fe.formatTopicTarget(e);if(typeof e=="number")return fe.formatIdTarget(e);let{message:t}=fe.getInternalError("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}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:t}=fe.getInternalError("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}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 t=this.expirations.get(e);if(!t){let{message:i}=fe.getInternalError("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}checkExpiry(e,t){let{expiry:i}=t;Ht.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Vr.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(ip.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(Vr.created,e=>{let t=Vr.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.expired,e=>{let t=Vr.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Vr.deleted,e=>{let t=Vr.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=fe.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}},g9=Object.defineProperty,o3=Object.getOwnPropertySymbols,y9=Object.prototype.hasOwnProperty,m9=Object.prototype.propertyIsEnumerable,a3=(r,e,t)=>e in r?g9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,u3=(r,e)=>{for(var t in e||(e={}))y9.call(e,t)&&a3(r,t,e[t]);if(o3)for(var t of o3(e))m9.call(e,t)&&a3(r,t,e[t]);return r},wu=class extends Wn.ICore{constructor(e){super(e),this.protocol=J1,this.version=E3,this.name=sp,this.events=new uo.EventEmitter,this.initialized=!1,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||X1;let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:c3.default(st.getDefaultLoggerOptions({level:e?.logger||A3.logger}));this.logger=st.generateChildLogger(t,this.name),this.heartbeat=new ip.HeartBeat,this.crypto=new $d(this,this.logger,e?.keychain),this.history=new tp(this,this.logger),this.expirer=new rp(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new PH.default(u3(u3({},I3),e?.storageOptions)),this.relayer=new Xd({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ep(this,this.logger)}static async init(e){let t=new wu(e);return await t.initialize(),t}get context(){return st.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}}},w9=wu;Ee.CORE_CONTEXT=sp,Ee.CORE_DEFAULT=A3,Ee.CORE_PROTOCOL=J1,Ee.CORE_STORAGE_OPTIONS=I3,Ee.CORE_STORAGE_PREFIX=ln,Ee.CORE_VERSION=E3,Ee.CRYPTO_CLIENT_SEED=k1,Ee.CRYPTO_CONTEXT=_3,Ee.CRYPTO_JWT_TTL=b3,Ee.Core=w9,Ee.Crypto=$d,Ee.EXPIRER_CONTEXT=G3,Ee.EXPIRER_DEFAULT_TTL=r9,Ee.EXPIRER_EVENTS=Vr,Ee.EXPIRER_STORAGE_VERSION=K3,Ee.Expirer=rp,Ee.HISTORY_CONTEXT=Q3,Ee.HISTORY_EVENTS=Zr,Ee.HISTORY_STORAGE_VERSION=j3,Ee.JsonRpcHistory=tp,Ee.KEYCHAIN_CONTEXT=C3,Ee.KEYCHAIN_STORAGE_VERSION=S3,Ee.KeyChain=Wd,Ee.MESSAGES_CONTEXT=x3,Ee.MESSAGES_STORAGE_VERSION=T3,Ee.MessageTracker=Yd,Ee.PAIRING_CONTEXT=V3,Ee.PAIRING_DEFAULT_TTL=t9,Ee.PAIRING_RPC_OPTS=mu,Ee.PAIRING_STORAGE_VERSION=H3,Ee.PENDING_SUB_RESOLUTION_TIMEOUT=q3,Ee.PUBLISHER_CONTEXT=D3,Ee.PUBLISHER_DEFAULT_TTL=N3,Ee.Pairing=ep,Ee.RELAYER_CONTEXT=B3,Ee.RELAYER_DEFAULT_LOGGER=P3,Ee.RELAYER_DEFAULT_PROTOCOL=O3,Ee.RELAYER_DEFAULT_RELAY_URL=X1,Ee.RELAYER_EVENTS=fr,Ee.RELAYER_PROVIDER_EVENTS=sl,Ee.RELAYER_RECONNECT_TIMEOUT=W1,Ee.RELAYER_SDK_VERSION=R3,Ee.RELAYER_STORAGE_OPTIONS=ZQ,Ee.RELAYER_SUBSCRIBER_SUFFIX=M3,Ee.Relayer=Xd,Ee.STORE_STORAGE_VERSION=L3,Ee.SUBSCRIBER_CONTEXT=F3,Ee.SUBSCRIBER_DEFAULT_TTL=e9,Ee.SUBSCRIBER_EVENTS=ei,Ee.SUBSCRIBER_STORAGE_VERSION=U3,Ee.Store=Zd,Ee.Subscriber=Jd,Ee.default=wu});var rD=B(lt=>{"use strict";f();Object.defineProperty(lt,"__esModule",{value:!0});var v9=lh(),$n=z3(),Z1=bm(),$3=Hm(),te=Ed(),Y3=$s(),ft=Ys(),Qt=(Zc(),at(lr));function J3(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var E9=J3(v9),A9=J3(Y3),sv="wc",ov=2,av="client",up=`${sv}@${ov}:${av}:`,op={name:av,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},I9={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"},_9={database:":memory:"},b9={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},C9="history",S9="0.3",X3="proposal",x9=ft.THIRTY_DAYS,Z3="session",ul=ft.SEVEN_DAYS,eD="engine",vu={wc_sessionPropose:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ft.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ft.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ft.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ft.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:ft.THIRTY_SECONDS,prompt:!1,tag:1115}}},ap={min:ft.FIVE_MINUTES,max:ft.SEVEN_DAYS},tD="request",T9=Object.defineProperty,N9=Object.defineProperties,D9=Object.getOwnPropertyDescriptors,k3=Object.getOwnPropertySymbols,O9=Object.prototype.hasOwnProperty,P9=Object.prototype.propertyIsEnumerable,W3=(r,e,t)=>e in r?T9(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Hr=(r,e)=>{for(var t in e||(e={}))O9.call(e,t)&&W3(r,t,e[t]);if(k3)for(var t of k3(e))P9.call(e,t)&&W3(r,t,e[t]);return r},ev=(r,e)=>N9(r,D9(e)),tv=class extends $3.IEngine{constructor(e){super(e),this.name=eD,this.events=new A9.default,this.initialized=!1,this.ignoredPayloadTypes=[te.TYPE_1],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.client.core.pairing.register({methods:Object.keys(vu)}),this.initialized=!0)},this.connect=async t=>{this.isInitialized();let i=ev(Hr({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(i);let{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:u}=i,h=n,p,w=!1;if(h&&(w=this.client.core.pairing.pairings.get(h).active),!h||!w){let{topic:Y,uri:j}=await this.client.core.pairing.create();h=Y,p=j}let N=await this.client.core.crypto.generateKeyPair(),O=Hr({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:$n.RELAYER_DEFAULT_PROTOCOL}],proposer:{publicKey:N,metadata:this.client.metadata}},a&&{sessionProperties:a}),{reject:T,resolve:V,done:z}=te.createDelayedPromise();if(this.events.once(te.engineEvent("session_connect"),async({error:Y,session:j})=>{if(Y)T(Y);else if(j){j.self.publicKey=N;let W=ev(Hr({},j),{requiredNamespaces:j.requiredNamespaces,optionalNamespaces:j.optionalNamespaces});await this.client.session.set(j.topic,W),await this.setExpiry(j.topic,j.expiry),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:j.peer.metadata}),V(W)}}),!h){let{message:Y}=te.getInternalError("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(Y)}let $=await this.sendRequest(h,"wc_sessionPropose",O),se=te.calcExpiry(ft.FIVE_MINUTES);return await this.setProposal($,Hr({id:$,expiry:se},O)),{uri:p,approval:z}},this.pair=async t=>(this.isInitialized(),await this.client.core.pairing.pair(t)),this.approve=async t=>{this.isInitialized(),await this.isValidApprove(t);let{id:i,relayProtocol:n,namespaces:s,sessionProperties:o}=t,a=this.client.proposal.get(i),{pairingTopic:u,proposer:h,requiredNamespaces:p,optionalNamespaces:w}=a;te.isValidObject(p)||(p=te.getRequiredNamespacesFromNamespaces(s,"approve()"));let N=await this.client.core.crypto.generateKeyPair(),O=h.publicKey,T=await this.client.core.crypto.generateSharedKey(N,O);u&&i&&(await this.client.core.pairing.updateMetadata({topic:u,metadata:h.metadata}),await this.sendResult(i,u,{relay:{protocol:n??"irn"},responderPublicKey:N}),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:u}));let V=Hr({relay:{protocol:n??"irn"},namespaces:s,requiredNamespaces:p,optionalNamespaces:w,controller:{publicKey:N,metadata:this.client.metadata},expiry:te.calcExpiry(ul)},o&&{sessionProperties:o});await this.client.core.relayer.subscribe(T);let z=await this.sendRequest(T,"wc_sessionSettle",V),{done:$,resolve:se,reject:Y}=te.createDelayedPromise();this.events.once(te.engineEvent("session_approve",z),({error:W})=>{W?Y(W):se(this.client.session.get(T))});let j=ev(Hr({},V),{topic:T,acknowledged:!1,self:V.controller,peer:{publicKey:h.publicKey,metadata:h.metadata},controller:N});return await this.client.session.set(T,j),await this.setExpiry(T,te.calcExpiry(ul)),{topic:T,acknowledged:$}},this.reject=async t=>{this.isInitialized(),await this.isValidReject(t);let{id:i,reason:n}=t,{pairingTopic:s}=this.client.proposal.get(i);s&&(await this.sendError(i,s,n),await this.client.proposal.delete(i,te.getSdkError("USER_DISCONNECTED")))},this.update=async t=>{this.isInitialized(),await this.isValidUpdate(t);let{topic:i,namespaces:n}=t,s=await this.sendRequest(i,"wc_sessionUpdate",{namespaces:n}),{done:o,resolve:a,reject:u}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_update",s),({error:h})=>{h?u(h):a()}),await this.client.session.update(i,{namespaces:n}),{acknowledged:o}},this.extend=async t=>{this.isInitialized(),await this.isValidExtend(t);let{topic:i}=t,n=await this.sendRequest(i,"wc_sessionExtend",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();return this.events.once(te.engineEvent("session_extend",n),({error:u})=>{u?a(u):o()}),await this.setExpiry(i,te.calcExpiry(ul)),{acknowledged:s}},this.request=async t=>{this.isInitialized(),await this.isValidRequest(t);let{chainId:i,request:n,topic:s,expiry:o}=t,a=await this.sendRequest(s,"wc_sessionRequest",{request:n,chainId:i},o),{done:u,resolve:h,reject:p}=te.createDelayedPromise(o);return this.events.once(te.engineEvent("session_request",a),({error:w,result:N})=>{w?p(w):h(N)}),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i}),await u()},this.respond=async t=>{this.isInitialized(),await this.isValidRespond(t);let{topic:i,response:n}=t,{id:s}=n;Qt.isJsonRpcResult(n)?await this.sendResult(s,i,n.result):Qt.isJsonRpcError(n)&&await this.sendError(s,i,n.error),this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0})},this.ping=async t=>{this.isInitialized(),await this.isValidPing(t);let{topic:i}=t;if(this.client.session.keys.includes(i)){let n=await this.sendRequest(i,"wc_sessionPing",{}),{done:s,resolve:o,reject:a}=te.createDelayedPromise();this.events.once(te.engineEvent("session_ping",n),({error:u})=>{u?a(u):o()}),await s()}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async t=>{this.isInitialized(),await this.isValidEmit(t);let{topic:i,event:n,chainId:s}=t;await this.sendRequest(i,"wc_sessionEvent",{event:n,chainId:s})},this.disconnect=async t=>{this.isInitialized(),await this.isValidDisconnect(t);let{topic:i}=t;this.client.session.keys.includes(i)?(await this.sendRequest(i,"wc_sessionDelete",te.getSdkError("USER_DISCONNECTED")),await this.deleteSession(i)):await this.client.core.pairing.disconnect({topic:i})},this.find=t=>(this.isInitialized(),this.client.session.getAll().filter(i=>te.isSessionCompatible(i,t))),this.getPendingSessionRequests=()=>(this.isInitialized(),this.client.pendingRequest.getAll()),this.deleteSession=async(t,i)=>{let{self:n}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await Promise.all([this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.client.core.crypto.deleteKeyPair(n.publicKey),this.client.core.crypto.deleteSymKey(t),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deleteProposal=async(t,i)=>{await Promise.all([this.client.proposal.delete(t,te.getSdkError("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)])},this.deletePendingSessionRequest=async(t,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),n?Promise.resolve():this.client.core.expirer.del(t)])},this.setExpiry=async(t,i)=>{this.client.session.keys.includes(t)&&await this.client.session.update(t,{expiry:i}),this.client.core.expirer.set(t,i)},this.setProposal=async(t,i)=>{await this.client.proposal.set(t,i),this.client.core.expirer.set(t,i.expiry)},this.setPendingSessionRequest=async t=>{let i=vu.wc_sessionRequest.req.ttl,{id:n,topic:s,params:o}=t;await this.client.pendingRequest.set(n,{id:n,topic:s,params:o}),i&&this.client.core.expirer.set(n,te.calcExpiry(i))},this.sendRequest=async(t,i,n,s)=>{let o=Qt.formatJsonRpcRequest(i,n),a=await this.client.core.crypto.encode(t,o),u=vu[i].req;return s&&(u.ttl=s),this.client.core.history.set(t,o),this.client.core.relayer.publish(t,a,u),o.id},this.sendResult=async(t,i,n)=>{let s=Qt.formatJsonRpcResult(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=vu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.sendError=async(t,i,n)=>{let s=Qt.formatJsonRpcError(t,n),o=await this.client.core.crypto.encode(i,s),a=await this.client.core.history.get(i,t),u=vu[a.request.method].res;this.client.core.relayer.publish(i,o,u),await this.client.core.history.resolve(s)},this.cleanup=async()=>{let t=[],i=[];this.client.session.getAll().forEach(n=>{te.isExpired(n.expiry)&&t.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{te.isExpired(n.expiry)&&i.push(n.id)}),await Promise.all([...t.map(n=>this.deleteSession(n)),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=t=>{let{topic:i,payload:n}=t,s=n.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeRequest(i,n);case"wc_sessionSettle":return this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return this.onSessionExtendRequest(i,n);case"wc_sessionPing":return this.onSessionPingRequest(i,n);case"wc_sessionDelete":return this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return this.onSessionRequest(i,n);case"wc_sessionEvent":return this.onSessionEventRequest(i,n);default:return this.client.logger.info(`Unsupported request method ${s}`)}},this.onRelayEventResponse=async t=>{let{topic:i,payload:n}=t,s=(await this.client.core.history.get(i,n.id)).request.method;switch(s){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${s}`)}},this.onSessionProposeRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidConnect(Hr({},i.params));let o=te.calcExpiry(ft.FIVE_MINUTES),a=Hr({id:s,pairingTopic:t,expiry:o},n);await this.setProposal(s,a),this.client.events.emit("session_proposal",{id:s,params:a})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionProposeResponse=async(t,i)=>{let{id:n}=i;if(Qt.isJsonRpcResult(i)){let{result:s}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:s});let o=this.client.proposal.get(n);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 h=await this.client.core.crypto.generateSharedKey(a,u);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:h});let p=await this.client.core.relayer.subscribe(h);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:p}),await this.client.core.pairing.activate({topic:t})}else Qt.isJsonRpcError(i)&&(await this.client.proposal.delete(n,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_connect"),{error:i.error}))},this.onSessionSettleRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);let{relay:o,controller:a,expiry:u,namespaces:h,requiredNamespaces:p,optionalNamespaces:w,sessionProperties:N}=i.params,O=Hr({topic:t,relay:o,expiry:u,namespaces:h,acknowledged:!0,requiredNamespaces:p,optionalNamespaces:w,controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},N&&{sessionProperties:N});await this.sendResult(i.id,t,!0),this.events.emit(te.engineEvent("session_connect"),{session:O})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionSettleResponse=async(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(te.engineEvent("session_approve",n),{})):Qt.isJsonRpcError(i)&&(await this.client.session.delete(t,te.getSdkError("USER_DISCONNECTED")),this.events.emit(te.engineEvent("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(t,i)=>{let{params:n,id:s}=i;try{this.isValidUpdate(Hr({topic:t},n)),await this.client.session.update(t,{namespaces:n.namespaces}),await this.sendResult(s,t,!0),this.client.events.emit("session_update",{id:s,topic:t,params:n})}catch(o){await this.sendError(s,t,o),this.client.logger.error(o)}},this.onSessionUpdateResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_update",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(t,i)=>{let{id:n}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,te.calcExpiry(ul)),await this.sendResult(n,t,!0),this.client.events.emit("session_extend",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionExtendResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_extend",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(t,i)=>{let{id:n}=i;try{this.isValidPing({topic:t}),await this.sendResult(n,t,!0),this.client.events.emit("session_ping",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionPingResponse=(t,i)=>{let{id:n}=i;setTimeout(()=>{Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_ping",n),{}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(t,i)=>{let{id:n}=i;try{this.isValidDisconnect({topic:t,reason:i.params}),this.client.core.relayer.once($n.RELAYER_EVENTS.publish,async()=>{await this.deleteSession(t)}),await this.sendResult(n,t,!0),this.client.events.emit("session_delete",{id:n,topic:t})}catch(s){await this.sendError(n,t,s),this.client.logger.error(s)}},this.onSessionRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidRequest(Hr({topic:t},s)),await this.setPendingSessionRequest({id:n,topic:t,params:s}),this.client.events.emit("session_request",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.onSessionRequestResponse=(t,i)=>{let{id:n}=i;Qt.isJsonRpcResult(i)?this.events.emit(te.engineEvent("session_request",n),{result:i.result}):Qt.isJsonRpcError(i)&&this.events.emit(te.engineEvent("session_request",n),{error:i.error})},this.onSessionEventRequest=async(t,i)=>{let{id:n,params:s}=i;try{this.isValidEmit(Hr({topic:t},s)),this.client.events.emit("session_event",{id:n,topic:t,params:s})}catch(o){await this.sendError(n,t,o),this.client.logger.error(o)}},this.isValidConnect=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(u)}let{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:a}=t;if(te.isUndefined(i)||await this.isValidPairingTopic(i),!te.isValidRelays(a,!0)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(u)}!te.isUndefined(n)&&te.isValidObject(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!te.isUndefined(s)&&te.isValidObject(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(t,i)=>{let n=te.isValidRequiredNamespaces(t,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async t=>{if(!te.isValidParams(t))throw new Error(te.getInternalError("MISSING_OR_INVALID",`approve() params: ${t}`).message);let{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=t;await this.isValidProposalId(i);let a=this.client.proposal.get(i),u=te.isValidNamespaces(n,"approve()");if(u)throw new Error(u.message);let h=te.isConformingNamespaces(a.requiredNamespaces,n,"approve()","requiredNamespaces");if(h)throw new Error(h.message);if(!te.isValidString(s,!0)){let{message:p}=te.getInternalError("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(p)}if(Object.keys(n).length>Object.keys(a.requiredNamespaces).length){let p=Object.keys(a.optionalNamespaces).filter(O=>n[O]),w={};for(let O in a.optionalNamespaces)p.includes(O)&&(w[O]=a.optionalNamespaces[O]);let N=te.isConformingNamespaces(w,n,"approve()","optionalNamespaces");if(N)throw new Error(N.message)}te.isUndefined(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}let{id:i,reason:n}=t;if(await this.isValidProposalId(i),!te.isValidErrorReason(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=t=>{if(!te.isValidParams(t)){let{message:h}=te.getInternalError("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(h)}let{relay:i,controller:n,namespaces:s,expiry:o}=t;if(!te.isValidRelay(i)){let{message:h}=te.getInternalError("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}let a=te.isValidController(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);let u=te.isValidNamespaces(s,"onSessionSettleRequest()");if(u)throw new Error(u.message);if(te.isExpired(o)){let{message:h}=te.getInternalError("EXPIRED","onSessionSettleRequest()");throw new Error(h)}},this.isValidUpdate=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(u)}let{topic:i,namespaces:n}=t;await this.isValidSessionTopic(i);let s=this.client.session.get(i),o=te.isValidNamespaces(n,"update()");if(o)throw new Error(o.message);let a=te.isConformingNamespaces(s.requiredNamespaces,n,"update()","requiredNamespaces");if(a)throw new Error(a.message)},this.isValidExtend=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionTopic(i)},this.isValidRequest=async t=>{if(!te.isValidParams(t)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(u)}let{topic:i,request:n,chainId:s,expiry:o}=t;await this.isValidSessionTopic(i);let{namespaces:a}=this.client.session.get(i);if(!te.isValidNamespacesChainId(a,s)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(u)}if(!te.isValidRequest(n)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(u)}if(!te.isValidNamespacesRequest(a,s,n.method)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(u)}if(o&&!te.isValidRequestExpiry(o,ap)){let{message:u}=te.getInternalError("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${ap.min} and ${ap.max}`);throw new Error(u)}},this.isValidRespond=async t=>{if(!te.isValidParams(t)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(s)}let{topic:i,response:n}=t;if(await this.isValidSessionTopic(i),!te.isValidResponse(n)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidPing=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async t=>{if(!te.isValidParams(t)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}let{topic:i,event:n,chainId:s}=t;await this.isValidSessionTopic(i);let{namespaces:o}=this.client.session.get(i);if(!te.isValidNamespacesChainId(o,s)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!te.isValidEvent(n)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!te.isValidNamespacesEvent(o,s,n.name)){let{message:a}=te.getInternalError("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async t=>{if(!te.isValidParams(t)){let{message:n}=te.getInternalError("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(n)}let{topic:i}=t;await this.isValidSessionOrPairingTopic(i)},this.validateSessionProps=(t,i)=>{Object.values(t).forEach(n=>{if(!te.isValidString(n,!1)){let{message:s}=te.getInternalError("MISSING_OR_INVALID",`${i} must be in Record format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})}}isInitialized(){if(!this.initialized){let{message:e}=te.getInternalError("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.client.core.relayer.on($n.RELAYER_EVENTS.message,async e=>{let{topic:t,message:i}=e;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(i)))return;let n=await this.client.core.crypto.decode(t,i);Qt.isJsonRpcRequest(n)?(this.client.core.history.set(t,n),this.onRelayEventRequest({topic:t,payload:n})):Qt.isJsonRpcResponse(n)&&(await this.client.core.history.resolve(n),this.onRelayEventResponse({topic:t,payload:n}))})}registerExpirerEvents(){this.client.core.expirer.on($n.EXPIRER_EVENTS.expired,async e=>{let{topic:t,id:i}=te.parseExpirerTarget(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,te.getInternalError("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession(t,!0),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}isValidPairingTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=te.getInternalError("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!te.isValidString(e,!1)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(!this.client.session.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.session.get(e).expiry)){await this.deleteSession(e);let{message:t}=te.getInternalError("EXPIRED",`session topic: ${e}`);throw new Error(t)}}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(te.isValidString(e,!1)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{let{message:t}=te.getInternalError("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!te.isValidId(e)){let{message:t}=te.getInternalError("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=te.getInternalError("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(te.isExpired(this.client.proposal.get(e).expiry)){await this.deleteProposal(e);let{message:t}=te.getInternalError("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}},rv=class extends $n.Store{constructor(e,t){super(e,t,X3,up),this.core=e,this.logger=t}},iv=class extends $n.Store{constructor(e,t){super(e,t,Z3,up),this.core=e,this.logger=t}},nv=class extends $n.Store{constructor(e,t){super(e,t,tD,up),this.core=e,this.logger=t}},Eu=class extends $3.ISignClient{constructor(e){super(e),this.protocol=sv,this.version=ov,this.name=op.name,this.events=new Y3.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.name=e?.name||op.name,this.metadata=e?.metadata||te.getAppMetadata();let t=typeof e?.logger<"u"&&typeof e?.logger!="string"?e.logger:E9.default(Z1.getDefaultLoggerOptions({level:e?.logger||op.logger}));this.core=e?.core||new $n.Core(e),this.logger=Z1.generateChildLogger(t,this.name),this.session=new iv(this.core,this.logger),this.proposal=new rv(this.core,this.logger),this.pendingRequest=new nv(this.core,this.logger),this.engine=new tv(this)}static async init(e){let t=new Eu(e);return await t.initialize(),t}get context(){return Z1.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.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}},B9=Eu;lt.ENGINE_CONTEXT=eD,lt.ENGINE_RPC_OPTS=vu,lt.HISTORY_CONTEXT=C9,lt.HISTORY_EVENTS=b9,lt.HISTORY_STORAGE_VERSION=S9,lt.PROPOSAL_CONTEXT=X3,lt.PROPOSAL_EXPIRY=x9,lt.REQUEST_CONTEXT=tD,lt.SESSION_CONTEXT=Z3,lt.SESSION_EXPIRY=ul,lt.SESSION_REQUEST_EXPIRY_BOUNDARIES=ap,lt.SIGN_CLIENT_CONTEXT=av,lt.SIGN_CLIENT_DEFAULT=op,lt.SIGN_CLIENT_EVENTS=I9,lt.SIGN_CLIENT_PROTOCOL=sv,lt.SIGN_CLIENT_STORAGE_OPTIONS=_9,lt.SIGN_CLIENT_STORAGE_PREFIX=up,lt.SIGN_CLIENT_VERSION=ov,lt.SignClient=B9,lt.default=Eu});var iD=B(Mi=>{"use strict";f();Object.defineProperty(Mi,"__esModule",{value:!0});Mi.WALLETCONNECT_OLD_METHOD_PREFIX=Mi.WALLETCONNECT_OLD_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE=Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=void 0;Mi.WALLETCONNECT_MULTIVERSX_CHAIN_ID=508;Mi.WALLETCONNECT_MULTIVERSX_NAMESPACE="multiversx";Mi.WALLETCONNECT_OLD_NAMESPACE="elrond";Mi.WALLETCONNECT_OLD_METHOD_PREFIX="erd"});var nD=B(Yn=>{"use strict";f();Object.defineProperty(Yn,"__esModule",{value:!0});Yn.OldOperation=Yn.Operation=void 0;var M9;(function(r){r.SIGN_TRANSACTION="multiversx_signTransaction",r.SIGN_TRANSACTIONS="multiversx_signTransactions",r.SIGN_MESSAGE="multiversx_signMessage",r.SIGN_LOGIN_TOKEN="multiversx_signLoginToken"})(M9=Yn.Operation||(Yn.Operation={}));var R9;(function(r){r.SIGN_TRANSACTION="erd_signTransaction",r.SIGN_TRANSACTIONS="erd_signTransactions",r.SIGN_MESSAGE="erd_signMessage",r.SIGN_LOGIN_TOKEN="erd_signLoginToken"})(R9=Yn.OldOperation||(Yn.OldOperation={}))});var sD=B(cp=>{"use strict";f();Object.defineProperty(cp,"__esModule",{value:!0});cp.Logger=void 0;var uv=class{static error(e){console.error(e)}static trace(e){console.trace(e)}};cp.Logger=uv});var oD=B(Au=>{"use strict";f();Object.defineProperty(Au,"__esModule",{value:!0});Au.Signature=Au.Address=void 0;var cv=class{constructor(e){this.value=e}bech32(){return this.value}};Au.Address=cv;var cl=class{constructor(e){this.buffer=e}static fromHex(e){return new cl(y.Buffer.from(e,"hex"))}hex(){return this.buffer.toString("hex")}};Au.Signature=cl});var hv=B(ri=>{"use strict";f();Object.defineProperty(ri,"__esModule",{value:!0});ri.WalletConnectV2ProviderErrorMessagesEnum=ri.ErrBadAddress=ri.ErrNotImplemented=ri.Err=void 0;var ll=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};ri.Err=ll;var lv=class extends ll{constructor(){super("Method not yet implemented")}};ri.ErrNotImplemented=lv;var fv=class extends ll{constructor(e,t){super(`Bad address: ${e}`,t)}};ri.ErrBadAddress=fv;var L9;(function(r){r.unableToInit="WalletConnect is unable to init",r.notInitialized="WalletConnect is not initialized",r.unableToConnect="WalletConnect is unable to connect",r.unableToConnectExisting="WalletConnect is unable to connect to existing pairing",r.unableToSignLoginToken="WalletConnect could not sign login token",r.unableToLogin="WalletConnect is unable to login",r.unableToHandleTopic="WalletConnect: Unable to handle topic update",r.unableToHandleEvent="WalletConnect: Unable to handle events",r.sessionNotConnected="WalletConnect Session is not connected",r.sessionDeleted="WalletConnect Session Deleted",r.sessionExpired="WalletConnect Session Expired",r.alreadyLoggedOut="WalletConnect: Already logged out",r.pingFailed="WalletConnect Ping Failed",r.invalidAddress="WalletConnect: Invalid address",r.requestDifferentChain="WalletConnect: Request Chain Id different than Connection Chain Id",r.invalidMessageResponse="WalletConnect could not sign the message",r.invalidMessageSignature="WalletConnect: Invalid message signature",r.invalidTransactionResponse="WalletConnect could not sign the transactions. Invalid signatures",r.invalidCustomRequestResponse="WalletConnect could not send the custom request",r.transactionError="Transaction canceled",r.connectionError="WalletConnect could not establish a connection"})(L9=ri.WalletConnectV2ProviderErrorMessagesEnum||(ri.WalletConnectV2ProviderErrorMessagesEnum={}))});var uD=B(Ri=>{"use strict";f();var F9=Ri&&Ri.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),U9=Ri&&Ri.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),q9=Ri&&Ri.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&F9(e,r,t);return U9(e,r),e};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.UserAddress=void 0;var V9=q9(kl()),aD=hv(),H9="erd",fl=class{constructor(e){this.value=e}static fromBech32(e){let t;try{t=V9.decode(e)}catch(i){throw new aD.ErrBadAddress(e,i)}if(t.prefix!=H9)throw new aD.ErrBadAddress(e);return new fl(e)}bech32(){return this.value}};Ri.UserAddress=fl});var dl=B(Fi=>{"use strict";f();var Yt=Fi&&Fi.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},Q9=Fi&&Fi.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.WalletConnectV2Provider=Fi.WalletConnectV2ProviderErrorMessagesEnum=void 0;var j9=Q9(rD()),cD=Ed(),Ke=iD(),Li=nD(),Fe=sD(),hl=oD(),pe=hv();Object.defineProperty(Fi,"WalletConnectV2ProviderErrorMessagesEnum",{enumerable:!0,get:function(){return pe.WalletConnectV2ProviderErrorMessagesEnum}});var lp=uD(),dv=class{constructor(e,t,i,n,s){this.chainId="",this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.isInitializing=!1,this.events=[],this.methods=[],this.options={},this.onClientConnect=e,this.chainId=t,this.walletConnectV2Relay=i,this.walletConnectV2ProjectId=n,this.options=s}reset(){this.address="",this.signature="",this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE,this.session=void 0}init(){return Yt(this,void 0,void 0,function*(){if(this.isInitialized())return this.isInitialized();try{this.reset();let e=yield j9.default.init(Object.assign({relayUrl:this.walletConnectV2Relay,projectId:this.walletConnectV2ProjectId},this.options));this.walletConnector=e,yield this.subscribeToEvents(e),yield this.checkPersistedState(e)}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToInit)}finally{return this.isInitializing=!1,this.isInitialized()}})}isInitialized(){return!!this.walletConnector&&!this.isInitializing}isConnected(){return new Promise((e,t)=>e(Boolean(this.isInitialized()&&typeof this.session<"u")))}connect(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u"&&(yield this.init()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let i=[...Object.values(Li.Operation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)):[]],n=[...Object.values(Li.OldOperation),...e?.methods?e.methods.filter(u=>u.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)):[]],s=[`${Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE}:${this.chainId}`],o=[`${Ke.WALLETCONNECT_OLD_NAMESPACE}:${this.chainId}`],a=(t=e?.events)!==null&&t!==void 0?t:[];try{let u=yield this.walletConnector.connect({pairingTopic:e?.topic,requiredNamespaces:{[Ke.WALLETCONNECT_OLD_NAMESPACE]:{methods:n,chains:o,events:a}},optionalNamespaces:{[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]:{methods:i,chains:s,events:a}}});return this.events=a,this.methods=i,u}catch{throw e?.topic?(yield this.logout({topic:e.topic}),Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnectExisting)):(Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToConnect))}})}login(e){var t,i;return Yt(this,void 0,void 0,function*(){if(this.isInitializing=!0,typeof this.walletConnector>"u"&&(yield this.connect()),typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);typeof this.session<"u"&&(yield this.logout());try{if(e&&e.approval){let n=yield e.approval();if(!((t=n?.namespaces)===null||t===void 0)&&t[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((i=n?.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE),e.token){let s=this.getAddressFromSession(n),{signature:o}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:n.topic,request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_LOGIN_TOKEN:Li.OldOperation.SIGN_LOGIN_TOKEN,params:{token:e.token,address:s}}});if(!o)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToSignLoginToken);return yield this.onSessionConnected({session:n,signature:o})}return yield this.onSessionConnected({session:n,signature:""})}}catch{throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToLogin)}finally{this.isInitializing=!1}return""})}logout(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{let i=(t=e?.topic)!==null&&t!==void 0?t:this.getCurrentTopic(this.walletConnector);if(i){yield this.walletConnector.disconnect({topic:i,reason:cD.getSdkError("USER_DISCONNECTED")});let n=this.walletConnector.core.pairing.pairings.getAll({active:!0}).filter(s=>s.topic!==i);this.pairings=n}}catch{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.alreadyLoggedOut)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0}),this.reset()}return!0})}getAddress(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.address})}getSignature(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return this.signature})}getPairings(){var e;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);return(e=this.pairings)!==null&&e!==void 0?e:this.walletConnector.core.pairing.pairings.getAll({active:!0})})}signMessage(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),{signature:i}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_MESSAGE:Li.OldOperation.SIGN_MESSAGE,params:{address:t,message:e.message.toString()}}});if(!i)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageResponse);try{e.applySignature(new hl.Signature(i),lp.UserAddress.fromBech32(t))}catch{throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidMessageSignature)}return e})}signTransaction(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.toPlainObject(i);if(this.chainId!==e.getChainID().valueOf())throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);try{let{signature:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTION:Li.OldOperation.SIGN_TRANSACTION,params:{transaction:n}}});if(!s)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return e.applySignature(hl.Signature.fromHex(s),lp.UserAddress.fromBech32(t)),e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}signTransactions(e){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);let t=yield this.getAddress(),i=new hl.Address(t),n=e.map(s=>{if(this.chainId!==s.getChainID().valueOf())throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.requestDifferentChain);return s.toPlainObject(i)});try{let{signatures:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:{method:this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE?Li.Operation.SIGN_TRANSACTIONS:Li.OldOperation.SIGN_TRANSACTIONS,params:{transactions:n}}});(!s||!Array.isArray(s))&&Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse),e.length!==s.length&&Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidTransactionResponse);for(let[o,a]of e.entries())a.applySignature(hl.Signature.fromHex(s[o].signature),lp.UserAddress.fromBech32(t));return e}catch{throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.transactionError)}})}sendCustomRequest(e){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);if(!((t=e?.request)===null||t===void 0)&&t.method){let i=Object.assign({},e.request),{method:n}=i;i.method.startsWith(Ke.WALLETCONNECT_OLD_METHOD_PREFIX)&&this.namespace===Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_OLD_METHOD_PREFIX,this.namespace)),i.method.startsWith(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE)&&this.namespace===Ke.WALLETCONNECT_OLD_NAMESPACE&&(n=n.replace(Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE,Ke.WALLETCONNECT_OLD_METHOD_PREFIX));let{response:s}=yield this.walletConnector.request({chainId:`${this.namespace}:${this.chainId}`,topic:this.getCurrentTopic(this.walletConnector),request:Object.assign(Object.assign({},i),{method:n})});if(!s)throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.invalidCustomRequestResponse);return s}})}ping(){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(typeof this.session>"u")throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected);try{return yield this.walletConnector.ping({topic:this.getCurrentTopic(this.walletConnector)}),!0}catch{return Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.pingFailed),!1}})}loginAccount(e){return Yt(this,void 0,void 0,function*(){if(e){if(this.addressIsValid(e.address)){this.address=e.address,e.signature&&(this.signature=e.signature),this.onClientConnect.onClientLogin();return}if(Fe.Logger.error(`${pe.WalletConnectV2ProviderErrorMessagesEnum.invalidAddress} ${e.address}`),this.walletConnector){yield this.walletConnector.disconnect({topic:this.getCurrentTopic(this.walletConnector),reason:cD.getSdkError("USER_DISCONNECTED")});let t=this.walletConnector.core.pairing.pairings.getAll({active:!0});this.pairings=t}}})}onSessionConnected(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(!e)return"";this.session=e.session,!((i=(t=e.session)===null||t===void 0?void 0:t.namespaces)===null||i===void 0)&&i[Ke.WALLETCONNECT_OLD_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_OLD_NAMESPACE),!((s=(n=e.session)===null||n===void 0?void 0:n.namespaces)===null||s===void 0)&&s[Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE]&&(this.namespace=Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE);let o=this.getAddressFromSession(e.session);return o&&(yield this.loginAccount({address:o,signature:e.signature})),""})}handleTopicUpdateEvent({topic:e}){var t;return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{if(this.address&&!this.isInitializing&&this.pairings)if(((t=this.pairings)===null||t===void 0?void 0:t.length)===0)this.onClientConnect.onClientLogout();else{let i=this.pairings[this.pairings.length-1];i?.topic===e&&this.onClientConnect.onClientLogout()}}catch{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleTopic)}finally{this.pairings=this.walletConnector.core.pairing.pairings.getAll({active:!0})}})}handleSessionEvents({topic:e,params:t}){return Yt(this,void 0,void 0,function*(){if(typeof this.walletConnector>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);let{event:i}=t;if(i?.name&&this.getCurrentTopic(this.walletConnector)===e){let n=i.data;this.onClientConnect.onClientEvent(n)}})}subscribeToEvents(e){var t,i,n,s;return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);try{e.on("session_update",({topic:o,params:a})=>{let{namespaces:u}=a,h=e.session.get(o),p=Object.assign(Object.assign({},h),{namespaces:u});this.onSessionConnected({session:p})}),e.on("session_event",this.handleSessionEvents.bind(this)),e.on("session_delete",()=>{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionDeleted),this.onClientConnect.onClientLogout()}),e.on("session_expire",()=>{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionExpired),this.onClientConnect.onClientLogout()}),(i=(t=e?.core)===null||t===void 0?void 0:t.pairing)===null||i===void 0||i.events.on("pairing_delete",this.handleTopicUpdateEvent.bind(this)),(s=(n=e?.core)===null||n===void 0?void 0:n.pairing)===null||s===void 0||s.events.on("pairing_expire",this.handleTopicUpdateEvent.bind(this))}catch{Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.unableToHandleEvent)}})}checkPersistedState(e){return Yt(this,void 0,void 0,function*(){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(this.pairings=e.pairing.getAll({active:!0}),!(typeof this.session<"u")&&e.session.length&&!this.address&&!this.isInitializing){let t=this.getCurrentSession(e);if(t)return yield this.onSessionConnected({session:t}),t}})}getCurrentSession(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t])}else throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}getCurrentTopic(e){if(typeof e>"u")throw new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.notInitialized);if(e.session.length){let t=e.session.keys.length-1;return e.session.get(e.session.keys[t]).topic}else throw Fe.Logger.error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected),this.onClientConnect.onClientLogout(),new Error(pe.WalletConnectV2ProviderErrorMessagesEnum.sessionNotConnected)}addressIsValid(e){try{return!!lp.UserAddress.fromBech32(e)}catch{return!1}}getAddressFromSession(e){var t;let i=e.namespaces[(t=this.namespace)!==null&&t!==void 0?t:Ke.WALLETCONNECT_MULTIVERSX_NAMESPACE];if(i&&i.accounts){let n=i.accounts[0],[s,o,a]=n.split(":");return a}return""}};Fi.WalletConnectV2Provider=dv});var fD=B((wre,lD)=>{"use strict";f();lD.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),i=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[t]=n;for(t 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]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var pD=B((Ere,dD)=>{"use strict";f();var hD=typeof Symbol<"u"&&Symbol,G9=fD();dD.exports=function(){return typeof hD!="function"||typeof Symbol!="function"||typeof hD("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:G9()}});var yD=B((Ire,gD)=>{"use strict";f();var K9="Function.prototype.bind called on incompatible ",pv=Array.prototype.slice,z9=Object.prototype.toString,k9="[object Function]";gD.exports=function(e){var t=this;if(typeof t!="function"||z9.call(t)!==k9)throw new TypeError(K9+t);for(var i=pv.call(arguments,1),n,s=function(){if(this instanceof n){var p=t.apply(this,i.concat(pv.call(arguments)));return Object(p)===p?p:this}else return t.apply(e,i.concat(pv.call(arguments)))},o=Math.max(0,t.length-i.length),a=[],u=0;u{"use strict";f();var W9=yD();mD.exports=Function.prototype.bind||W9});var vD=B((Sre,wD)=>{"use strict";f();var $9=fp();wD.exports=$9.call(Function.call,Object.prototype.hasOwnProperty)});var pp=B((Tre,bD)=>{"use strict";f();var Me,Cu=SyntaxError,_D=Function,bu=TypeError,gv=function(r){try{return _D('"use strict"; return ('+r+").constructor;")()}catch{}},co=Object.getOwnPropertyDescriptor;if(co)try{co({},"")}catch{co=null}var yv=function(){throw new bu},Y9=co?function(){try{return arguments.callee,yv}catch{try{return co(arguments,"callee").get}catch{return yv}}}():yv,Iu=pD()(),Ui=Object.getPrototypeOf||function(r){return r.__proto__},_u={},J9=typeof Uint8Array>"u"?Me:Ui(Uint8Array),lo={"%AggregateError%":typeof AggregateError>"u"?Me:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Me:ArrayBuffer,"%ArrayIteratorPrototype%":Iu?Ui([][Symbol.iterator]()):Me,"%AsyncFromSyncIteratorPrototype%":Me,"%AsyncFunction%":_u,"%AsyncGenerator%":_u,"%AsyncGeneratorFunction%":_u,"%AsyncIteratorPrototype%":_u,"%Atomics%":typeof Atomics>"u"?Me:Atomics,"%BigInt%":typeof BigInt>"u"?Me:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Me:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Me:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Me:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Me:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Me:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Me:FinalizationRegistry,"%Function%":_D,"%GeneratorFunction%":_u,"%Int8Array%":typeof Int8Array>"u"?Me:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Me:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Me:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Iu?Ui(Ui([][Symbol.iterator]())):Me,"%JSON%":typeof JSON=="object"?JSON:Me,"%Map%":typeof Map>"u"?Me:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Iu?Me:Ui(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Me:Promise,"%Proxy%":typeof Proxy>"u"?Me:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Me:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Me:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Iu?Me:Ui(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Me:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Iu?Ui(""[Symbol.iterator]()):Me,"%Symbol%":Iu?Symbol:Me,"%SyntaxError%":Cu,"%ThrowTypeError%":Y9,"%TypedArray%":J9,"%TypeError%":bu,"%Uint8Array%":typeof Uint8Array>"u"?Me:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Me:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Me:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Me:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Me:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Me:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Me:WeakSet};try{null.error}catch(r){ED=Ui(Ui(r)),lo["%Error.prototype%"]=ED}var ED,X9=function r(e){var t;if(e==="%AsyncFunction%")t=gv("async function () {}");else if(e==="%GeneratorFunction%")t=gv("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=gv("async function* () {}");else if(e==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(t=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&(t=Ui(n.prototype))}return lo[e]=t,t},AD={"%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"]},pl=fp(),hp=vD(),Z9=pl.call(Function.call,Array.prototype.concat),ej=pl.call(Function.apply,Array.prototype.splice),ID=pl.call(Function.call,String.prototype.replace),dp=pl.call(Function.call,String.prototype.slice),tj=pl.call(Function.call,RegExp.prototype.exec),rj=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ij=/\\(\\)?/g,nj=function(e){var t=dp(e,0,1),i=dp(e,-1);if(t==="%"&&i!=="%")throw new Cu("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&t!=="%")throw new Cu("invalid intrinsic syntax, expected opening `%`");var n=[];return ID(e,rj,function(s,o,a,u){n[n.length]=a?ID(u,ij,"$1"):o||s}),n},sj=function(e,t){var i=e,n;if(hp(AD,i)&&(n=AD[i],i="%"+n[0]+"%"),hp(lo,i)){var s=lo[i];if(s===_u&&(s=X9(i)),typeof s>"u"&&!t)throw new bu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Cu("intrinsic "+e+" does not exist!")};bD.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new bu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new bu('"allowMissing" argument must be a boolean');if(tj(/^%?[^%]*%?$/,e)===null)throw new Cu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=nj(e),n=i.length>0?i[0]:"",s=sj("%"+n+"%",t),o=s.name,a=s.value,u=!1,h=s.alias;h&&(n=h[0],ej(i,Z9([0,1],h)));for(var p=1,w=!0;p=i.length){var V=co(a,N);w=!!V,w&&"get"in V&&!("originalValue"in V.get)?a=V.get:a=a[N]}else w=hp(a,N),a=a[N];w&&!u&&(lo[o]=a)}}return a}});var DD=B((Dre,gp)=>{"use strict";f();var mv=fp(),Su=pp(),xD=Su("%Function.prototype.apply%"),TD=Su("%Function.prototype.call%"),ND=Su("%Reflect.apply%",!0)||mv.call(TD,xD),CD=Su("%Object.getOwnPropertyDescriptor%",!0),fo=Su("%Object.defineProperty%",!0),oj=Su("%Math.max%");if(fo)try{fo({},"a",{value:1})}catch{fo=null}gp.exports=function(e){var t=ND(mv,TD,arguments);if(CD&&fo){var i=CD(t,"length");i.configurable&&fo(t,"length",{value:1+oj(0,e.length-(arguments.length-1))})}return t};var SD=function(){return ND(mv,xD,arguments)};fo?fo(gp.exports,"apply",{value:SD}):gp.exports.apply=SD});var MD=B((Pre,BD)=>{"use strict";f();var OD=pp(),PD=DD(),aj=PD(OD("String.prototype.indexOf"));BD.exports=function(e,t){var i=OD(e,!!t);return typeof i=="function"&&aj(e,".prototype.")>-1?PD(i):i}});var RD=B(()=>{f()});var tO=B((Fre,eO)=>{f();var xv=typeof Map=="function"&&Map.prototype,wv=Object.getOwnPropertyDescriptor&&xv?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,mp=xv&&wv&&typeof wv.get=="function"?wv.get:null,LD=xv&&Map.prototype.forEach,Tv=typeof Set=="function"&&Set.prototype,vv=Object.getOwnPropertyDescriptor&&Tv?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,wp=Tv&&vv&&typeof vv.get=="function"?vv.get:null,FD=Tv&&Set.prototype.forEach,uj=typeof WeakMap=="function"&&WeakMap.prototype,yl=uj?WeakMap.prototype.has:null,cj=typeof WeakSet=="function"&&WeakSet.prototype,ml=cj?WeakSet.prototype.has:null,lj=typeof WeakRef=="function"&&WeakRef.prototype,UD=lj?WeakRef.prototype.deref:null,fj=Boolean.prototype.valueOf,hj=Object.prototype.toString,dj=Function.prototype.toString,pj=String.prototype.match,Nv=String.prototype.slice,Xn=String.prototype.replace,gj=String.prototype.toUpperCase,qD=String.prototype.toLowerCase,WD=RegExp.prototype.test,VD=Array.prototype.concat,qi=Array.prototype.join,yj=Array.prototype.slice,HD=Math.floor,Iv=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ev=Object.getOwnPropertySymbols,_v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,xu=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hr=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===xu||"symbol")?Symbol.toStringTag:null,$D=Object.prototype.propertyIsEnumerable,QD=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function jD(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||WD.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-HD(-r):HD(r);if(i!==r){var n=String(i),s=Nv.call(e,n.length+1);return Xn.call(n,t,"$&_")+"."+Xn.call(Xn.call(s,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Xn.call(e,t,"$&_")}var bv=RD(),GD=bv.custom,KD=JD(GD)?GD:null;eO.exports=function r(e,t,i,n){var s=t||{};if(Jn(s,"quoteStyle")&&s.quoteStyle!=="single"&&s.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Jn(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=Jn(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(Jn(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(Jn(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 ZD(e,s);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var u=String(e);return a?jD(e,u):u}if(typeof e=="bigint"){var h=String(e)+"n";return a?jD(e,h):h}var p=typeof s.depth>"u"?5:s.depth;if(typeof i>"u"&&(i=0),i>=p&&p>0&&typeof e=="object")return Cv(e)?"[Array]":"[Object]";var w=Mj(s,i);if(typeof n>"u")n=[];else if(XD(n,e)>=0)return"[Circular]";function N(A,c,d){if(c&&(n=yj.call(n),n.push(c)),d){var g={depth:s.depth};return Jn(s,"quoteStyle")&&(g.quoteStyle=s.quoteStyle),r(A,g,i+1,n)}return r(A,s,i+1,n)}if(typeof e=="function"&&!zD(e)){var O=Cj(e),T=yp(e,N);return"[Function"+(O?": "+O:" (anonymous)")+"]"+(T.length>0?" { "+qi.call(T,", ")+" }":"")}if(JD(e)){var V=xu?Xn.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):_v.call(e);return typeof e=="object"&&!xu?gl(V):V}if(Oj(e)){for(var z="<"+qD.call(String(e.nodeName)),$=e.attributes||[],se=0;se<$.length;se++)z+=" "+$[se].name+"="+YD(mj($[se].value),"double",s);return z+=">",e.childNodes&&e.childNodes.length&&(z+="..."),z+="",z}if(Cv(e)){if(e.length===0)return"[]";var Y=yp(e,N);return w&&!Bj(Y)?"["+Sv(Y,w)+"]":"[ "+qi.call(Y,", ")+" ]"}if(vj(e)){var j=yp(e,N);return!("cause"in Error.prototype)&&"cause"in e&&!$D.call(e,"cause")?"{ ["+String(e)+"] "+qi.call(VD.call("[cause]: "+N(e.cause),j),", ")+" }":j.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+qi.call(j,", ")+" }"}if(typeof e=="object"&&o){if(KD&&typeof e[KD]=="function"&&bv)return bv(e,{depth:p-i});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Sj(e)){var W=[];return LD&&LD.call(e,function(A,c){W.push(N(c,e,!0)+" => "+N(A,e))}),kD("Map",mp.call(e),W,w)}if(Nj(e)){var k=[];return FD&&FD.call(e,function(A){k.push(N(A,e))}),kD("Set",wp.call(e),k,w)}if(xj(e))return Av("WeakMap");if(Dj(e))return Av("WeakSet");if(Tj(e))return Av("WeakRef");if(Aj(e))return gl(N(Number(e)));if(_j(e))return gl(N(Iv.call(e)));if(Ij(e))return gl(fj.call(e));if(Ej(e))return gl(N(String(e)));if(!wj(e)&&!zD(e)){var R=yp(e,N),F=QD?QD(e)===Object.prototype:e instanceof Object||e.constructor===Object,G=e instanceof Object?"":"null prototype",ce=!F&&hr&&Object(e)===e&&hr in e?Nv.call(Zn(e),8,-1):G?"Object":"",J=F||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",X=J+(ce||G?"["+qi.call(VD.call([],ce||[],G||[]),": ")+"] ":"");return R.length===0?X+"{}":w?X+"{"+Sv(R,w)+"}":X+"{ "+qi.call(R,", ")+" }"}return String(e)};function YD(r,e,t){var i=(t.quoteStyle||e)==="double"?'"':"'";return i+r+i}function mj(r){return Xn.call(String(r),/"/g,""")}function Cv(r){return Zn(r)==="[object Array]"&&(!hr||!(typeof r=="object"&&hr in r))}function wj(r){return Zn(r)==="[object Date]"&&(!hr||!(typeof r=="object"&&hr in r))}function zD(r){return Zn(r)==="[object RegExp]"&&(!hr||!(typeof r=="object"&&hr in r))}function vj(r){return Zn(r)==="[object Error]"&&(!hr||!(typeof r=="object"&&hr in r))}function Ej(r){return Zn(r)==="[object String]"&&(!hr||!(typeof r=="object"&&hr in r))}function Aj(r){return Zn(r)==="[object Number]"&&(!hr||!(typeof r=="object"&&hr in r))}function Ij(r){return Zn(r)==="[object Boolean]"&&(!hr||!(typeof r=="object"&&hr in r))}function JD(r){if(xu)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!_v)return!1;try{return _v.call(r),!0}catch{}return!1}function _j(r){if(!r||typeof r!="object"||!Iv)return!1;try{return Iv.call(r),!0}catch{}return!1}var bj=Object.prototype.hasOwnProperty||function(r){return r in this};function Jn(r,e){return bj.call(r,e)}function Zn(r){return hj.call(r)}function Cj(r){if(r.name)return r.name;var e=pj.call(dj.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function XD(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;te.maxStringLength){var t=r.length-e.maxStringLength,i="... "+t+" more character"+(t>1?"s":"");return ZD(Nv.call(r,0,e.maxStringLength),e)+i}var n=Xn.call(Xn.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Pj);return YD(n,"single",e)}function Pj(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+gj.call(e.toString(16))}function gl(r){return"Object("+r+")"}function Av(r){return r+" { ? }"}function kD(r,e,t,i){var n=i?Sv(t,i):qi.call(t,", ");return r+" ("+e+") {"+n+"}"}function Bj(r){for(var e=0;e=0)return!1;return!0}function Mj(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=qi.call(Array(r.indent+1)," ");else return null;return{base:t,prev:qi.call(Array(e+1),t)}}function Sv(r,e){if(r.length===0)return"";var t=` +`+e.prev+e.base;return t+qi.call(r,","+t)+` +`+e.prev}function yp(r,e){var t=Cv(r),i=[];if(t){i.length=r.length;for(var n=0;n{"use strict";f();var Dv=pp(),Tu=MD(),Rj=tO(),Lj=Dv("%TypeError%"),vp=Dv("%WeakMap%",!0),Ep=Dv("%Map%",!0),Fj=Tu("WeakMap.prototype.get",!0),Uj=Tu("WeakMap.prototype.set",!0),qj=Tu("WeakMap.prototype.has",!0),Vj=Tu("Map.prototype.get",!0),Hj=Tu("Map.prototype.set",!0),Qj=Tu("Map.prototype.has",!0),Ov=function(r,e){for(var t=r,i;(i=t.next)!==null;t=i)if(i.key===e)return t.next=i.next,i.next=r.next,r.next=i,i},jj=function(r,e){var t=Ov(r,e);return t&&t.value},Gj=function(r,e,t){var i=Ov(r,e);i?i.value=t:r.next={key:e,next:r.next,value:t}},Kj=function(r,e){return!!Ov(r,e)};rO.exports=function(){var e,t,i,n={assert:function(s){if(!n.has(s))throw new Lj("Side channel does not contain "+Rj(s))},get:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Fj(e,s)}else if(Ep){if(t)return Vj(t,s)}else if(i)return jj(i,s)},has:function(s){if(vp&&s&&(typeof s=="object"||typeof s=="function")){if(e)return qj(e,s)}else if(Ep){if(t)return Qj(t,s)}else if(i)return Kj(i,s);return!1},set:function(s,o){vp&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new vp),Uj(e,s,o)):Ep?(t||(t=new Ep),Hj(t,s,o)):(i||(i={key:{},next:null}),Gj(i,s,o))}};return n}});var Ap=B((Hre,nO)=>{"use strict";f();var zj=String.prototype.replace,kj=/%20/g,Pv={RFC1738:"RFC1738",RFC3986:"RFC3986"};nO.exports={default:Pv.RFC3986,formatters:{RFC1738:function(r){return zj.call(r,kj,"+")},RFC3986:function(r){return String(r)}},RFC1738:Pv.RFC1738,RFC3986:Pv.RFC3986}});var Mv=B((jre,oO)=>{"use strict";f();var Wj=Ap(),Bv=Object.prototype.hasOwnProperty,ho=Array.isArray,Vi=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),$j=function(e){for(;e.length>1;){var t=e.pop(),i=t.obj[t.prop];if(ho(i)){for(var n=[],s=0;s=48&&h<=57||h>=65&&h<=90||h>=97&&h<=122||s===Wj.RFC1738&&(h===40||h===41)){a+=o.charAt(u);continue}if(h<128){a=a+Vi[h];continue}if(h<2048){a=a+(Vi[192|h>>6]+Vi[128|h&63]);continue}if(h<55296||h>=57344){a=a+(Vi[224|h>>12]+Vi[128|h>>6&63]+Vi[128|h&63]);continue}u+=1,h=65536+((h&1023)<<10|o.charCodeAt(u)&1023),a+=Vi[240|h>>18]+Vi[128|h>>12&63]+Vi[128|h>>6&63]+Vi[128|h&63]}return a},eG=function(e){for(var t=[{obj:{o:e},prop:"o"}],i=[],n=0;n{"use strict";f();var cO=iO(),Lv=Mv(),wl=Ap(),sG=Object.prototype.hasOwnProperty,aO={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},po=Array.isArray,oG=String.prototype.split,aG=Array.prototype.push,lO=function(r,e){aG.apply(r,po(e)?e:[e])},uG=Date.prototype.toISOString,uO=wl.default,rr={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Lv.encode,encodeValuesOnly:!1,format:uO,formatter:wl.formatters[uO],indices:!1,serializeDate:function(e){return uG.call(e)},skipNulls:!1,strictNullHandling:!1},cG=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Rv={},lG=function r(e,t,i,n,s,o,a,u,h,p,w,N,O,T,V){for(var z=e,$=V,se=0,Y=!1;($=$.get(Rv))!==void 0&&!Y;){var j=$.get(e);if(se+=1,typeof j<"u"){if(j===se)throw new RangeError("Cyclic object value");Y=!0}typeof $.get(Rv)>"u"&&(se=0)}if(typeof a=="function"?z=a(t,z):z instanceof Date?z=p(z):i==="comma"&&po(z)&&(z=Lv.maybeMap(z,function(m){return m instanceof Date?p(m):m})),z===null){if(n)return o&&!O?o(t,rr.encoder,T,"key",w):t;z=""}if(cG(z)||Lv.isBuffer(z)){if(o){var W=O?t:o(t,rr.encoder,T,"key",w);if(i==="comma"&&O){for(var k=oG.call(String(z),","),R="",F=0;F"u")return G;var ce;if(i==="comma"&&po(z))ce=[{value:z.length>0?z.join(",")||null:void 0}];else if(po(a))ce=a;else{var J=Object.keys(z);ce=u?J.sort(u):J}for(var X=0;X"u"?rr.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:rr.charsetSentinel,delimiter:typeof e.delimiter>"u"?rr.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:rr.encode,encoder:typeof e.encoder=="function"?e.encoder:rr.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:rr.encodeValuesOnly,filter:s,format:i,formatter:n,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:rr.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:rr.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:rr.strictNullHandling}};fO.exports=function(r,e){var t=r,i=fG(e),n,s;typeof i.filter=="function"?(s=i.filter,t=s("",t)):po(i.filter)&&(s=i.filter,n=s);var o=[];if(typeof t!="object"||t===null)return"";var a;e&&e.arrayFormat in aO?a=e.arrayFormat:e&&"indices"in e?a=e.indices?"indices":"repeat":a="indices";var u=aO[a];n||(n=Object.keys(t)),i.sort&&n.sort(i.sort);for(var h=cO(),p=0;p0?O+N:""}});var gO=B((kre,pO)=>{"use strict";f();var Nu=Mv(),Fv=Object.prototype.hasOwnProperty,hG=Array.isArray,Jt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Nu.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},dG=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},dO=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},pG="utf8=%26%2310003%3B",gG="utf8=%E2%9C%93",yG=function(e,t){var i={},n=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,s=t.parameterLimit===1/0?void 0:t.parameterLimit,o=n.split(t.delimiter,s),a=-1,u,h=t.charset;if(t.charsetSentinel)for(u=0;u-1&&(T=hG(T)?[T]:T),Fv.call(i,O)?i[O]=Nu.combine(i[O],T):i[O]=T}return i},mG=function(r,e,t,i){for(var n=i?e:dO(e,t),s=r.length-1;s>=0;--s){var o,a=r[s];if(a==="[]"&&t.parseArrays)o=[].concat(n);else{o=t.plainObjects?Object.create(null):{};var u=a.charAt(0)==="["&&a.charAt(a.length-1)==="]"?a.slice(1,-1):a,h=parseInt(u,10);!t.parseArrays&&u===""?o={0:n}:!isNaN(h)&&a!==u&&String(h)===u&&h>=0&&t.parseArrays&&h<=t.arrayLimit?(o=[],o[h]=n):u!=="__proto__"&&(o[u]=n)}n=o}return n},wG=function(e,t,i,n){if(e){var s=i.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,u=i.depth>0&&o.exec(s),h=u?s.slice(0,u.index):s,p=[];if(h){if(!i.plainObjects&&Fv.call(Object.prototype,h)&&!i.allowPrototypes)return;p.push(h)}for(var w=0;i.depth>0&&(u=a.exec(s))!==null&&w"u"?Jt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?Jt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:Jt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:Jt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:Jt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Jt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:Jt.comma,decoder:typeof e.decoder=="function"?e.decoder:Jt.decoder,delimiter:typeof e.delimiter=="string"||Nu.isRegExp(e.delimiter)?e.delimiter:Jt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:Jt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:Jt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:Jt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:Jt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Jt.strictNullHandling}};pO.exports=function(r,e){var t=vG(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var i=typeof r=="string"?yG(r,t):r,n=t.plainObjects?Object.create(null):{},s=Object.keys(i),o=0;o{"use strict";f();var EG=hO(),AG=gO(),IG=Ap();yO.exports={formats:IG,parse:AG,stringify:EG}});var Uv=B(ht=>{"use strict";f();Object.defineProperty(ht,"__esModule",{value:!0});ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED=ht.WALLET_PROVIDER_CALLBACK_PARAM=ht.WALLET_PROVIDER_SIGN_MESSAGE_URL=ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL=ht.WALLET_PROVIDER_SEND_TRANSACTION_URL=ht.WALLET_PROVIDER_DISCONNECT_URL=ht.WALLET_PROVIDER_CONNECT_URL=ht.WALLET_PROVIDER_TESTNET=ht.WALLET_PROVIDER_DEVNET=ht.WALLET_PROVIDER_MAINNET=void 0;ht.WALLET_PROVIDER_MAINNET="https://wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_DEVNET="https://devnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_TESTNET="https://testnet-wallet.multiversx.com/dapp/init";ht.WALLET_PROVIDER_CONNECT_URL="hook/login";ht.WALLET_PROVIDER_DISCONNECT_URL="hook/logout";ht.WALLET_PROVIDER_SEND_TRANSACTION_URL="hook/transaction";ht.WALLET_PROVIDER_SIGN_TRANSACTION_URL="hook/sign";ht.WALLET_PROVIDER_SIGN_MESSAGE_URL="hook/sign-message";ht.WALLET_PROVIDER_CALLBACK_PARAM="walletProviderStatus";ht.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED="transactionsSigned"});var wO=B(Du=>{"use strict";f();Object.defineProperty(Du,"__esModule",{value:!0});Du.ErrInvalidTxSignReturnValue=Du.Err=void 0;var Ip=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Du.Err=Ip;var qv=class extends Ip{constructor(){super("Invalid response in transaction sign return url")}};Du.ErrInvalidTxSignReturnValue=qv});var vO=B(_p=>{"use strict";f();Object.defineProperty(_p,"__esModule",{value:!0});_p.PlainSignedTransaction=void 0;var Vv=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.options=void 0,this.signature="",Object.assign(this,e)}};_p.PlainSignedTransaction=Vv});var vl=B(es=>{"use strict";f();var go=es&&es.__awaiter||function(r,e,t,i){function n(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(p){try{h(i.next(p))}catch(w){o(w)}}function u(p){try{h(i.throw(p))}catch(w){o(w)}}function h(p){p.done?s(p.value):n(p.value).then(a,u)}h((i=i.apply(r,e||[])).next())})},_G=es&&es.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(es,"__esModule",{value:!0});es.WalletProvider=void 0;var EO=_G(mO()),yo=Uv(),AO=wO(),bG=vO(),Ou=class{constructor(e){this.walletUrl=e}login(e){return go(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_CONNECT_URL,callbackUrl:e?.callbackUrl,params:{token:e?.token}});return yield this.redirect(t,e?.redirectDelayMilliseconds),t})}redirect(e,t){return go(this,void 0,void 0,function*(){t?yield this.redirectLater(e,t):this.redirectImmediately(e)})}redirectImmediately(e){window.location.href=e}redirectLater(e,t){return go(this,void 0,void 0,function*(){yield new Promise(i=>{setTimeout(()=>{window.location.href=e,i(!0)},t)})})}logout(e){return go(this,void 0,void 0,function*(){let t=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_DISCONNECT_URL,callbackUrl:e?.callbackUrl});return yield this.redirect(t,e?.redirectDelayMilliseconds),!0})}signMessage(e,t){return go(this,void 0,void 0,function*(){let i=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_SIGN_MESSAGE_URL,callbackUrl:t?.callbackUrl,params:{message:e}});return yield this.redirect(i),i})}signTransactions(e,t){return go(this,void 0,void 0,function*(){let i={};e.map(s=>{let o=Ou.prepareWalletTransaction(s);for(let a in o)o.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(i[a]=[]),i[a].push(o[a])});let n=this.buildWalletUrl({endpoint:yo.WALLET_PROVIDER_SIGN_TRANSACTION_URL,callbackUrl:t?.callbackUrl,params:i});window.location.href=n})}signTransaction(e,t){return go(this,void 0,void 0,function*(){yield this.signTransactions([e],t)})}getTransactionsFromWalletUrl(){let e=EO.default.parse(window.location.search.slice(1));return Ou.isTxSignReturnSuccess(e)?this.getTxSignReturnValue(e):[]}static isTxSignReturnSuccess(e){return e.hasOwnProperty(yo.WALLET_PROVIDER_CALLBACK_PARAM)&&e[yo.WALLET_PROVIDER_CALLBACK_PARAM]===yo.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED}getTxSignReturnValue(e){var t;console.info(`Received urlParams: ${e}`);let i=["nonce","value","receiver","sender","gasPrice","gasLimit","chainID","version","signature"];for(let o of i)if(!e[o]||!Array.isArray(e[o]))throw new AO.ErrInvalidTxSignReturnValue;let n=e.nonce.length;for(let o of i)if(e[o].length!==n)throw new AO.ErrInvalidTxSignReturnValue;let s=[];for(let o=0;o{f()});var TO=B((xO,Hv)=>{f();(function(r,e){"use strict";function t(A,c){if(!A)throw new Error(c||"Assertion failed")}function i(A,c){A.super_=c;var d=function(){};d.prototype=c.prototype,A.prototype=new d,A.prototype.constructor=A}function n(A,c,d){if(n.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,A!==null&&((c==="le"||c==="be")&&(d=c,c=10),this._init(A||0,c||10,d||"be"))}typeof r=="object"?r.exports=n:e.BN=n,n.BN=n,n.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=SO().Buffer}catch{}n.isBN=function(c){return c instanceof n?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===n.wordSize&&Array.isArray(c.words)},n.max=function(c,d){return c.cmp(d)>0?c:d},n.min=function(c,d){return c.cmp(d)<0?c:d},n.prototype._init=function(c,d,g){if(typeof c=="number")return this._initNumber(c,d,g);if(typeof c=="object")return this._initArray(c,d,g);d==="hex"&&(d=16),t(d===(d|0)&&d>=2&&d<=36),c=c.toString().replace(/\s+/g,"");var m=0;c[0]==="-"&&(m++,this.negative=1),m=0;m-=3)S=c[m]|c[m-1]<<8|c[m-2]<<16,this.words[v]|=S<>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);else if(g==="le")for(m=0,v=0;m>>26-D&67108863,D+=24,D>=26&&(D-=26,v++);return this._strip()};function o(A,c){var d=A.charCodeAt(c);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;t(!1,"Invalid character in "+A)}function a(A,c,d){var g=o(A,d);return d-1>=c&&(g|=o(A,d-1)<<4),g}n.prototype._parseHex=function(c,d,g){this.length=Math.ceil((c.length-d)/6),this.words=new Array(this.length);for(var m=0;m=d;m-=2)D=a(c,d,m)<=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8;else{var I=c.length-d;for(m=I%2===0?d+1:d;m=18?(v-=18,S+=1,this.words[S]|=D>>>26):v+=8}this._strip()};function u(A,c,d,g){for(var m=0,v=0,S=Math.min(A.length,d),D=c;D=49?v=I-49+10:I>=17?v=I-17+10:v=I,t(I>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=p}catch{n.prototype.inspect=p}else n.prototype.inspect=p;function p(){return(this.red?""}var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],N=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],O=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(c,d){c=c||10,d=d|0||1;var g;if(c===16||c==="hex"){g="";for(var m=0,v=0,S=0;S>>24-m&16777215,m+=2,m>=26&&(m-=26,S--),v!==0||S!==this.length-1?g=w[6-I.length]+I+g:g=I+g}for(v!==0&&(g=v.toString(16)+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var l=N[c],C=O[c];g="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var ie=Z.modrn(C).toString(c);Z=Z.idivn(C),Z.isZero()?g=ie+g:g=w[l-ie.length]+ie+g}for(this.isZero()&&(g="0"+g);g.length%d!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}t(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},n.prototype.toJSON=function(){return this.toString(16,2)},s&&(n.prototype.toBuffer=function(c,d){return this.toArrayLike(s,c,d)}),n.prototype.toArray=function(c,d){return this.toArrayLike(Array,c,d)};var T=function(c,d){return c.allocUnsafe?c.allocUnsafe(d):new c(d)};n.prototype.toArrayLike=function(c,d,g){this._strip();var m=this.byteLength(),v=g||Math.max(1,m);t(m<=v,"byte array longer than desired length"),t(v>0,"Requested array length <= 0");var S=T(c,v),D=d==="le"?"LE":"BE";return this["_toArrayLike"+D](S,m),S},n.prototype._toArrayLikeLE=function(c,d){for(var g=0,m=0,v=0,S=0;v>8&255),g>16&255),S===6?(g>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g=0&&(c[g--]=D>>8&255),g>=0&&(c[g--]=D>>16&255),S===6?(g>=0&&(c[g--]=D>>24&255),m=0,S=0):(m=D>>>24,S+=2)}if(g>=0)for(c[g--]=m;g>=0;)c[g--]=0},Math.clz32?n.prototype._countBits=function(c){return 32-Math.clz32(c)}:n.prototype._countBits=function(c){var d=c,g=0;return d>=4096&&(g+=13,d>>>=13),d>=64&&(g+=7,d>>>=7),d>=8&&(g+=4,d>>>=4),d>=2&&(g+=2,d>>>=2),g+d},n.prototype._zeroBits=function(c){if(c===0)return 26;var d=c,g=0;return d&8191||(g+=13,d>>>=13),d&127||(g+=7,d>>>=7),d&15||(g+=4,d>>>=4),d&3||(g+=2,d>>>=2),d&1||g++,g},n.prototype.bitLength=function(){var c=this.words[this.length-1],d=this._countBits(c);return(this.length-1)*26+d};function V(A){for(var c=new Array(A.bitLength()),d=0;d>>m&1}return c}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,d=0;dc.length?this.clone().ior(c):c.clone().ior(this)},n.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},n.prototype.iuand=function(c){var d;this.length>c.length?d=c:d=this;for(var g=0;gc.length?this.clone().iand(c):c.clone().iand(this)},n.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},n.prototype.iuxor=function(c){var d,g;this.length>c.length?(d=this,g=c):(d=c,g=this);for(var m=0;mc.length?this.clone().ixor(c):c.clone().ixor(this)},n.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},n.prototype.inotn=function(c){t(typeof c=="number"&&c>=0);var d=Math.ceil(c/26)|0,g=c%26;this._expand(d),g>0&&d--;for(var m=0;m0&&(this.words[m]=~this.words[m]&67108863>>26-g),this._strip()},n.prototype.notn=function(c){return this.clone().inotn(c)},n.prototype.setn=function(c,d){t(typeof c=="number"&&c>=0);var g=c/26|0,m=c%26;return this._expand(g+1),d?this.words[g]=this.words[g]|1<c.length?(g=this,m=c):(g=c,m=this);for(var v=0,S=0;S>>26;for(;v!==0&&S>>26;if(this.length=g.length,v!==0)this.words[this.length]=v,this.length++;else if(g!==this)for(;Sc.length?this.clone().iadd(c):c.clone().iadd(this)},n.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var d=this.iadd(c);return c.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,v;g>0?(m=this,v=c):(m=c,v=this);for(var S=0,D=0;D>26,this.words[D]=d&67108863;for(;S!==0&&D>26,this.words[D]=d&67108863;if(S===0&&D>>26,Z=I&67108863,ie=Math.min(l,c.length-1),ee=Math.max(0,l-A.length+1);ee<=ie;ee++){var ae=l-ee|0;m=A.words[ae]|0,v=c.words[ee]|0,S=m*v+Z,C+=S/67108864|0,Z=S&67108863}d.words[l]=Z|0,I=C|0}return I!==0?d.words[l]=I|0:d.length--,d._strip()}var $=function(c,d,g){var m=c.words,v=d.words,S=g.words,D=0,I,l,C,Z=m[0]|0,ie=Z&8191,ee=Z>>>13,ae=m[1]|0,E=ae&8191,b=ae>>>13,x=m[2]|0,L=x&8191,P=x>>>13,U=m[3]|0,q=U&8191,M=U>>>13,Q=m[4]|0,K=Q&8191,H=Q>>>13,ue=m[5]|0,he=ue&8191,de=ue>>>13,Re=m[6]|0,be=Re&8191,xe=Re>>>13,Be=m[7]|0,Ie=Be&8191,Pe=Be>>>13,us=m[8]|0,Ze=us&8191,et=us>>>13,Ar=m[9]|0,ze=Ar&8191,Ue=Ar>>>13,jt=v[0]|0,Ce=jt&8191,mt=jt>>>13,vE=v[1]|0,wt=vE&8191,vt=vE>>>13,EE=v[2]|0,Et=EE&8191,At=EE>>>13,AE=v[3]|0,It=AE&8191,_t=AE>>>13,IE=v[4]|0,bt=IE&8191,Ct=IE>>>13,_E=v[5]|0,St=_E&8191,xt=_E>>>13,bE=v[6]|0,Tt=bE&8191,Nt=bE>>>13,CE=v[7]|0,Dt=CE&8191,Ot=CE>>>13,SE=v[8]|0,Pt=SE&8191,Bt=SE>>>13,xE=v[9]|0,Mt=xE&8191,Rt=xE>>>13;g.negative=c.negative^d.negative,g.length=19,I=Math.imul(ie,Ce),l=Math.imul(ie,mt),l=l+Math.imul(ee,Ce)|0,C=Math.imul(ee,mt);var Yp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Yp>>>26)|0,Yp&=67108863,I=Math.imul(E,Ce),l=Math.imul(E,mt),l=l+Math.imul(b,Ce)|0,C=Math.imul(b,mt),I=I+Math.imul(ie,wt)|0,l=l+Math.imul(ie,vt)|0,l=l+Math.imul(ee,wt)|0,C=C+Math.imul(ee,vt)|0;var Jp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Jp>>>26)|0,Jp&=67108863,I=Math.imul(L,Ce),l=Math.imul(L,mt),l=l+Math.imul(P,Ce)|0,C=Math.imul(P,mt),I=I+Math.imul(E,wt)|0,l=l+Math.imul(E,vt)|0,l=l+Math.imul(b,wt)|0,C=C+Math.imul(b,vt)|0,I=I+Math.imul(ie,Et)|0,l=l+Math.imul(ie,At)|0,l=l+Math.imul(ee,Et)|0,C=C+Math.imul(ee,At)|0;var Xp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Xp>>>26)|0,Xp&=67108863,I=Math.imul(q,Ce),l=Math.imul(q,mt),l=l+Math.imul(M,Ce)|0,C=Math.imul(M,mt),I=I+Math.imul(L,wt)|0,l=l+Math.imul(L,vt)|0,l=l+Math.imul(P,wt)|0,C=C+Math.imul(P,vt)|0,I=I+Math.imul(E,Et)|0,l=l+Math.imul(E,At)|0,l=l+Math.imul(b,Et)|0,C=C+Math.imul(b,At)|0,I=I+Math.imul(ie,It)|0,l=l+Math.imul(ie,_t)|0,l=l+Math.imul(ee,It)|0,C=C+Math.imul(ee,_t)|0;var Zp=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(Zp>>>26)|0,Zp&=67108863,I=Math.imul(K,Ce),l=Math.imul(K,mt),l=l+Math.imul(H,Ce)|0,C=Math.imul(H,mt),I=I+Math.imul(q,wt)|0,l=l+Math.imul(q,vt)|0,l=l+Math.imul(M,wt)|0,C=C+Math.imul(M,vt)|0,I=I+Math.imul(L,Et)|0,l=l+Math.imul(L,At)|0,l=l+Math.imul(P,Et)|0,C=C+Math.imul(P,At)|0,I=I+Math.imul(E,It)|0,l=l+Math.imul(E,_t)|0,l=l+Math.imul(b,It)|0,C=C+Math.imul(b,_t)|0,I=I+Math.imul(ie,bt)|0,l=l+Math.imul(ie,Ct)|0,l=l+Math.imul(ee,bt)|0,C=C+Math.imul(ee,Ct)|0;var e0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(e0>>>26)|0,e0&=67108863,I=Math.imul(he,Ce),l=Math.imul(he,mt),l=l+Math.imul(de,Ce)|0,C=Math.imul(de,mt),I=I+Math.imul(K,wt)|0,l=l+Math.imul(K,vt)|0,l=l+Math.imul(H,wt)|0,C=C+Math.imul(H,vt)|0,I=I+Math.imul(q,Et)|0,l=l+Math.imul(q,At)|0,l=l+Math.imul(M,Et)|0,C=C+Math.imul(M,At)|0,I=I+Math.imul(L,It)|0,l=l+Math.imul(L,_t)|0,l=l+Math.imul(P,It)|0,C=C+Math.imul(P,_t)|0,I=I+Math.imul(E,bt)|0,l=l+Math.imul(E,Ct)|0,l=l+Math.imul(b,bt)|0,C=C+Math.imul(b,Ct)|0,I=I+Math.imul(ie,St)|0,l=l+Math.imul(ie,xt)|0,l=l+Math.imul(ee,St)|0,C=C+Math.imul(ee,xt)|0;var t0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(t0>>>26)|0,t0&=67108863,I=Math.imul(be,Ce),l=Math.imul(be,mt),l=l+Math.imul(xe,Ce)|0,C=Math.imul(xe,mt),I=I+Math.imul(he,wt)|0,l=l+Math.imul(he,vt)|0,l=l+Math.imul(de,wt)|0,C=C+Math.imul(de,vt)|0,I=I+Math.imul(K,Et)|0,l=l+Math.imul(K,At)|0,l=l+Math.imul(H,Et)|0,C=C+Math.imul(H,At)|0,I=I+Math.imul(q,It)|0,l=l+Math.imul(q,_t)|0,l=l+Math.imul(M,It)|0,C=C+Math.imul(M,_t)|0,I=I+Math.imul(L,bt)|0,l=l+Math.imul(L,Ct)|0,l=l+Math.imul(P,bt)|0,C=C+Math.imul(P,Ct)|0,I=I+Math.imul(E,St)|0,l=l+Math.imul(E,xt)|0,l=l+Math.imul(b,St)|0,C=C+Math.imul(b,xt)|0,I=I+Math.imul(ie,Tt)|0,l=l+Math.imul(ie,Nt)|0,l=l+Math.imul(ee,Tt)|0,C=C+Math.imul(ee,Nt)|0;var r0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(r0>>>26)|0,r0&=67108863,I=Math.imul(Ie,Ce),l=Math.imul(Ie,mt),l=l+Math.imul(Pe,Ce)|0,C=Math.imul(Pe,mt),I=I+Math.imul(be,wt)|0,l=l+Math.imul(be,vt)|0,l=l+Math.imul(xe,wt)|0,C=C+Math.imul(xe,vt)|0,I=I+Math.imul(he,Et)|0,l=l+Math.imul(he,At)|0,l=l+Math.imul(de,Et)|0,C=C+Math.imul(de,At)|0,I=I+Math.imul(K,It)|0,l=l+Math.imul(K,_t)|0,l=l+Math.imul(H,It)|0,C=C+Math.imul(H,_t)|0,I=I+Math.imul(q,bt)|0,l=l+Math.imul(q,Ct)|0,l=l+Math.imul(M,bt)|0,C=C+Math.imul(M,Ct)|0,I=I+Math.imul(L,St)|0,l=l+Math.imul(L,xt)|0,l=l+Math.imul(P,St)|0,C=C+Math.imul(P,xt)|0,I=I+Math.imul(E,Tt)|0,l=l+Math.imul(E,Nt)|0,l=l+Math.imul(b,Tt)|0,C=C+Math.imul(b,Nt)|0,I=I+Math.imul(ie,Dt)|0,l=l+Math.imul(ie,Ot)|0,l=l+Math.imul(ee,Dt)|0,C=C+Math.imul(ee,Ot)|0;var i0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(i0>>>26)|0,i0&=67108863,I=Math.imul(Ze,Ce),l=Math.imul(Ze,mt),l=l+Math.imul(et,Ce)|0,C=Math.imul(et,mt),I=I+Math.imul(Ie,wt)|0,l=l+Math.imul(Ie,vt)|0,l=l+Math.imul(Pe,wt)|0,C=C+Math.imul(Pe,vt)|0,I=I+Math.imul(be,Et)|0,l=l+Math.imul(be,At)|0,l=l+Math.imul(xe,Et)|0,C=C+Math.imul(xe,At)|0,I=I+Math.imul(he,It)|0,l=l+Math.imul(he,_t)|0,l=l+Math.imul(de,It)|0,C=C+Math.imul(de,_t)|0,I=I+Math.imul(K,bt)|0,l=l+Math.imul(K,Ct)|0,l=l+Math.imul(H,bt)|0,C=C+Math.imul(H,Ct)|0,I=I+Math.imul(q,St)|0,l=l+Math.imul(q,xt)|0,l=l+Math.imul(M,St)|0,C=C+Math.imul(M,xt)|0,I=I+Math.imul(L,Tt)|0,l=l+Math.imul(L,Nt)|0,l=l+Math.imul(P,Tt)|0,C=C+Math.imul(P,Nt)|0,I=I+Math.imul(E,Dt)|0,l=l+Math.imul(E,Ot)|0,l=l+Math.imul(b,Dt)|0,C=C+Math.imul(b,Ot)|0,I=I+Math.imul(ie,Pt)|0,l=l+Math.imul(ie,Bt)|0,l=l+Math.imul(ee,Pt)|0,C=C+Math.imul(ee,Bt)|0;var n0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(n0>>>26)|0,n0&=67108863,I=Math.imul(ze,Ce),l=Math.imul(ze,mt),l=l+Math.imul(Ue,Ce)|0,C=Math.imul(Ue,mt),I=I+Math.imul(Ze,wt)|0,l=l+Math.imul(Ze,vt)|0,l=l+Math.imul(et,wt)|0,C=C+Math.imul(et,vt)|0,I=I+Math.imul(Ie,Et)|0,l=l+Math.imul(Ie,At)|0,l=l+Math.imul(Pe,Et)|0,C=C+Math.imul(Pe,At)|0,I=I+Math.imul(be,It)|0,l=l+Math.imul(be,_t)|0,l=l+Math.imul(xe,It)|0,C=C+Math.imul(xe,_t)|0,I=I+Math.imul(he,bt)|0,l=l+Math.imul(he,Ct)|0,l=l+Math.imul(de,bt)|0,C=C+Math.imul(de,Ct)|0,I=I+Math.imul(K,St)|0,l=l+Math.imul(K,xt)|0,l=l+Math.imul(H,St)|0,C=C+Math.imul(H,xt)|0,I=I+Math.imul(q,Tt)|0,l=l+Math.imul(q,Nt)|0,l=l+Math.imul(M,Tt)|0,C=C+Math.imul(M,Nt)|0,I=I+Math.imul(L,Dt)|0,l=l+Math.imul(L,Ot)|0,l=l+Math.imul(P,Dt)|0,C=C+Math.imul(P,Ot)|0,I=I+Math.imul(E,Pt)|0,l=l+Math.imul(E,Bt)|0,l=l+Math.imul(b,Pt)|0,C=C+Math.imul(b,Bt)|0,I=I+Math.imul(ie,Mt)|0,l=l+Math.imul(ie,Rt)|0,l=l+Math.imul(ee,Mt)|0,C=C+Math.imul(ee,Rt)|0;var s0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(s0>>>26)|0,s0&=67108863,I=Math.imul(ze,wt),l=Math.imul(ze,vt),l=l+Math.imul(Ue,wt)|0,C=Math.imul(Ue,vt),I=I+Math.imul(Ze,Et)|0,l=l+Math.imul(Ze,At)|0,l=l+Math.imul(et,Et)|0,C=C+Math.imul(et,At)|0,I=I+Math.imul(Ie,It)|0,l=l+Math.imul(Ie,_t)|0,l=l+Math.imul(Pe,It)|0,C=C+Math.imul(Pe,_t)|0,I=I+Math.imul(be,bt)|0,l=l+Math.imul(be,Ct)|0,l=l+Math.imul(xe,bt)|0,C=C+Math.imul(xe,Ct)|0,I=I+Math.imul(he,St)|0,l=l+Math.imul(he,xt)|0,l=l+Math.imul(de,St)|0,C=C+Math.imul(de,xt)|0,I=I+Math.imul(K,Tt)|0,l=l+Math.imul(K,Nt)|0,l=l+Math.imul(H,Tt)|0,C=C+Math.imul(H,Nt)|0,I=I+Math.imul(q,Dt)|0,l=l+Math.imul(q,Ot)|0,l=l+Math.imul(M,Dt)|0,C=C+Math.imul(M,Ot)|0,I=I+Math.imul(L,Pt)|0,l=l+Math.imul(L,Bt)|0,l=l+Math.imul(P,Pt)|0,C=C+Math.imul(P,Bt)|0,I=I+Math.imul(E,Mt)|0,l=l+Math.imul(E,Rt)|0,l=l+Math.imul(b,Mt)|0,C=C+Math.imul(b,Rt)|0;var o0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(o0>>>26)|0,o0&=67108863,I=Math.imul(ze,Et),l=Math.imul(ze,At),l=l+Math.imul(Ue,Et)|0,C=Math.imul(Ue,At),I=I+Math.imul(Ze,It)|0,l=l+Math.imul(Ze,_t)|0,l=l+Math.imul(et,It)|0,C=C+Math.imul(et,_t)|0,I=I+Math.imul(Ie,bt)|0,l=l+Math.imul(Ie,Ct)|0,l=l+Math.imul(Pe,bt)|0,C=C+Math.imul(Pe,Ct)|0,I=I+Math.imul(be,St)|0,l=l+Math.imul(be,xt)|0,l=l+Math.imul(xe,St)|0,C=C+Math.imul(xe,xt)|0,I=I+Math.imul(he,Tt)|0,l=l+Math.imul(he,Nt)|0,l=l+Math.imul(de,Tt)|0,C=C+Math.imul(de,Nt)|0,I=I+Math.imul(K,Dt)|0,l=l+Math.imul(K,Ot)|0,l=l+Math.imul(H,Dt)|0,C=C+Math.imul(H,Ot)|0,I=I+Math.imul(q,Pt)|0,l=l+Math.imul(q,Bt)|0,l=l+Math.imul(M,Pt)|0,C=C+Math.imul(M,Bt)|0,I=I+Math.imul(L,Mt)|0,l=l+Math.imul(L,Rt)|0,l=l+Math.imul(P,Mt)|0,C=C+Math.imul(P,Rt)|0;var a0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(a0>>>26)|0,a0&=67108863,I=Math.imul(ze,It),l=Math.imul(ze,_t),l=l+Math.imul(Ue,It)|0,C=Math.imul(Ue,_t),I=I+Math.imul(Ze,bt)|0,l=l+Math.imul(Ze,Ct)|0,l=l+Math.imul(et,bt)|0,C=C+Math.imul(et,Ct)|0,I=I+Math.imul(Ie,St)|0,l=l+Math.imul(Ie,xt)|0,l=l+Math.imul(Pe,St)|0,C=C+Math.imul(Pe,xt)|0,I=I+Math.imul(be,Tt)|0,l=l+Math.imul(be,Nt)|0,l=l+Math.imul(xe,Tt)|0,C=C+Math.imul(xe,Nt)|0,I=I+Math.imul(he,Dt)|0,l=l+Math.imul(he,Ot)|0,l=l+Math.imul(de,Dt)|0,C=C+Math.imul(de,Ot)|0,I=I+Math.imul(K,Pt)|0,l=l+Math.imul(K,Bt)|0,l=l+Math.imul(H,Pt)|0,C=C+Math.imul(H,Bt)|0,I=I+Math.imul(q,Mt)|0,l=l+Math.imul(q,Rt)|0,l=l+Math.imul(M,Mt)|0,C=C+Math.imul(M,Rt)|0;var u0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(u0>>>26)|0,u0&=67108863,I=Math.imul(ze,bt),l=Math.imul(ze,Ct),l=l+Math.imul(Ue,bt)|0,C=Math.imul(Ue,Ct),I=I+Math.imul(Ze,St)|0,l=l+Math.imul(Ze,xt)|0,l=l+Math.imul(et,St)|0,C=C+Math.imul(et,xt)|0,I=I+Math.imul(Ie,Tt)|0,l=l+Math.imul(Ie,Nt)|0,l=l+Math.imul(Pe,Tt)|0,C=C+Math.imul(Pe,Nt)|0,I=I+Math.imul(be,Dt)|0,l=l+Math.imul(be,Ot)|0,l=l+Math.imul(xe,Dt)|0,C=C+Math.imul(xe,Ot)|0,I=I+Math.imul(he,Pt)|0,l=l+Math.imul(he,Bt)|0,l=l+Math.imul(de,Pt)|0,C=C+Math.imul(de,Bt)|0,I=I+Math.imul(K,Mt)|0,l=l+Math.imul(K,Rt)|0,l=l+Math.imul(H,Mt)|0,C=C+Math.imul(H,Rt)|0;var c0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(c0>>>26)|0,c0&=67108863,I=Math.imul(ze,St),l=Math.imul(ze,xt),l=l+Math.imul(Ue,St)|0,C=Math.imul(Ue,xt),I=I+Math.imul(Ze,Tt)|0,l=l+Math.imul(Ze,Nt)|0,l=l+Math.imul(et,Tt)|0,C=C+Math.imul(et,Nt)|0,I=I+Math.imul(Ie,Dt)|0,l=l+Math.imul(Ie,Ot)|0,l=l+Math.imul(Pe,Dt)|0,C=C+Math.imul(Pe,Ot)|0,I=I+Math.imul(be,Pt)|0,l=l+Math.imul(be,Bt)|0,l=l+Math.imul(xe,Pt)|0,C=C+Math.imul(xe,Bt)|0,I=I+Math.imul(he,Mt)|0,l=l+Math.imul(he,Rt)|0,l=l+Math.imul(de,Mt)|0,C=C+Math.imul(de,Rt)|0;var l0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(l0>>>26)|0,l0&=67108863,I=Math.imul(ze,Tt),l=Math.imul(ze,Nt),l=l+Math.imul(Ue,Tt)|0,C=Math.imul(Ue,Nt),I=I+Math.imul(Ze,Dt)|0,l=l+Math.imul(Ze,Ot)|0,l=l+Math.imul(et,Dt)|0,C=C+Math.imul(et,Ot)|0,I=I+Math.imul(Ie,Pt)|0,l=l+Math.imul(Ie,Bt)|0,l=l+Math.imul(Pe,Pt)|0,C=C+Math.imul(Pe,Bt)|0,I=I+Math.imul(be,Mt)|0,l=l+Math.imul(be,Rt)|0,l=l+Math.imul(xe,Mt)|0,C=C+Math.imul(xe,Rt)|0;var f0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(f0>>>26)|0,f0&=67108863,I=Math.imul(ze,Dt),l=Math.imul(ze,Ot),l=l+Math.imul(Ue,Dt)|0,C=Math.imul(Ue,Ot),I=I+Math.imul(Ze,Pt)|0,l=l+Math.imul(Ze,Bt)|0,l=l+Math.imul(et,Pt)|0,C=C+Math.imul(et,Bt)|0,I=I+Math.imul(Ie,Mt)|0,l=l+Math.imul(Ie,Rt)|0,l=l+Math.imul(Pe,Mt)|0,C=C+Math.imul(Pe,Rt)|0;var h0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(h0>>>26)|0,h0&=67108863,I=Math.imul(ze,Pt),l=Math.imul(ze,Bt),l=l+Math.imul(Ue,Pt)|0,C=Math.imul(Ue,Bt),I=I+Math.imul(Ze,Mt)|0,l=l+Math.imul(Ze,Rt)|0,l=l+Math.imul(et,Mt)|0,C=C+Math.imul(et,Rt)|0;var d0=(D+I|0)+((l&8191)<<13)|0;D=(C+(l>>>13)|0)+(d0>>>26)|0,d0&=67108863,I=Math.imul(ze,Mt),l=Math.imul(ze,Rt),l=l+Math.imul(Ue,Mt)|0,C=Math.imul(Ue,Rt);var p0=(D+I|0)+((l&8191)<<13)|0;return D=(C+(l>>>13)|0)+(p0>>>26)|0,p0&=67108863,S[0]=Yp,S[1]=Jp,S[2]=Xp,S[3]=Zp,S[4]=e0,S[5]=t0,S[6]=r0,S[7]=i0,S[8]=n0,S[9]=s0,S[10]=o0,S[11]=a0,S[12]=u0,S[13]=c0,S[14]=l0,S[15]=f0,S[16]=h0,S[17]=d0,S[18]=p0,D!==0&&(S[19]=D,g.length++),g};Math.imul||($=z);function se(A,c,d){d.negative=c.negative^A.negative,d.length=A.length+c.length;for(var g=0,m=0,v=0;v>>26)|0,m+=S>>>26,S&=67108863}d.words[v]=D,g=S,S=m}return g!==0?d.words[v]=g:d.length--,d._strip()}function Y(A,c,d){return se(A,c,d)}n.prototype.mulTo=function(c,d){var g,m=this.length+c.length;return this.length===10&&c.length===10?g=$(this,c,d):m<63?g=z(this,c,d):m<1024?g=se(this,c,d):g=Y(this,c,d),g};function j(A,c){this.x=A,this.y=c}j.prototype.makeRBT=function(c){for(var d=new Array(c),g=n.prototype._countBits(c)-1,m=0;m>=1;return m},j.prototype.permute=function(c,d,g,m,v,S){for(var D=0;D>>1)v++;return 1<>>13,g[2*S+1]=v&8191,v=v>>>13;for(S=2*d;S>=26,g+=v/67108864|0,g+=S>>>26,this.words[m]=S&67108863}return g!==0&&(this.words[m]=g,this.length++),d?this.ineg():this},n.prototype.muln=function(c){return this.clone().imuln(c)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(c){var d=V(c);if(d.length===0)return new n(1);for(var g=this,m=0;m=0);var d=c%26,g=(c-d)/26,m=67108863>>>26-d<<26-d,v;if(d!==0){var S=0;for(v=0;v>>26-d}S&&(this.words[v]=S,this.length++)}if(g!==0){for(v=this.length-1;v>=0;v--)this.words[v+g]=this.words[v];for(v=0;v=0);var m;d?m=(d-d%26)/26:m=0;var v=c%26,S=Math.min((c-v)/26,this.length),D=67108863^67108863>>>v<S)for(this.length-=S,l=0;l=0&&(C!==0||l>=m);l--){var Z=this.words[l]|0;this.words[l]=C<<26-v|Z>>>v,C=Z&D}return I&&C!==0&&(I.words[I.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(c,d,g){return t(this.negative===0),this.iushrn(c,d,g)},n.prototype.shln=function(c){return this.clone().ishln(c)},n.prototype.ushln=function(c){return this.clone().iushln(c)},n.prototype.shrn=function(c){return this.clone().ishrn(c)},n.prototype.ushrn=function(c){return this.clone().iushrn(c)},n.prototype.testn=function(c){t(typeof c=="number"&&c>=0);var d=c%26,g=(c-d)/26,m=1<=0);var d=c%26,g=(c-d)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(d!==0&&g++,this.length=Math.min(g,this.length),d!==0){var m=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(c){if(t(typeof c=="number"),t(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(I/67108864|0),this.words[v+g]=S&67108863}for(;v>26,this.words[v+g]=S&67108863;if(D===0)return this._strip();for(t(D===-1),D=0,v=0;v>26,this.words[v]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(c,d){var g=this.length-c.length,m=this.clone(),v=c,S=v.words[v.length-1]|0,D=this._countBits(S);g=26-D,g!==0&&(v=v.ushln(g),m.iushln(g),S=v.words[v.length-1]|0);var I=m.length-v.length,l;if(d!=="mod"){l=new n(null),l.length=I+1,l.words=new Array(l.length);for(var C=0;C=0;ie--){var ee=(m.words[v.length+ie]|0)*67108864+(m.words[v.length+ie-1]|0);for(ee=Math.min(ee/S|0,67108863),m._ishlnsubmul(v,ee,ie);m.negative!==0;)ee--,m.negative=0,m._ishlnsubmul(v,1,ie),m.isZero()||(m.negative^=1);l&&(l.words[ie]=ee)}return l&&l._strip(),m._strip(),d!=="div"&&g!==0&&m.iushrn(g),{div:l||null,mod:m}},n.prototype.divmod=function(c,d,g){if(t(!c.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var m,v,S;return this.negative!==0&&c.negative===0?(S=this.neg().divmod(c,d),d!=="mod"&&(m=S.div.neg()),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.iadd(c)),{div:m,mod:v}):this.negative===0&&c.negative!==0?(S=this.divmod(c.neg(),d),d!=="mod"&&(m=S.div.neg()),{div:m,mod:S.mod}):this.negative&c.negative?(S=this.neg().divmod(c.neg(),d),d!=="div"&&(v=S.mod.neg(),g&&v.negative!==0&&v.isub(c)),{div:S.div,mod:v}):c.length>this.length||this.cmp(c)<0?{div:new n(0),mod:this}:c.length===1?d==="div"?{div:this.divn(c.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new n(this.modrn(c.words[0]))}:this._wordDiv(c,d)},n.prototype.div=function(c){return this.divmod(c,"div",!1).div},n.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},n.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},n.prototype.divRound=function(c){var d=this.divmod(c);if(d.mod.isZero())return d.div;var g=d.div.negative!==0?d.mod.isub(c):d.mod,m=c.ushrn(1),v=c.andln(1),S=g.cmp(m);return S<0||v===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=(1<<26)%c,m=0,v=this.length-1;v>=0;v--)m=(g*m+(this.words[v]|0))%c;return d?-m:m},n.prototype.modn=function(c){return this.modrn(c)},n.prototype.idivn=function(c){var d=c<0;d&&(c=-c),t(c<=67108863);for(var g=0,m=this.length-1;m>=0;m--){var v=(this.words[m]|0)+g*67108864;this.words[m]=v/c|0,g=v%c}return this._strip(),d?this.ineg():this},n.prototype.divn=function(c){return this.clone().idivn(c)},n.prototype.egcd=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=new n(0),D=new n(1),I=0;d.isEven()&&g.isEven();)d.iushrn(1),g.iushrn(1),++I;for(var l=g.clone(),C=d.clone();!d.isZero();){for(var Z=0,ie=1;!(d.words[0]&ie)&&Z<26;++Z,ie<<=1);if(Z>0)for(d.iushrn(Z);Z-- >0;)(m.isOdd()||v.isOdd())&&(m.iadd(l),v.isub(C)),m.iushrn(1),v.iushrn(1);for(var ee=0,ae=1;!(g.words[0]&ae)&&ee<26;++ee,ae<<=1);if(ee>0)for(g.iushrn(ee);ee-- >0;)(S.isOdd()||D.isOdd())&&(S.iadd(l),D.isub(C)),S.iushrn(1),D.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(S),v.isub(D)):(g.isub(d),S.isub(m),D.isub(v))}return{a:S,b:D,gcd:g.iushln(I)}},n.prototype._invmp=function(c){t(c.negative===0),t(!c.isZero());var d=this,g=c.clone();d.negative!==0?d=d.umod(c):d=d.clone();for(var m=new n(1),v=new n(0),S=g.clone();d.cmpn(1)>0&&g.cmpn(1)>0;){for(var D=0,I=1;!(d.words[0]&I)&&D<26;++D,I<<=1);if(D>0)for(d.iushrn(D);D-- >0;)m.isOdd()&&m.iadd(S),m.iushrn(1);for(var l=0,C=1;!(g.words[0]&C)&&l<26;++l,C<<=1);if(l>0)for(g.iushrn(l);l-- >0;)v.isOdd()&&v.iadd(S),v.iushrn(1);d.cmp(g)>=0?(d.isub(g),m.isub(v)):(g.isub(d),v.isub(m))}var Z;return d.cmpn(1)===0?Z=m:Z=v,Z.cmpn(0)<0&&Z.iadd(c),Z},n.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var d=this.clone(),g=c.clone();d.negative=0,g.negative=0;for(var m=0;d.isEven()&&g.isEven();m++)d.iushrn(1),g.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;g.isEven();)g.iushrn(1);var v=d.cmp(g);if(v<0){var S=d;d=g,g=S}else if(v===0||g.cmpn(1)===0)break;d.isub(g)}while(!0);return g.iushln(m)},n.prototype.invm=function(c){return this.egcd(c).a.umod(c)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(c){return this.words[0]&c},n.prototype.bincn=function(c){t(typeof c=="number");var d=c%26,g=(c-d)/26,m=1<>>26,D&=67108863,this.words[S]=D}return v!==0&&(this.words[S]=v,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(c){var d=c<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var g;if(this.length>1)g=1;else{d&&(c=-c),t(c<=67108863,"Number is too big");var m=this.words[0]|0;g=m===c?0:mc.length)return 1;if(this.length=0;g--){var m=this.words[g]|0,v=c.words[g]|0;if(m!==v){mv&&(d=1);break}}return d},n.prototype.gtn=function(c){return this.cmpn(c)===1},n.prototype.gt=function(c){return this.cmp(c)===1},n.prototype.gten=function(c){return this.cmpn(c)>=0},n.prototype.gte=function(c){return this.cmp(c)>=0},n.prototype.ltn=function(c){return this.cmpn(c)===-1},n.prototype.lt=function(c){return this.cmp(c)===-1},n.prototype.lten=function(c){return this.cmpn(c)<=0},n.prototype.lte=function(c){return this.cmp(c)<=0},n.prototype.eqn=function(c){return this.cmpn(c)===0},n.prototype.eq=function(c){return this.cmp(c)===0},n.red=function(c){return new J(c)},n.prototype.toRed=function(c){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},n.prototype.fromRed=function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(c){return this.red=c,this},n.prototype.forceRed=function(c){return t(!this.red,"Already a number in reduction context"),this._forceRed(c)},n.prototype.redAdd=function(c){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},n.prototype.redIAdd=function(c){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},n.prototype.redSub=function(c){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},n.prototype.redISub=function(c){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},n.prototype.redShl=function(c){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},n.prototype.redMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},n.prototype.redIMul=function(c){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},n.prototype.redSqr=function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(c){return t(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var W={k256:null,p224:null,p192:null,p25519:null};function k(A,c){this.name=A,this.p=new n(c,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var c=new n(null);return c.words=new Array(Math.ceil(this.n/13)),c},k.prototype.ireduce=function(c){var d=c,g;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),g=d.bitLength();while(g>this.n);var m=g0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},k.prototype.split=function(c,d){c.iushrn(this.n,0,d)},k.prototype.imulK=function(c){return c.imul(this.k)};function R(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(R,k),R.prototype.split=function(c,d){for(var g=4194303,m=Math.min(c.length,9),v=0;v>>22,S=D}S>>>=22,c.words[v-10]=S,S===0&&c.length>10?c.length-=10:c.length-=9},R.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var d=0,g=0;g>>=26,c.words[g]=v,d=m}return d!==0&&(c.words[c.length++]=d),c},n._prime=function(c){if(W[c])return W[c];var d;if(c==="k256")d=new R;else if(c==="p224")d=new F;else if(c==="p192")d=new G;else if(c==="p25519")d=new ce;else throw new Error("Unknown prime "+c);return W[c]=d,d};function J(A){if(typeof A=="string"){var c=n._prime(A);this.m=c.p,this.prime=c}else t(A.gtn(1),"modulus must be greater than 1"),this.m=A,this.prime=null}J.prototype._verify1=function(c){t(c.negative===0,"red works only with positives"),t(c.red,"red works only with red numbers")},J.prototype._verify2=function(c,d){t((c.negative|d.negative)===0,"red works only with positives"),t(c.red&&c.red===d.red,"red works only with red numbers")},J.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(h(c,c.umod(this.m)._forceRed(this)),c)},J.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},J.prototype.add=function(c,d){this._verify2(c,d);var g=c.add(d);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},J.prototype.iadd=function(c,d){this._verify2(c,d);var g=c.iadd(d);return g.cmp(this.m)>=0&&g.isub(this.m),g},J.prototype.sub=function(c,d){this._verify2(c,d);var g=c.sub(d);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},J.prototype.isub=function(c,d){this._verify2(c,d);var g=c.isub(d);return g.cmpn(0)<0&&g.iadd(this.m),g},J.prototype.shl=function(c,d){return this._verify1(c),this.imod(c.ushln(d))},J.prototype.imul=function(c,d){return this._verify2(c,d),this.imod(c.imul(d))},J.prototype.mul=function(c,d){return this._verify2(c,d),this.imod(c.mul(d))},J.prototype.isqr=function(c){return this.imul(c,c.clone())},J.prototype.sqr=function(c){return this.mul(c,c)},J.prototype.sqrt=function(c){if(c.isZero())return c.clone();var d=this.m.andln(3);if(t(d%2===1),d===3){var g=this.m.add(new n(1)).iushrn(2);return this.pow(c,g)}for(var m=this.m.subn(1),v=0;!m.isZero()&&m.andln(1)===0;)v++,m.iushrn(1);t(!m.isZero());var S=new n(1).toRed(this),D=S.redNeg(),I=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new n(2*l*l).toRed(this);this.pow(l,I).cmp(D)!==0;)l.redIAdd(D);for(var C=this.pow(l,m),Z=this.pow(c,m.addn(1).iushrn(1)),ie=this.pow(c,m),ee=v;ie.cmp(S)!==0;){for(var ae=ie,E=0;ae.cmp(S)!==0;E++)ae=ae.redSqr();t(E=0;v--){for(var C=d.words[v],Z=l-1;Z>=0;Z--){var ie=C>>Z&1;if(S!==m[0]&&(S=this.sqr(S)),ie===0&&D===0){I=0;continue}D<<=1,D|=ie,I++,!(I!==g&&(v!==0||Z!==0))&&(S=this.mul(S,m[D]),I=0,D=0)}l=26}return S},J.prototype.convertTo=function(c){var d=c.umod(this.m);return d===c?d.clone():d},J.prototype.convertFrom=function(c){var d=c.clone();return d.red=null,d},n.mont=function(c){return new X(c)};function X(A){J.call(this,A),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(X,J),X.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},X.prototype.convertFrom=function(c){var d=this.imod(c.mul(this.rinv));return d.red=null,d},X.prototype.imul=function(c,d){if(c.isZero()||d.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.mul=function(c,d){if(c.isZero()||d.isZero())return new n(0)._forceRed(this);var g=c.mul(d),m=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=g.isub(m).iushrn(this.shift),S=v;return v.cmp(this.m)>=0?S=v.isub(this.m):v.cmpn(0)<0&&(S=v.iadd(this.m)),S._forceRed(this)},X.prototype.invm=function(c){var d=this.imod(c._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof Hv>"u"||Hv,xO)});var NO=B(Sp=>{"use strict";f();Object.defineProperty(Sp,"__esModule",{value:!0});Sp.TransactionStatus=void 0;var El=class{constructor(e){this.status=(e||"").toLowerCase()}static createUnknown(){return new El("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}};Sp.TransactionStatus=El});var Mu=B(Zt=>{"use strict";f();var CG=Zt&&Zt.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),SG=Zt&&Zt.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),xG=Zt&&Zt.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&CG(e,r,t);return SG(e,r),e};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.zeroPadStringIfOddLength=Zt.isPaddedHex=Zt.numberToPaddedHex=Zt.Nonce=Zt.Address=void 0;var DO=xG(kl()),TG="erd",Al=class{constructor(e){this.value=e}static fromPubkey(e){let t=DO.toWords(e),i=DO.encode(TG,t);return new Al(i)}bech32(){return this.value}toString(){return this.bech32()}};Zt.Address=Al;var Qv=class{constructor(e){this.value=e}valueOf(){return this.value}hex(){return OO(this.value)}};Zt.Nonce=Qv;function OO(r){let e=r.toString(16);return PO(e)}Zt.numberToPaddedHex=OO;function NG(r){r=r||"";let e=y.Buffer.from(r,"hex").toString("hex");return r.toUpperCase()==e.toUpperCase()}Zt.isPaddedHex=NG;function PO(r){return r=r||"",r.length%2==1?"0"+r:r}Zt.zeroPadStringIfOddLength=PO});var MO=B(xp=>{"use strict";f();Object.defineProperty(xp,"__esModule",{value:!0});xp.TransactionReceipt=void 0;var BO=Mu(),Il=class{constructor(){this.value="",this.sender=new BO.Address(""),this.data="",this.hash=""}static fromHttpResponse(e){let t=new Il;return t.value=(e.value||0).toString(),t.sender=new BO.Address(e.sender),t.data=e.data,t.hash=e.txHash,t}};xp.TransactionReceipt=Il});var RO=B(Hi=>{"use strict";f();Object.defineProperty(Hi,"__esModule",{value:!0});Hi.ErrContractQuery=Hi.ErrNetworkProvider=Hi.ErrUnexpectedCondition=Hi.Err=void 0;var Ru=class extends Error{constructor(e,t){super(e),this.inner=void 0,this.inner=t}};Hi.Err=Ru;var jv=class extends Ru{constructor(e){super(`Unexpected condition: [${e}]`)}};Hi.ErrUnexpectedCondition=jv;var Gv=class extends Ru{constructor(e,t,i){let n=`Request error on url [${e}]: [${t}]`;super(n,i)}};Hi.ErrNetworkProvider=Gv;var Kv=class extends Ru{constructor(e){super(e.message.replace("executeQuery:",""))}};Hi.ErrContractQuery=Kv});var FO=B(Lu=>{"use strict";f();Object.defineProperty(Lu,"__esModule",{value:!0});Lu.TransactionEventTopic=Lu.TransactionEvent=void 0;var LO=Mu(),_l=class{constructor(e){this.address=new LO.Address(""),this.identifier="",this.topics=[],this.data="",Object.assign(this,e)}static fromHttpResponse(e){let t=new _l;return t.address=new LO.Address(e.address),t.identifier=e.identifier||"",t.topics=(e.topics||[]).map(i=>new Tp(i)),t.data=y.Buffer.from(e.data||"","base64").toString(),t}findFirstOrNoneTopic(e){return this.topics.filter(t=>e(t))[0]}getLastTopic(){return this.topics[this.topics.length-1]}};Lu.TransactionEvent=_l;var Tp=class{constructor(e){this.raw=y.Buffer.from(e||"","base64")}toString(){return this.raw.toString("utf8")}hex(){return this.raw.toString("hex")}valueOf(){return this.raw}};Lu.TransactionEventTopic=Tp});var zv=B(Np=>{"use strict";f();Object.defineProperty(Np,"__esModule",{value:!0});Np.TransactionLogs=void 0;var DG=RO(),UO=Mu(),OG=FO(),bl=class{constructor(e){this.address=new UO.Address(""),this.events=[],Object.assign(this,e)}static fromHttpResponse(e){let t=new bl;return t.address=new UO.Address(e.address),t.events=(e.events||[]).map(i=>OG.TransactionEvent.fromHttpResponse(i)),t}findSingleOrNoneEvent(e,t){let i=this.findEvents(e,t);if(i.length>1)throw new DG.ErrUnexpectedCondition(`more than one event of type ${e}`);return i[0]}findFirstOrNoneEvent(e,t){return this.findEvents(e,t)[0]}findEvents(e,t){let i=this.events.filter(n=>n.identifier==e);return t&&(i=i.filter(n=>t(n))),i}};Np.TransactionLogs=bl});var VO=B(Uu=>{"use strict";f();Object.defineProperty(Uu,"__esModule",{value:!0});Uu.ContractResultItem=Uu.ContractResults=void 0;var qO=zv(),Dp=Mu(),Fu=class{constructor(e){this.items=e,this.items.sort(function(t,i){return t.nonce.valueOf()-i.nonce.valueOf()})}static fromProxyHttpResponse(e){let t=e.map(i=>fn.fromProxyHttpResponse(i));return new Fu(t)}static fromApiHttpResponse(e){let t=e.map(i=>fn.fromApiHttpResponse(i));return new Fu(t)}};Uu.ContractResults=Fu;var fn=class{constructor(e){this.hash="",this.nonce=0,this.value="",this.receiver=new Dp.Address(""),this.sender=new Dp.Address(""),this.data="",this.previousHash="",this.originalHash="",this.gasLimit=0,this.gasPrice=0,this.callType=0,this.returnMessage="",this.logs=new qO.TransactionLogs,Object.assign(this,e)}static fromProxyHttpResponse(e){return fn.fromHttpResponse(e)}static fromApiHttpResponse(e){let t=fn.fromHttpResponse(e);return t.data=y.Buffer.from(t.data,"base64").toString(),t.callType=Number(t.callType),t}static fromHttpResponse(e){let t=new fn;return t.hash=e.hash,t.nonce=Number(e.nonce||0),t.value=(e.value||0).toString(),t.receiver=new Dp.Address(e.receiver),t.sender=new Dp.Address(e.sender),t.previousHash=e.prevTxHash,t.originalHash=e.originalTxHash,t.gasLimit=Number(e.gasLimit||0),t.gasPrice=Number(e.gasPrice||0),t.data=e.data||"",t.callType=e.callType,t.returnMessage=e.returnMessage,t.logs=qO.TransactionLogs.fromHttpResponse(e.logs||{}),t}};Uu.ContractResultItem=fn});var HO=B(rs=>{"use strict";f();var PG=rs&&rs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rs,"__esModule",{value:!0});rs.EsdtContractAddress=rs.MaxUint64AsBigNumber=void 0;var BG=PG(jr()),MG=Mu();rs.MaxUint64AsBigNumber=new BG.default("18446744073709551615");rs.EsdtContractAddress=new MG.Address("erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u")});var QO=B(qu=>{"use strict";f();var RG=qu&&qu.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qu,"__esModule",{value:!0});qu.ContractQueryResponse=void 0;var LG=RG(jr()),FG=HO(),Cl=class{constructor(e){this.returnData=e?.returnData||[],this.returnCode=e?.returnCode||"",this.returnMessage=e?.returnMessage||"",this.gasUsed=e?.gasUsed||0}static fromHttpResponse(e){let t=e.returnData||e.ReturnData,i=e.returnCode||e.ReturnCode,n=e.returnMessage||e.ReturnMessage,s=new LG.default(e.gasRemaining||e.GasRemaining||0),o=FG.MaxUint64AsBigNumber.minus(s).toNumber();return new Cl({returnData:t,returnCode:i,returnMessage:n,gasUsed:o})}getReturnDataParts(){return this.returnData.map(e=>y.Buffer.from(e||"","base64"))}toJSON(){return{returnData:this.returnData,returnCode:this.returnCode,returnMessage:this.returnMessage,gasUsed:this.gasUsed.valueOf()}}};qu.ContractQueryResponse=Cl});var jO=B(Op=>{"use strict";f();Object.defineProperty(Op,"__esModule",{value:!0});Op.ContractQueryRequest=void 0;var kv=class{constructor(e){this.query=e}toHttpRequest(){var e;let t={},i=this.query;return t.scAddress=i.address.bech32(),t.caller=!((e=i.caller)===null||e===void 0)&&e.bech32()?i.caller.bech32():void 0,t.funcName=i.func.toString(),t.value=i.value?i.value.toString():void 0,t.args=i.getEncodedArguments(),t}};Op.ContractQueryRequest=kv});var GO=B(Pp=>{"use strict";f();Object.defineProperty(Pp,"__esModule",{value:!0});Pp.Query=void 0;var UG=Gr(),qG=jf(),Wv=class{constructor(e){this.caller=e.caller||new UG.Address,this.address=e.address,this.func=e.func,this.args=e.args||[],this.value=e.value||0}getEncodedArguments(){return new qG.ArgSerializer().valuesToStrings(this.args)}};Pp.Query=Wv});var t6=B((bne,e6)=>{f();e6.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var is=B(vo=>{f();var $v,VG=[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];vo.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};vo.getSymbolTotalCodewords=function(e){return VG[e]};vo.getBCHDigit=function(r){let e=0;for(;r!==0;)e++,r>>>=1;return e};vo.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');$v=e};vo.isKanjiModeEnabled=function(){return typeof $v<"u"};vo.toSJIS=function(e){return $v(e)}});var Rp=B(Qr=>{f();Qr.L={bit:1};Qr.M={bit:0};Qr.Q={bit:3};Qr.H={bit:2};function HG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.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: "+r)}}Qr.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};Qr.from=function(e,t){if(Qr.isValid(e))return e;try{return HG(e)}catch{return t}}});var n6=B((Dne,i6)=>{f();function r6(){this.buffer=[],this.length=0}r6.prototype={get:function(r){let e=Math.floor(r/8);return(this.buffer[e]>>>7-r%8&1)===1},put:function(r,e){for(let t=0;t>>e-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),r&&(this.buffer[e]|=128>>>this.length%8),this.length++}};i6.exports=r6});var o6=B((Pne,s6)=>{f();function Sl(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}Sl.prototype.set=function(r,e,t,i){let n=r*this.size+e;this.data[n]=t,i&&(this.reservedBit[n]=!0)};Sl.prototype.get=function(r,e){return this.data[r*this.size+e]};Sl.prototype.xor=function(r,e,t){this.data[r*this.size+e]^=t};Sl.prototype.isReserved=function(r,e){return this.reservedBit[r*this.size+e]};s6.exports=Sl});var a6=B(Lp=>{f();var QG=is().getSymbolSize;Lp.getRowColCoords=function(e){if(e===1)return[];let t=Math.floor(e/7)+2,i=QG(e),n=i===145?26:Math.ceil((i-13)/(2*t-2))*2,s=[i-7];for(let o=1;o{f();var jG=is().getSymbolSize,u6=7;c6.getPositions=function(e){let t=jG(e);return[[0,0],[t-u6,0],[0,t-u6]]}});var f6=B($e=>{f();$e.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};$e.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};$e.from=function(e){return $e.isValid(e)?parseInt(e,10):void 0};$e.getPenaltyN1=function(e){let t=e.size,i=0,n=0,s=0,o=null,a=null;for(let u=0;u=5&&(i+=Eo.N1+(n-5)),o=p,n=1),p=e.get(h,u),p===a?s++:(s>=5&&(i+=Eo.N1+(s-5)),a=p,s=1)}n>=5&&(i+=Eo.N1+(n-5)),s>=5&&(i+=Eo.N1+(s-5))}return i};$e.getPenaltyN2=function(e){let t=e.size,i=0;for(let n=0;n=10&&(n===1488||n===93)&&i++,s=s<<1&2047|e.get(a,o),a>=10&&(s===1488||s===93)&&i++}return i*Eo.N3};$e.getPenaltyN4=function(e){let t=0,i=e.data.length;for(let s=0;s{f();var ns=Rp(),Fp=[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],Up=[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];Yv.getBlocksCount=function(e,t){switch(t){case ns.L:return Fp[(e-1)*4+0];case ns.M:return Fp[(e-1)*4+1];case ns.Q:return Fp[(e-1)*4+2];case ns.H:return Fp[(e-1)*4+3];default:return}};Yv.getTotalCodewordsCount=function(e,t){switch(t){case ns.L:return Up[(e-1)*4+0];case ns.M:return Up[(e-1)*4+1];case ns.Q:return Up[(e-1)*4+2];case ns.H:return Up[(e-1)*4+3];default:return}}});var h6=B(Vp=>{f();var xl=new Uint8Array(512),qp=new Uint8Array(256);(function(){let e=1;for(let t=0;t<255;t++)xl[t]=e,qp[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t++)xl[t]=xl[t-255]})();Vp.log=function(e){if(e<1)throw new Error("log("+e+")");return qp[e]};Vp.exp=function(e){return xl[e]};Vp.mul=function(e,t){return e===0||t===0?0:xl[qp[e]+qp[t]]}});var d6=B(Tl=>{f();var Xv=h6();Tl.mul=function(e,t){let i=new Uint8Array(e.length+t.length-1);for(let n=0;n=0;){let n=i[0];for(let o=0;o{f();var p6=d6();function Zv(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}Zv.prototype.initialize=function(e){this.degree=e,this.genPoly=p6.generateECPolynomial(this.degree)};Zv.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let t=new Uint8Array(e.length+this.degree);t.set(e);let i=p6.mod(t,this.genPoly),n=this.degree-i.length;if(n>0){let s=new Uint8Array(this.degree);return s.set(i,n),s}return i};g6.exports=Zv});var eE=B(m6=>{f();m6.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var tE=B(hn=>{f();var w6="[0-9]+",KG="[A-Z $%*+\\-./:]+",Nl="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Nl=Nl.replace(/u/g,"\\u");var zG="(?:(?![A-Z0-9 $%*+\\-./:]|"+Nl+`)(?:.|[\r +]))+`;hn.KANJI=new RegExp(Nl,"g");hn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");hn.BYTE=new RegExp(zG,"g");hn.NUMERIC=new RegExp(w6,"g");hn.ALPHANUMERIC=new RegExp(KG,"g");var kG=new RegExp("^"+Nl+"$"),WG=new RegExp("^"+w6+"$"),$G=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");hn.testKanji=function(e){return kG.test(e)};hn.testNumeric=function(e){return WG.test(e)};hn.testAlphanumeric=function(e){return $G.test(e)}});var ss=B(qt=>{f();var YG=eE(),rE=tE();qt.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};qt.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};qt.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};qt.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};qt.MIXED={bit:-1};qt.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!YG.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]};qt.getBestModeForData=function(e){return rE.testNumeric(e)?qt.NUMERIC:rE.testAlphanumeric(e)?qt.ALPHANUMERIC:rE.testKanji(e)?qt.KANJI:qt.BYTE};qt.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};qt.isValid=function(e){return e&&e.bit&&e.ccBits};function JG(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return qt.NUMERIC;case"alphanumeric":return qt.ALPHANUMERIC;case"kanji":return qt.KANJI;case"byte":return qt.BYTE;default:throw new Error("Unknown mode: "+r)}}qt.from=function(e,t){if(qt.isValid(e))return e;try{return JG(e)}catch{return t}}});var _6=B(Ao=>{f();var Hp=is(),XG=Jv(),v6=Rp(),os=ss(),iE=eE(),A6=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,E6=Hp.getBCHDigit(A6);function ZG(r,e,t){for(let i=1;i<=40;i++)if(e<=Ao.getCapacity(i,t,r))return i}function I6(r,e){return os.getCharCountIndicator(r,e)+4}function eK(r,e){let t=0;return r.forEach(function(i){let n=I6(i.mode,e);t+=n+i.getBitsLength()}),t}function tK(r,e){for(let t=1;t<=40;t++)if(eK(r,t)<=Ao.getCapacity(t,e,os.MIXED))return t}Ao.from=function(e,t){return iE.isValid(e)?parseInt(e,10):t};Ao.getCapacity=function(e,t,i){if(!iE.isValid(e))throw new Error("Invalid QR Code version");typeof i>"u"&&(i=os.BYTE);let n=Hp.getSymbolTotalCodewords(e),s=XG.getTotalCodewordsCount(e,t),o=(n-s)*8;if(i===os.MIXED)return o;let a=o-I6(i,e);switch(i){case os.NUMERIC:return Math.floor(a/10*3);case os.ALPHANUMERIC:return Math.floor(a/11*2);case os.KANJI:return Math.floor(a/13);case os.BYTE:default:return Math.floor(a/8)}};Ao.getBestVersionForData=function(e,t){let i,n=v6.from(t,v6.M);if(Array.isArray(e)){if(e.length>1)return tK(e,n);if(e.length===0)return 1;i=e[0]}else i=e;return ZG(i.mode,i.getLength(),n)};Ao.getEncodedBits=function(e){if(!iE.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;Hp.getBCHDigit(t)-E6>=0;)t^=A6<{f();var nE=is(),C6=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,rK=1<<14|1<<12|1<<10|1<<4|1<<1,b6=nE.getBCHDigit(C6);S6.getEncodedBits=function(e,t){let i=e.bit<<3|t,n=i<<10;for(;nE.getBCHDigit(n)-b6>=0;)n^=C6<{f();var iK=ss();function Vu(r){this.mode=iK.NUMERIC,this.data=r.toString()}Vu.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Vu.prototype.getLength=function(){return this.data.length};Vu.prototype.getBitsLength=function(){return Vu.getBitsLength(this.data.length)};Vu.prototype.write=function(e){let t,i,n;for(t=0;t+3<=this.data.length;t+=3)i=this.data.substr(t,3),n=parseInt(i,10),e.put(n,10);let s=this.data.length-t;s>0&&(i=this.data.substr(t),n=parseInt(i,10),e.put(n,s*3+1))};T6.exports=Vu});var O6=B((ose,D6)=>{f();var nK=ss(),sE=["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 Hu(r){this.mode=nK.ALPHANUMERIC,this.data=r}Hu.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};Hu.prototype.getLength=function(){return this.data.length};Hu.prototype.getBitsLength=function(){return Hu.getBitsLength(this.data.length)};Hu.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=sE.indexOf(this.data[t])*45;i+=sE.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(sE.indexOf(this.data[t]),6)};D6.exports=Hu});var B6=B((use,P6)=>{"use strict";f();P6.exports=function(e){for(var t=[],i=e.length,n=0;n=55296&&s<=56319&&i>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(s=(s-55296)*1024+o-56320+65536,n+=1)}if(s<128){t.push(s);continue}if(s<2048){t.push(s>>6|192),t.push(s&63|128);continue}if(s<55296||s>=57344&&s<65536){t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128);continue}if(s>=65536&&s<=1114111){t.push(s>>18|240),t.push(s>>12&63|128),t.push(s>>6&63|128),t.push(s&63|128);continue}t.push(239,191,189)}return new Uint8Array(t).buffer}});var R6=B((lse,M6)=>{f();var sK=B6(),oK=ss();function Qu(r){this.mode=oK.BYTE,typeof r=="string"&&(r=sK(r)),this.data=new Uint8Array(r)}Qu.getBitsLength=function(e){return e*8};Qu.prototype.getLength=function(){return this.data.length};Qu.prototype.getBitsLength=function(){return Qu.getBitsLength(this.data.length)};Qu.prototype.write=function(r){for(let e=0,t=this.data.length;e{f();var aK=ss(),uK=is();function ju(r){this.mode=aK.KANJI,this.data=r}ju.getBitsLength=function(e){return e*13};ju.prototype.getLength=function(){return this.data.length};ju.prototype.getBitsLength=function(){return ju.getBitsLength(this.data.length)};ju.prototype.write=function(r){let e;for(e=0;e=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+` +Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),r.put(t,13)}};L6.exports=ju});var U6=B((pse,oE)=>{"use strict";f();var Dl={single_source_shortest_paths:function(r,e,t){var i={},n={};n[e]=0;var s=Dl.PriorityQueue.make();s.push(e,0);for(var o,a,u,h,p,w,N,O,T;!s.empty();){o=s.pop(),a=o.value,h=o.cost,p=r[a]||{};for(u in p)p.hasOwnProperty(u)&&(w=p[u],N=h+w,O=n[u],T=typeof n[u]>"u",(T||O>N)&&(n[u]=N,s.push(u,N),i[u]=a))}if(typeof t<"u"&&typeof n[t]>"u"){var V=["Could not find a path from ",e," to ",t,"."].join("");throw new Error(V)}return i},extract_shortest_path_from_predecessor_list:function(r,e){for(var t=[],i=e,n;i;)t.push(i),n=r[i],i=r[i];return t.reverse(),t},find_path:function(r,e,t){var i=Dl.single_source_shortest_paths(r,e,t);return Dl.extract_shortest_path_from_predecessor_list(i,t)},PriorityQueue:{make:function(r){var e=Dl.PriorityQueue,t={},i;r=r||{};for(i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t.queue=[],t.sorter=r.sorter||e.default_sorter,t},default_sorter:function(r,e){return r.cost-e.cost},push:function(r,e){var t={value:r,cost:e};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof oE<"u"&&(oE.exports=Dl)});var z6=B(Gu=>{f();var Qe=ss(),H6=N6(),Q6=O6(),j6=R6(),G6=F6(),Ol=tE(),Qp=is(),cK=U6();function q6(r){return unescape(encodeURIComponent(r)).length}function Pl(r,e,t){let i=[],n;for(;(n=r.exec(t))!==null;)i.push({data:n[0],index:n.index,mode:e,length:n[0].length});return i}function K6(r){let e=Pl(Ol.NUMERIC,Qe.NUMERIC,r),t=Pl(Ol.ALPHANUMERIC,Qe.ALPHANUMERIC,r),i,n;return Qp.isKanjiModeEnabled()?(i=Pl(Ol.BYTE,Qe.BYTE,r),n=Pl(Ol.KANJI,Qe.KANJI,r)):(i=Pl(Ol.BYTE_KANJI,Qe.BYTE,r),n=[]),e.concat(t,i,n).sort(function(o,a){return o.index-a.index}).map(function(o){return{data:o.data,mode:o.mode,length:o.length}})}function aE(r,e){switch(e){case Qe.NUMERIC:return H6.getBitsLength(r);case Qe.ALPHANUMERIC:return Q6.getBitsLength(r);case Qe.KANJI:return G6.getBitsLength(r);case Qe.BYTE:return j6.getBitsLength(r)}}function lK(r){return r.reduce(function(e,t){let i=e.length-1>=0?e[e.length-1]:null;return i&&i.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function fK(r){let e=[];for(let t=0;t{f();var Gp=is(),uE=Rp(),dK=n6(),pK=o6(),gK=a6(),yK=l6(),fE=f6(),hE=Jv(),mK=y6(),jp=_6(),wK=x6(),vK=ss(),cE=z6();function EK(r,e){let t=r.size,i=yK.getPositions(e);for(let n=0;n=0&&a<=6&&(u===0||u===6)||u>=0&&u<=6&&(a===0||a===6)||a>=2&&a<=4&&u>=2&&u<=4?r.set(s+a,o+u,!0,!0):r.set(s+a,o+u,!1,!0))}}function AK(r){let e=r.size;for(let t=8;t>a&1)===1,r.set(n,s,o,!0),r.set(s,n,o,!0)}function lE(r,e,t){let i=r.size,n=wK.getEncodedBits(e,t),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?r.set(s,8,o,!0):s<8?r.set(s+1,8,o,!0):r.set(i-15+s,8,o,!0),s<8?r.set(8,i-s-1,o,!0):s<9?r.set(8,15-s-1+1,o,!0):r.set(8,15-s-1,o,!0);r.set(i-8,8,1,!0)}function bK(r,e){let t=r.size,i=-1,n=t-1,s=7,o=0;for(let a=t-1;a>0;a-=2)for(a===6&&a--;;){for(let u=0;u<2;u++)if(!r.isReserved(n,a-u)){let h=!1;o>>s&1)===1),r.set(n,a-u,h),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||t<=n){n-=i,i=-i;break}}}function CK(r,e,t){let i=new dK;t.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),vK.getCharCountIndicator(u.mode,r)),u.write(i)});let n=Gp.getSymbolTotalCodewords(r),s=hE.getTotalCodewordsCount(r,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);let a=(o-i.getLengthInBits())/8;for(let u=0;u=7&&IK(u,e),_K(u,o),isNaN(i)&&(i=fE.getBestMask(u,lE.bind(null,u,t))),fE.applyMask(i,u),lE(u,t,i),{modules:u,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}z6.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=uE.M,n,s;return typeof t<"u"&&(i=uE.from(t.errorCorrectionLevel,uE.M),n=jp.from(t.version),s=fE.from(t.maskPattern),t.toSJISFunc&&Gp.setToSJISFunction(t.toSJISFunc)),SK(e,n,i,s)}});var dE=B(Ao=>{f();function W6(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}Ao.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:W6(e.color.dark||"#000000ff"),light:W6(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Ao.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};Ao.getImageWidth=function(e,t){let i=Ao.getScale(e,t);return Math.floor((e+t.margin*2)*i)};Ao.qrToImageData=function(e,t,i){let n=t.modules.size,s=t.modules.data,o=Ao.getScale(n,i),a=Math.floor((n+i.margin*2)*o),u=i.margin*o,h=[i.color.light,i.color.dark];for(let p=0;p=u&&w>=u&&p{f();var pE=dE();function xK(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function TK(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Kp.render=function(e,t,i){let n=i,s=t;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),t||(s=TK()),n=pE.getOptions(n);let o=pE.getImageWidth(e.modules.size,n),a=s.getContext("2d"),u=a.createImageData(o,o);return pE.qrToImageData(u.data,e,n),xK(a,s,o),a.putImageData(u,0,0),s};Kp.renderToDataURL=function(e,t,i){let n=i;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),n||(n={});let s=Kp.render(e,t,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}});var X6=B(J6=>{f();var NK=dE();function Y6(r,e){let t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function gE(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function DK(r,e,t){let i="",n=0,s=!1,o=0;for(let a=0;a0&&u>0&&r[a-1]||(i+=s?gE("M",u+t,.5+h+t):gE("m",n,0),n=0,s=!1),u+1':"",h="',p='viewBox="0 0 '+a+" "+a+'"',N=''+u+h+` -`;return typeof i=="function"&&i(null,N),N}});var e8=B(Bl=>{f();var OK=e6(),yE=k6(),Z6=$6(),PK=X6();function mE(r,e,t,i,n){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!OK())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=t,t=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(t=e,e=i=void 0):o===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(u,h){try{let p=yE.create(t,i);u(r(p,e,i))}catch(p){h(p)}})}try{let u=yE.create(t,i);n(null,r(u,e,i))}catch(u){n(u)}}Bl.create=yE.create;Bl.toCanvas=mE.bind(null,Z6.render);Bl.toDataURL=mE.bind(null,Z6.renderToDataURL);Bl.toString=mE.bind(null,function(r,e,t){return PK.render(r,t)})});var h8=B(as=>{"use strict";f();var GK=as&&as.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),f8=as&&as.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&GK(e,r,t)};Object.defineProperty(as,"__esModule",{value:!0});f8(vl(),as);f8(Uv(),as)});f();var KK=_e(og()),w8=_e($I()),zK=_e(Gr()),kK=_e(zf()),WK=_e(jy()),$K=_e(sc()),YK=_e(Wy()),JK=_e(mn()),v8=_e(ic()),XK=_e(ec()),ZK=_e(cy()),ez=_e(Yb()),tz=_e(Go());f();f();var nC=_e(Zy());f();f();var nh="elvenjs_state",tC="https://devnet-api.multiversx.com";var sh="/dapp/init",oh="devnet",rC="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",iC=["wss://relay.walletconnect.com"],xi={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.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",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",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Ne={get(r){let e=localStorage.getItem(nh);if(!e)return{};let t=JSON.parse(e);return r?t[r]:t},set(r,e){let t=this.get();t[r]=e,localStorage.setItem(nh,JSON.stringify(t))},clear(){localStorage.removeItem(nh)}};var ah=()=>Te(void 0,null,function*(){let r=nC.ExtensionProvider.getInstance();try{let e=yield r.init(),t=Ne.get();if(t!=null&&t.address&&r.setAddress(t.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return r}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var g8=_e(Zy()),y8=_e(dl()),m8=_e(vl());f();var _O=_e(dl());f();f();var De=class{static set(e,t){if(!e)return;let i=OE(_o({},this.events),{[e]:t});this.events=i}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...t){var i,n;!e||!this.events||(n=(i=this.events)[e])==null||n.call(i,...t)}static clear(){this.events=void 0}};f();var yo=(n=>(n.ledger="ledger",n.mobile="mobile",n.webWallet="web-wallet",n.browserExtension="browser-extension",n))(yo||{});var Pu=r=>Te(void 0,null,function*(){if(!r.dappProvider)throw new Error("Error: Logout failed: There is no active session!");De.run("onLoginPending");let e=yield r.dappProvider.logout();return e&&(Ne.clear(),De.run("onLogout")),e});f();var AO=_e(Gr()),IO=_e(zf());f();var Xt=r=>typeof r=="string"?r.toUpperCase():r instanceof Error?r.message:`Error: ${JSON.stringify(r)}`;f();var Bu=()=>new Date().setHours(new Date().getHours()+24),bp=r=>Date.now()>r;var ts=r=>Te(void 0,null,function*(){let e=Ne.get("address"),t=Ne.get("expires");if(!(t&&bp(t))&&e&&r.networkProvider){let n=new AO.Address(e),s=new IO.Account(n);try{let o=yield r.networkProvider.getAccount(n);Ne.set("address",e),Ne.set("nonce",o.nonce.valueOf()),Ne.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});f();function Cp(r){return r[Math.floor(Math.random()*r.length)]}var bO=r=>Te(void 0,null,function*(){if(!r.initOptions.walletConnectV2ProjectId||!r.initOptions.chainType)return;let e={onClientLogin:()=>{ts(r),De.run("onLoggedIn")},onClientLogout:()=>Pu(r),onClientEvent:n=>{console.log("wc2 session event: ",n)}},t=Cp(r.initOptions.walletConnectV2RelayAddresses),i=new _O.WalletConnectV2Provider(e,xi[r.initOptions.chainType].shortId,t,r.initOptions.walletConnectV2ProjectId);try{return yield i.init(),i}catch(n){console.warn("Can't initialize the Dapp Provider!")}});f();var GO=_e(xO()),Bp=_e(Gr()),KO=_e(TO()),zO=_e(BO()),kO=_e(zv()),WO=_e(qO()),$O=_e(HO()),YO=_e(QO()),JO=_e(jO());var Mp=class{constructor({apiUrl:e,chainType:t,apiTimeout:i}){var n,s;this.chainType=t||oh,this.apiUrl=e||((n=xi[this.chainType])==null?void 0:n.apiAddress),this.apiTimeout=i||((s=xi[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,t){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,n=setTimeout(()=>i.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:i.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,t||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(n),Promise.reject(u)}return clearTimeout(n),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,t,i){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,s=setTimeout(()=>n.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t||{}),signal:n.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,i||{})),u=yield a.json();if(!a.ok){let h=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(h)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,t){if(!e.response)throw new Error(`Request error on url [${t}]: [${e.toString()}]`);let i=e.response.data,n=i.error||i.message||JSON.stringify(i);throw new Error(n)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let t=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Bp.Address((t==null?void 0:t.address)||""),nonce:Number((t==null?void 0:t.nonce)||0),balance:new GO.default((t==null?void 0:t.balance)||0),code:(t==null?void 0:t.code)||"",userName:(t==null?void 0:t.username)||""}})}getTransaction(e){return Te(this,null,function*(){let t=yield this.apiGet(`transactions/${e}`),i=new KO.TransactionStatus(t.status);return{hash:e,type:t.type||"",nonce:t.nonce||0,round:t.round,epoch:t.epoch||0,value:(t.value||0).toString(),sender:new Bp.Address(t.sender),receiver:new Bp.Address(t.receiver),gasPrice:t.gasPrice||0,gasLimit:t.gasLimit||0,data:y.Buffer.from(t.data||"","base64"),status:i,timestamp:t.timestamp||0,blockNonce:t.blockNonce||0,hyperblockNonce:t.hyperblockNonce||0,hyperblockHash:t.hyperblockHash||"",receipt:zO.TransactionReceipt.fromHttpResponse(t.receipt||{}),logs:kO.TransactionLogs.fromHttpResponse(t.logs||{}),contractResults:WO.ContractResults.fromApiHttpResponse(t.results||[]),isCompleted:!i.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i,value:n,caller:s}){try{let a=new JO.Query({address:e,func:t,args:i,value:n,caller:s}),u=new YO.ContractQueryRequest(a).toHttpRequest(),h=yield this.apiPost("query",u);return $O.ContractQueryResponse.fromHttpResponse(h)}catch(a){this.handleApiError(a,"query")}})}};f();var XO=(r,e)=>Te(void 0,null,function*(){let t=yield ah();try{t&&(yield t.login()),De.run("onLoginPending")}catch(n){let s=Xt(n);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!t)throw new Error("Error: There were problems with auth provider initialization!");let{signature:i}=t.account;if(e&&Ne.set("loginToken",e),i&&Ne.set("signature",i),r.networkProvider)try{let n=yield t.getAddress();if(!n)throw new Error("Canceled!");return Ne.set("address",n),Ne.set("loginMethod","browser-extension"),Ne.set("expires",Bu()),yield ts(r),t}catch(n){console.warn(`Something went wrong trying to synchronize the user account: ${n==null?void 0:n.message}`)}finally{De.run("onLoggedIn")}});f();f();var t8=_e(e8()),r8=_e(dl());var MK=r=>{var t;let e=document.createElement("template");return e.innerHTML=r.trim(),(t=e.content.firstChild)==null?void 0:t.cloneNode(!0)},RK=r=>{let e=`${rC}?wallet-connect=${encodeURIComponent(r)}`,t=document.createElement("a");return t.setAttribute("href",e),t.setAttribute("rel","noopener noreferrer nofollow"),t.setAttribute("target","_blank"),t.textContent="Maiar login",t.classList.add("elven-qr-code-deep-link"),t},LK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairings"),r},FK=()=>{let r=document.createElement("div");return r.textContent="Existing WalletConnect pairings:",r.classList.add("elven-wc-pairings-header"),r},wE={},UK=(r,e)=>{let t=document.createElement("button");return t.classList.add("elven-wc-pairings-remove-btn"),t.textContent="\u2716",wE[r.topic]=new AbortController,t.addEventListener("click",()=>e(r.topic),{signal:wE[r.topic].signal}),t},zp={},qK=(r,e,t)=>{var o,a;let i=document.createElement("div"),n=document.createElement("div");i.classList.add("elven-wc-pairing-item"),i.setAttribute("id",r.topic),n.classList.add("elven-wc-pairing-item-description"),n.textContent=`${(o=r.peerMetadata)==null?void 0:o.description} (${(a=r.peerMetadata)==null?void 0:a.url})`,i.appendChild(n);let s=UK(r,e);return i.appendChild(s),zp[r.topic]=new AbortController,i.addEventListener("click",()=>t(r.topic),{signal:zp[r.topic].signal}),i},VK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairing-item-confirm-msessage"),r.innerText="Confirm on xPortal app!",r},HK=r=>{if(!r)return;let e=document.getElementById(r);e==null||e.remove()},QK=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),jK=r=>Te(void 0,null,function*(){return r?yield t8.default.toString(r,{type:"svg"}):void 0}),i8=(r,e,t,i)=>Te(void 0,null,function*(){if(!r)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let n=null;typeof r=="string"?n=document.getElementById(r):r instanceof HTMLElement&&(n=r);let s=yield jK(e),o;if(s&&(o=MK(s)),n&&o&&(n.replaceChildren(),n.appendChild(o),QK()&&n.appendChild(RK(e))),n&&t instanceof r8.WalletConnectV2Provider){let a=t.pairings,u=p=>Te(void 0,null,function*(){try{p&&(yield t.logout({topic:p}),HK(p))}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to remove the existing pairing: ${N}`)}finally{zp[p].abort()}}),h=p=>Te(void 0,null,function*(){try{let{approval:w}=yield t.connect({topic:p,methods:["erd_cancelAction"]}),N=document.getElementById(p);N==null||N.after(VK()),yield t.login({approval:w,token:i})}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to login the user: ${N}`)}finally{for(let w of Object.values(zp))w==null||w.abort();for(let w of Object.values(wE))w==null||w.abort()}});if(a&&a.length>0){let p=LK();n.appendChild(p);let w=FK();p.appendChild(w);for(let N of a){let O=qK(N,u,h);p.appendChild(O)}}}return n});var kp=_e(dl());var n8=(r,e,t)=>Te(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let i=Cp(r.initOptions.walletConnectV2RelayAddresses);if(!i||!r.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!r.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!r.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let n,s={onClientLogin:()=>Te(void 0,null,function*(){if(r.dappProvider instanceof kp.WalletConnectV2Provider){De.run("onLoginPending");let a=yield r.dappProvider.getAddress(),u=yield r.dappProvider.getSignature();Ne.set("address",a),Ne.set("loginMethod","mobile"),Ne.set("expires",Bu()),yield ts(r),u&&Ne.set("signature",u),t&&Ne.set("loginToken",t),De.run("onLoggedIn"),n==null||n.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){r.dappProvider instanceof kp.WalletConnectV2Provider&&(yield Pu(r),De.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new kp.WalletConnectV2Provider(s,xi[r.initOptions.chainType].shortId,i,r.initOptions.walletConnectV2ProjectId);try{if(o){r.dappProvider=o,De.run("onQrPending");let{uri:a,approval:u}=yield o.connect({methods:["erd_cancelAction"]}),h=t?`${a}&token=${t}`:a;return e&&h&&(n=yield i8(e,h,o,t),De.run("onQrLoaded")),yield o.login({approval:u,token:t}),o}}catch(a){let u=Xt(a);console.warn(`Something went wrong trying to login the user: ${u}`)}});f();var s8=_e(vl());var o8=(r,e,t)=>Te(void 0,null,function*(){let i=new s8.WalletProvider(`${r}${sh}`),n=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=_o({callbackUrl:n},t?{token:t}:{});try{return De.run("onLoginPending"),Ne.set("loginMethod","web-wallet"),yield i.login(s),Ne.set("expires",Bu()),t&&Ne.set("loginToken",t),i}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Ne.set("loginMethod","")}});f();var Io=r=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(r)}};f();var a8=_e(vl());var u8=r=>Te(void 0,null,function*(){let e=Io("signature"),t=Io("address"),i=Ne.get("address");if(e&&Ne.set("signature",e),t||i)return t&&(Ne.set("address",t),window.history.replaceState(null,"",window.location.pathname)),new a8.WalletProvider(`${r}${sh}`)});f();var c8=_e(zf()),l8=_e(Wy());var Wp=(r,e)=>Te(void 0,null,function*(){De.run("onTxSent",r),yield new l8.TransactionWatcher(e).awaitCompleted(r);let i=r.getSender(),n=new c8.Account(i),s=yield e.getAccount(i);n.update(s),Ne.set("address",n.address.bech32()),Ne.set("nonce",n.getNonceThenIncrement().valueOf()),Ne.set("balance",n.balance.toString()),De.run("onTxFinalized",r)});f();var $p=_e(h8()),d8=_e(jy());var p8=(r,e,t)=>Te(void 0,null,function*(){if(Io($p.WALLET_PROVIDER_CALLBACK_PARAM)===$p.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&r&&e&&"getTransactionsFromWalletUrl"in r){let n=r.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=n==null?void 0:n[0];if(s){s.data=y.Buffer.from(s.data).toString("base64");let o=d8.Transaction.fromPlainObject(s);o.setNonce(t);try{De.run("onTxStarted",o),yield e.sendTransaction(o),yield Wp(o,e)}catch(a){let u=Xt(a);throw De.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Rl=class{static init(e){return Te(this,null,function*(){let t=Ne.get();if(t.expires&&bp(t.expires)){Ne.clear(),this.dappProvider=void 0;return}this.initOptions=_o({chainType:oh,apiUrl:tC,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:iC},e),this.networkProvider=new Mp(this.initOptions),this.initOptions.onLoginPending&&De.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&De.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&De.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&De.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&De.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&De.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&De.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&De.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&De.set("onTxError",this.initOptions.onTxError),((t==null?void 0:t.address)||t.loginMethod==="web-wallet"&&Io("address"))&&(t!=null&&t.loginMethod)&&(De.run("onLoginPending"),t.loginMethod==="browser-extension"&&(this.dappProvider=yield ah()),t.loginMethod==="mobile"&&(this.dappProvider=yield bO(this)),t.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield u8(xi[this.initOptions.chainType].walletAddress)),yield ts(this),De.run("onLoggedIn"),t.loginMethod==="web-wallet"&&(yield p8(this.dappProvider,this.networkProvider,t.nonce)))})}static login(e,t){return Te(this,null,function*(){var n;if(!Object.values(yo).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield XO(this,t==null?void 0:t.token);this.dappProvider=s}if(e==="mobile"){let s=yield n8(this,t==null?void 0:t.qrCodeContainer,t==null?void 0:t.token);this.dappProvider=s}if(e==="web-wallet"&&((n=this.initOptions)!=null&&n.chainType)){let s=yield o8(xi[this.initOptions.chainType].walletAddress,t==null?void 0:t.callbackRoute,t==null?void 0:t.token);this.dappProvider=s}}catch(s){let o=Xt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Te(this,null,function*(){try{let e=yield Pu(this);return this.dappProvider=void 0,e}catch(e){let t=Xt(e);console.warn("Something went wrong when logging out: ",t)}})}static signAndSendTransaction(e){return Te(this,null,function*(){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!");try{De.run("onTxStarted",e);let t=Ne.get();e.setNonce(t.nonce),this.dappProvider instanceof g8.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof y8.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof m8.WalletProvider&&(yield this.dappProvider.signTransaction(e)),t.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Wp(e,this.networkProvider))}catch(t){let i=Xt(t);throw De.run("onTxError",e,i),new Error(`Error: Transaction signing failed! ${i}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i=[],value:n=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!t)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:t,args:i,value:n,caller:s})}catch(a){let u=Xt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},Ml=Rl;Ml.storage=Ne,Ml.destroy=()=>{Rl.networkProvider=void 0,Rl.dappProvider=void 0,Rl.initOptions=void 0,De.clear()};var export_Account=kK.Account;var export_Address=zK.Address;var export_AddressValue=tz.AddressValue;var export_BigUIntValue=v8.BigUIntValue;var export_BooleanValue=XK.BooleanValue;var export_BytesValue=JK.BytesValue;var export_ContractCallPayloadBuilder=ZK.ContractCallPayloadBuilder;var export_ContractFunction=ez.ContractFunction;var export_ESDTNFTTransferPayloadBuilder=w8.ESDTNFTTransferPayloadBuilder;var export_ESDTTransferPayloadBuilder=w8.ESDTTransferPayloadBuilder;var export_TokenPayment=KK.TokenPayment;var export_Transaction=WK.Transaction;var export_TransactionPayload=$K.TransactionPayload;var export_TransactionWatcher=YK.TransactionWatcher;var export_U32Value=v8.U32Value;export{export_Account as Account,export_Address as Address,export_AddressValue as AddressValue,export_BigUIntValue as BigUIntValue,export_BooleanValue as BooleanValue,export_BytesValue as BytesValue,export_ContractCallPayloadBuilder as ContractCallPayloadBuilder,export_ContractFunction as ContractFunction,export_ESDTNFTTransferPayloadBuilder as ESDTNFTTransferPayloadBuilder,export_ESDTTransferPayloadBuilder as ESDTTransferPayloadBuilder,Ml as ElvenJS,yo as LoginMethodsEnum,export_TokenPayment as TokenPayment,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_U32Value as U32Value}; +`);let o=CK(e,t,n),a=Gp.getSymbolSize(e),u=new pK(a);return EK(u,e),AK(u),IK(u,e),lE(u,t,0),e>=7&&_K(u,e),bK(u,o),isNaN(i)&&(i=fE.getBestMask(u,lE.bind(null,u,t))),fE.applyMask(i,u),lE(u,t,i),{modules:u,version:e,errorCorrectionLevel:t,maskPattern:i,segments:n}}k6.create=function(e,t){if(typeof e>"u"||e==="")throw new Error("No input text");let i=uE.M,n,s;return typeof t<"u"&&(i=uE.from(t.errorCorrectionLevel,uE.M),n=jp.from(t.version),s=fE.from(t.maskPattern),t.toSJISFunc&&Gp.setToSJISFunction(t.toSJISFunc)),xK(e,n,i,s)}});var dE=B(Io=>{f();function $6(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let e=r.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+r);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(i){return[i,i]}))),e.length===6&&e.push("F","F");let t=parseInt(e.join(""),16);return{r:t>>24&255,g:t>>16&255,b:t>>8&255,a:t&255,hex:"#"+e.slice(0,6).join("")}}Io.getOptions=function(e){e||(e={}),e.color||(e.color={});let t=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,i=e.width&&e.width>=21?e.width:void 0,n=e.scale||4;return{width:i,scale:i?4:n,margin:t,color:{dark:$6(e.color.dark||"#000000ff"),light:$6(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};Io.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale};Io.getImageWidth=function(e,t){let i=Io.getScale(e,t);return Math.floor((e+t.margin*2)*i)};Io.qrToImageData=function(e,t,i){let n=t.modules.size,s=t.modules.data,o=Io.getScale(n,i),a=Math.floor((n+i.margin*2)*o),u=i.margin*o,h=[i.color.light,i.color.dark];for(let p=0;p=u&&w>=u&&p{f();var pE=dE();function TK(r,e,t){r.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=t,e.width=t,e.style.height=t+"px",e.style.width=t+"px"}function NK(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Kp.render=function(e,t,i){let n=i,s=t;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),t||(s=NK()),n=pE.getOptions(n);let o=pE.getImageWidth(e.modules.size,n),a=s.getContext("2d"),u=a.createImageData(o,o);return pE.qrToImageData(u.data,e,n),TK(a,s,o),a.putImageData(u,0,0),s};Kp.renderToDataURL=function(e,t,i){let n=i;typeof n>"u"&&(!t||!t.getContext)&&(n=t,t=void 0),n||(n={});let s=Kp.render(e,t,n),o=n.type||"image/png",a=n.rendererOpts||{};return s.toDataURL(o,a.quality)}});var Z6=B(X6=>{f();var DK=dE();function J6(r,e){let t=r.a/255,i=e+'="'+r.hex+'"';return t<1?i+" "+e+'-opacity="'+t.toFixed(2).slice(1)+'"':i}function gE(r,e,t){let i=r+e;return typeof t<"u"&&(i+=" "+t),i}function OK(r,e,t){let i="",n=0,s=!1,o=0;for(let a=0;a0&&u>0&&r[a-1]||(i+=s?gE("M",u+t,.5+h+t):gE("m",n,0),n=0,s=!1),u+1':"",h="',p='viewBox="0 0 '+a+" "+a+'"',N=''+u+h+` +`;return typeof i=="function"&&i(null,N),N}});var t8=B(Bl=>{f();var PK=t6(),yE=W6(),e8=Y6(),BK=Z6();function mE(r,e,t,i,n){let s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!PK())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=t,t=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=t,t=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(t=e,e=i=void 0):o===2&&!e.getContext&&(i=t,t=e,e=void 0),new Promise(function(u,h){try{let p=yE.create(t,i);u(r(p,e,i))}catch(p){h(p)}})}try{let u=yE.create(t,i);n(null,r(u,e,i))}catch(u){n(u)}}Bl.create=yE.create;Bl.toCanvas=mE.bind(null,e8.render);Bl.toDataURL=mE.bind(null,e8.renderToDataURL);Bl.toString=mE.bind(null,function(r,e,t){return BK.render(r,t)})});var d8=B(as=>{"use strict";f();var KK=as&&as.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),h8=as&&as.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&KK(e,r,t)};Object.defineProperty(as,"__esModule",{value:!0});h8(vl(),as);h8(Uv(),as)});f();var zK=_e(og()),v8=_e($I()),kK=_e(Gr()),WK=_e(zf()),$K=_e(jy()),YK=_e(sc()),JK=_e(Wy()),XK=_e(wn()),E8=_e(ic()),ZK=_e(ec()),ez=_e(cy()),tz=_e(Yb()),rz=_e(Ko());f();f();var nC=_e(Zy());f();f();var nh="elvenjs_state",tC="https://devnet-api.multiversx.com";var sh="/dapp/init",oh="devnet",rC="https://maiar.page.link/?apn=com.elrond.maiar.wallet&isi=1519405832&ibi=com.elrond.maiar.wallet&link=https://xportal.com/",iC=["wss://relay.walletconnect.com"],xi={devnet:{id:"devnet",shortId:"D",name:"Devnet",egldLabel:"xEGLD",egldDenomination:"18",decimals:"4",gasPerDataByte:"1500",walletAddress:"https://devnet-wallet.multiversx.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",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",apiAddress:"https://api.multiversx.com",explorerAddress:"https://explorer.multiversx.com",apiTimeout:1e4}};var Ne={get(r){let e=localStorage.getItem(nh);if(!e)return{};let t=JSON.parse(e);return r?t[r]:t},set(r,e){let t=this.get();t[r]=e,localStorage.setItem(nh,JSON.stringify(t))},clear(){localStorage.removeItem(nh)}};var ah=()=>Te(void 0,null,function*(){let r=nC.ExtensionProvider.getInstance();try{let e=yield r.init(),t=Ne.get();if(t!=null&&t.address&&r.setAddress(t.address),!e){console.warn("Something went wrong when trying to initialize the ExtensionProvider..");return}return r}catch(e){console.warn("Can't initialize the Dapp Provider!")}});var y8=_e(Zy()),m8=_e(dl()),w8=_e(vl());f();var bO=_e(dl());f();f();var De=class{static set(e,t){if(!e)return;let i=OE(bo({},this.events),{[e]:t});this.events=i}static get(e){if(!(!e||!this.events))return this.events[e]}static run(e,...t){var i,n;!e||!this.events||(n=(i=this.events)[e])==null||n.call(i,...t)}static clear(){this.events=void 0}};f();var mo=(n=>(n.ledger="ledger",n.mobile="mobile",n.webWallet="web-wallet",n.browserExtension="browser-extension",n))(mo||{});var Pu=r=>Te(void 0,null,function*(){if(!r.dappProvider)throw new Error("Error: Logout failed: There is no active session!");De.run("onLoginPending");let e=yield r.dappProvider.logout();return e&&(Ne.clear(),De.run("onLogout")),e});f();var IO=_e(Gr()),_O=_e(zf());f();var Xt=r=>typeof r=="string"?r.toUpperCase():r instanceof Error?r.message:`Error: ${JSON.stringify(r)}`;f();var Bu=()=>new Date().setHours(new Date().getHours()+24),bp=r=>Date.now()>r;var ts=r=>Te(void 0,null,function*(){let e=Ne.get("address"),t=Ne.get("expires");if(!(t&&bp(t))&&e&&r.networkProvider){let n=new IO.Address(e),s=new _O.Account(n);try{let o=yield r.networkProvider.getAccount(n);Ne.set("address",e),Ne.set("nonce",o.nonce.valueOf()),Ne.set("balance",o.balance.toString()),s.update(o)}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to synchronize the user account: ${a}`)}}});f();function Cp(r){return r[Math.floor(Math.random()*r.length)]}var CO=r=>Te(void 0,null,function*(){if(!r.initOptions.walletConnectV2ProjectId||!r.initOptions.chainType)return;let e={onClientLogin:()=>{ts(r),De.run("onLoggedIn")},onClientLogout:()=>Pu(r),onClientEvent:n=>{console.log("wc2 session event: ",n)}},t=Cp(r.initOptions.walletConnectV2RelayAddresses),i=new bO.WalletConnectV2Provider(e,xi[r.initOptions.chainType].shortId,t,r.initOptions.walletConnectV2ProjectId);try{return yield i.init(),i}catch(n){console.warn("Can't initialize the Dapp Provider!")}});f();var KO=_e(TO()),Bp=_e(Gr()),zO=_e(NO()),kO=_e(MO()),WO=_e(zv()),$O=_e(VO()),YO=_e(QO()),JO=_e(jO()),XO=_e(GO());var Mp=class{constructor({apiUrl:e,chainType:t,apiTimeout:i}){var n,s;this.chainType=t||oh,this.apiUrl=e||((n=xi[this.chainType])==null?void 0:n.apiAddress),this.apiTimeout=i||((s=xi[this.chainType])==null?void 0:s.apiTimeout)}apiGet(e,t){return Te(this,null,function*(){if(typeof fetch!="undefined"){let i=new AbortController,n=setTimeout(()=>i.abort(),this.apiTimeout),s={method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"},signal:i.signal};try{let o=yield fetch(this.apiUrl+"/"+e,Object.assign(s,t||{})),a=yield o.json();if(!o.ok){let u=(a==null?void 0:a.error)||o.status;return clearTimeout(n),Promise.reject(u)}return clearTimeout(n),a}catch(o){this.handleApiError(o,e)}}})}apiPost(e,t,i){return Te(this,null,function*(){if(typeof fetch!="undefined"){let n=new AbortController,s=setTimeout(()=>n.abort(),this.apiTimeout),o={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t||{}),signal:n.signal};try{let a=yield fetch(this.apiUrl+"/"+e,Object.assign(o,i||{})),u=yield a.json();if(!a.ok){let h=(u==null?void 0:u.error)||a.status;return clearTimeout(s),Promise.reject(h)}return clearTimeout(s),u}catch(a){this.handleApiError(a,e)}}})}handleApiError(e,t){if(!e.response)throw new Error(`Request error on url [${t}]: [${e.toString()}]`);let i=e.response.data,n=i.error||i.message||JSON.stringify(i);throw new Error(n)}sendTransaction(e){return Te(this,null,function*(){return(yield this.apiPost("transactions",e.toSendable())).txHash})}getAccount(e){return Te(this,null,function*(){let t=yield this.apiGet(`accounts/${e.bech32()}`);return{address:new Bp.Address((t==null?void 0:t.address)||""),nonce:Number((t==null?void 0:t.nonce)||0),balance:new KO.default((t==null?void 0:t.balance)||0),code:(t==null?void 0:t.code)||"",userName:(t==null?void 0:t.username)||""}})}getTransaction(e){return Te(this,null,function*(){let t=yield this.apiGet(`transactions/${e}`),i=new zO.TransactionStatus(t.status);return{hash:e,type:t.type||"",nonce:t.nonce||0,round:t.round,epoch:t.epoch||0,value:(t.value||0).toString(),sender:new Bp.Address(t.sender),receiver:new Bp.Address(t.receiver),gasPrice:t.gasPrice||0,gasLimit:t.gasLimit||0,data:y.Buffer.from(t.data||"","base64"),status:i,timestamp:t.timestamp||0,blockNonce:t.blockNonce||0,hyperblockNonce:t.hyperblockNonce||0,hyperblockHash:t.hyperblockHash||"",receipt:kO.TransactionReceipt.fromHttpResponse(t.receipt||{}),logs:WO.TransactionLogs.fromHttpResponse(t.logs||{}),contractResults:$O.ContractResults.fromApiHttpResponse(t.results||[]),isCompleted:!i.isPending()}})}queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i,value:n,caller:s}){try{let a=new XO.Query({address:e,func:t,args:i,value:n,caller:s}),u=new JO.ContractQueryRequest(a).toHttpRequest(),h=yield this.apiPost("query",u);return YO.ContractQueryResponse.fromHttpResponse(h)}catch(a){this.handleApiError(a,"query")}})}};f();var ZO=(r,e)=>Te(void 0,null,function*(){let t=yield ah();try{t&&(yield t.login()),De.run("onLoginPending")}catch(n){let s=Xt(n);console.warn(`Something went wrong trying to login the user: ${s}`)}if(!t)throw new Error("Error: There were problems with auth provider initialization!");let{signature:i}=t.account;if(e&&Ne.set("loginToken",e),i&&Ne.set("signature",i),r.networkProvider)try{let n=yield t.getAddress();if(!n)throw new Error("Canceled!");return Ne.set("address",n),Ne.set("loginMethod","browser-extension"),Ne.set("expires",Bu()),yield ts(r),t}catch(n){console.warn(`Something went wrong trying to synchronize the user account: ${n==null?void 0:n.message}`)}finally{De.run("onLoggedIn")}});f();f();var r8=_e(t8()),i8=_e(dl());var RK=r=>{var t;let e=document.createElement("template");return e.innerHTML=r.trim(),(t=e.content.firstChild)==null?void 0:t.cloneNode(!0)},LK=r=>{let e=`${rC}?wallet-connect=${encodeURIComponent(r)}`,t=document.createElement("a");return t.setAttribute("href",e),t.setAttribute("rel","noopener noreferrer nofollow"),t.setAttribute("target","_blank"),t.textContent="Maiar login",t.classList.add("elven-qr-code-deep-link"),t},FK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairings"),r},UK=()=>{let r=document.createElement("div");return r.textContent="Existing WalletConnect pairings:",r.classList.add("elven-wc-pairings-header"),r},wE={},qK=(r,e)=>{let t=document.createElement("button");return t.classList.add("elven-wc-pairings-remove-btn"),t.textContent="\u2716",wE[r.topic]=new AbortController,t.addEventListener("click",()=>e(r.topic),{signal:wE[r.topic].signal}),t},zp={},VK=(r,e,t)=>{var o,a;let i=document.createElement("div"),n=document.createElement("div");i.classList.add("elven-wc-pairing-item"),i.setAttribute("id",r.topic),n.classList.add("elven-wc-pairing-item-description"),n.textContent=`${(o=r.peerMetadata)==null?void 0:o.description} (${(a=r.peerMetadata)==null?void 0:a.url})`,i.appendChild(n);let s=qK(r,e);return i.appendChild(s),zp[r.topic]=new AbortController,i.addEventListener("click",()=>t(r.topic),{signal:zp[r.topic].signal}),i},HK=()=>{let r=document.createElement("div");return r.classList.add("elven-wc-pairing-item-confirm-msessage"),r.innerText="Confirm on xPortal app!",r},QK=r=>{if(!r)return;let e=document.getElementById(r);e==null||e.remove()},jK=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),GK=r=>Te(void 0,null,function*(){return r?yield r8.default.toString(r,{type:"svg"}):void 0}),n8=(r,e,t,i)=>Te(void 0,null,function*(){if(!r)throw new Error("Please provide the QR Code and WalletConnect Pairings container id!");let n=null;typeof r=="string"?n=document.getElementById(r):r instanceof HTMLElement&&(n=r);let s=yield GK(e),o;if(s&&(o=RK(s)),n&&o&&(n.replaceChildren(),n.appendChild(o),jK()&&n.appendChild(LK(e))),n&&t instanceof i8.WalletConnectV2Provider){let a=t.pairings,u=p=>Te(void 0,null,function*(){try{p&&(yield t.logout({topic:p}),QK(p))}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to remove the existing pairing: ${N}`)}finally{zp[p].abort()}}),h=p=>Te(void 0,null,function*(){try{let{approval:w}=yield t.connect({topic:p,methods:["erd_cancelAction"]}),N=document.getElementById(p);N==null||N.after(HK()),yield t.login({approval:w,token:i})}catch(w){let N=Xt(w);console.warn(`Something went wrong trying to login the user: ${N}`)}finally{for(let w of Object.values(zp))w==null||w.abort();for(let w of Object.values(wE))w==null||w.abort()}});if(a&&a.length>0){let p=FK();n.appendChild(p);let w=UK();p.appendChild(w);for(let N of a){let O=VK(N,u,h);p.appendChild(O)}}}return n});var kp=_e(dl());var s8=(r,e,t)=>Te(void 0,null,function*(){if(!e)throw new Error("You haven't provided the QR code container DOM element id");let i=Cp(r.initOptions.walletConnectV2RelayAddresses);if(!i||!r.networkProvider)throw new Error("Something wen't wrong with the initialization (ApiNetworkProvider or Wallet Connect Bridge address), plese try to refresh the page!");if(!r.initOptions.walletConnectV2ProjectId)throw new Error("Please provide your WalletConnect project id. You can get it here: https://cloud.walletconnect.com)");if(!r.initOptions.chainType)throw new Error("Please provide the chain type in ElvenJS.init function!");let n,s={onClientLogin:()=>Te(void 0,null,function*(){if(r.dappProvider instanceof kp.WalletConnectV2Provider){De.run("onLoginPending");let a=yield r.dappProvider.getAddress(),u=yield r.dappProvider.getSignature();Ne.set("address",a),Ne.set("loginMethod","mobile"),Ne.set("expires",Bu()),yield ts(r),u&&Ne.set("signature",u),t&&Ne.set("loginToken",t),De.run("onLoggedIn"),n==null||n.replaceChildren()}}),onClientLogout:()=>Te(void 0,null,function*(){r.dappProvider instanceof kp.WalletConnectV2Provider&&(yield Pu(r),De.run("onLogout"))}),onClientEvent:a=>{console.log("wc2 session event: ",a)}},o=new kp.WalletConnectV2Provider(s,xi[r.initOptions.chainType].shortId,i,r.initOptions.walletConnectV2ProjectId);try{if(o){r.dappProvider=o,De.run("onQrPending");let{uri:a,approval:u}=yield o.connect({methods:["erd_cancelAction"]}),h=t?`${a}&token=${t}`:a;return e&&h&&(n=yield n8(e,h,o,t),De.run("onQrLoaded")),yield o.login({approval:u,token:t}),o}}catch(a){let u=Xt(a);console.warn(`Something went wrong trying to login the user: ${u}`)}});f();var o8=_e(vl());var a8=(r,e,t)=>Te(void 0,null,function*(){let i=new o8.WalletProvider(`${r}${sh}`),n=typeof window!="undefined"?encodeURIComponent(`${window.location.origin}${e||"/"}`):"/",s=bo({callbackUrl:n},t?{token:t}:{});try{return De.run("onLoginPending"),Ne.set("loginMethod","web-wallet"),yield i.login(s),Ne.set("expires",Bu()),t&&Ne.set("loginToken",t),i}catch(o){let a=Xt(o);console.warn(`Something went wrong trying to login the user: ${a}`),Ne.set("loginMethod","")}});f();var _o=r=>{if(typeof window!="undefined"){let e=new URL(window.location.href);return new URLSearchParams(e.search).get(r)}};f();var u8=_e(vl());var c8=r=>Te(void 0,null,function*(){let e=_o("signature"),t=_o("address"),i=Ne.get("address");if(e&&Ne.set("signature",e),t||i)return t&&(Ne.set("address",t),window.history.replaceState(null,"",window.location.pathname)),new u8.WalletProvider(`${r}${sh}`)});f();var l8=_e(zf()),f8=_e(Wy());var Wp=(r,e)=>Te(void 0,null,function*(){De.run("onTxSent",r),yield new f8.TransactionWatcher(e).awaitCompleted(r);let i=r.getSender(),n=new l8.Account(i),s=yield e.getAccount(i);n.update(s),Ne.set("address",n.address.bech32()),Ne.set("nonce",n.getNonceThenIncrement().valueOf()),Ne.set("balance",n.balance.toString()),De.run("onTxFinalized",r)});f();var $p=_e(d8()),p8=_e(jy());var g8=(r,e,t)=>Te(void 0,null,function*(){if(_o($p.WALLET_PROVIDER_CALLBACK_PARAM)===$p.WALLET_PROVIDER_CALLBACK_PARAM_TX_SIGNED&&r&&e&&"getTransactionsFromWalletUrl"in r){let n=r.getTransactionsFromWalletUrl();window.history.replaceState(null,"",window.location.pathname);let s=n==null?void 0:n[0];if(s){s.data=y.Buffer.from(s.data).toString("base64");let o=p8.Transaction.fromPlainObject(s);o.setNonce(t);try{De.run("onTxStarted",o),yield e.sendTransaction(o),yield Wp(o,e)}catch(a){let u=Xt(a);throw De.run("onTxError",o,u),new Error(`Error: Transaction signing failed! ${u}`)}}}});var Rl=class{static init(e){return Te(this,null,function*(){let t=Ne.get();if(t.expires&&bp(t.expires)){Ne.clear(),this.dappProvider=void 0;return}this.initOptions=bo({chainType:oh,apiUrl:tC,apiTimeout:1e4,walletConnectV2ProjectId:"",walletConnectV2RelayAddresses:iC},e),this.networkProvider=new Mp(this.initOptions),this.initOptions.onLoginPending&&De.set("onLoginPending",this.initOptions.onLoginPending),this.initOptions.onLoggedIn&&De.set("onLoggedIn",this.initOptions.onLoggedIn),this.initOptions.onQrPending&&De.set("onQrPending",this.initOptions.onQrPending),this.initOptions.onQrLoaded&&De.set("onQrLoaded",this.initOptions.onQrLoaded),this.initOptions.onLogout&&De.set("onLogout",this.initOptions.onLogout),this.initOptions.onTxStarted&&De.set("onTxStarted",this.initOptions.onTxStarted),this.initOptions.onTxSent&&De.set("onTxSent",this.initOptions.onTxSent),this.initOptions.onTxFinalized&&De.set("onTxFinalized",this.initOptions.onTxFinalized),this.initOptions.onTxError&&De.set("onTxError",this.initOptions.onTxError),((t==null?void 0:t.address)||t.loginMethod==="web-wallet"&&_o("address"))&&(t!=null&&t.loginMethod)&&(De.run("onLoginPending"),t.loginMethod==="browser-extension"&&(this.dappProvider=yield ah()),t.loginMethod==="mobile"&&(this.dappProvider=yield CO(this)),t.loginMethod==="web-wallet"&&this.initOptions.chainType&&(this.dappProvider=yield c8(xi[this.initOptions.chainType].walletAddress)),yield ts(this),De.run("onLoggedIn"),t.loginMethod==="web-wallet"&&(yield g8(this.dappProvider,this.networkProvider,t.nonce)))})}static login(e,t){return Te(this,null,function*(){var n;if(!Object.values(mo).includes(e))throw new Error("Error: Wrong login method!");if(!this.networkProvider)throw new Error("Error: Login failed: Use ElvenJs.init() first!");try{if(e==="browser-extension"){let s=yield ZO(this,t==null?void 0:t.token);this.dappProvider=s}if(e==="mobile"){let s=yield s8(this,t==null?void 0:t.qrCodeContainer,t==null?void 0:t.token);this.dappProvider=s}if(e==="web-wallet"&&((n=this.initOptions)!=null&&n.chainType)){let s=yield a8(xi[this.initOptions.chainType].walletAddress,t==null?void 0:t.callbackRoute,t==null?void 0:t.token);this.dappProvider=s}}catch(s){let o=Xt(s);throw new Error(`Error: ${o}`)}})}static logout(){return Te(this,null,function*(){try{let e=yield Pu(this);return this.dappProvider=void 0,e}catch(e){let t=Xt(e);console.warn("Something went wrong when logging out: ",t)}})}static signAndSendTransaction(e){return Te(this,null,function*(){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!");try{De.run("onTxStarted",e);let t=Ne.get();e.setNonce(t.nonce),this.dappProvider instanceof y8.ExtensionProvider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof m8.WalletConnectV2Provider&&(yield this.dappProvider.signTransaction(e)),this.dappProvider instanceof w8.WalletProvider&&(yield this.dappProvider.signTransaction(e)),t.loginMethod!=="web-wallet"&&(yield this.networkProvider.sendTransaction(e),yield Wp(e,this.networkProvider))}catch(t){let i=Xt(t);throw De.run("onTxError",e,i),new Error(`Error: Transaction signing failed! ${i}`)}return e})}static queryContract(o){return Te(this,arguments,function*({address:e,func:t,args:i=[],value:n=0,caller:s}){if(!this.networkProvider)throw new Error("Error: Query failed: There is no active network provider!");if(!e||!t)throw new Error("Error: Query failed: The Query arguments are not valid! Address and func required");try{return yield this.networkProvider.queryContract({address:e,func:t,args:i,value:n,caller:s})}catch(a){let u=Xt(a);throw new Error(`Error: Smart contract query failed! ${u}`)}})}},Ml=Rl;Ml.storage=Ne,Ml.destroy=()=>{Rl.networkProvider=void 0,Rl.dappProvider=void 0,Rl.initOptions=void 0,De.clear()};var export_Account=WK.Account;var export_Address=kK.Address;var export_AddressValue=rz.AddressValue;var export_BigUIntValue=E8.BigUIntValue;var export_BooleanValue=ZK.BooleanValue;var export_BytesValue=XK.BytesValue;var export_ContractCallPayloadBuilder=ez.ContractCallPayloadBuilder;var export_ContractFunction=tz.ContractFunction;var export_ESDTNFTTransferPayloadBuilder=v8.ESDTNFTTransferPayloadBuilder;var export_ESDTTransferPayloadBuilder=v8.ESDTTransferPayloadBuilder;var export_TokenPayment=zK.TokenPayment;var export_Transaction=$K.Transaction;var export_TransactionPayload=YK.TransactionPayload;var export_TransactionWatcher=JK.TransactionWatcher;var export_U32Value=E8.U32Value;export{export_Account as Account,export_Address as Address,export_AddressValue as AddressValue,export_BigUIntValue as BigUIntValue,export_BooleanValue as BooleanValue,export_BytesValue as BytesValue,export_ContractCallPayloadBuilder as ContractCallPayloadBuilder,export_ContractFunction as ContractFunction,export_ESDTNFTTransferPayloadBuilder as ESDTNFTTransferPayloadBuilder,export_ESDTTransferPayloadBuilder as ESDTTransferPayloadBuilder,Ml as ElvenJS,mo as LoginMethodsEnum,export_TokenPayment as TokenPayment,export_Transaction as Transaction,export_TransactionPayload as TransactionPayload,export_TransactionWatcher as TransactionWatcher,export_U32Value as U32Value}; /*! Bundled license information: ieee754/index.js: diff --git a/example/index.html b/example/index.html index 7cf62e7..3597c2b 100644 --- a/example/index.html +++ b/example/index.html @@ -65,6 +65,8 @@

Docs and code: www.elvenjs.com

For styling elements like QR code container and Wallet Connect pairings check demo styles. Each element should have a class name.
+
Remember to change walletConnectV2ProjectId. You can get yours here https://cloud.walletconnect.com/sign-in

Authenticate, sign and send transactions and messages on the MultiversX blockchain in the browser. No need for bundlers, frameworks, etc. Just attach the script source, and you are ready to go. You can incorporate it into your preferred CMS framework like WordPress or an e-commerce system. Plus, it will also work on a standard static @@ -168,6 +170,7 @@

Other demos:

apiUrl: 'https://devnet-api.multiversx.com', chainType: 'devnet', apiTimeout: 10000, + // Remember to change it. Get yours here: https://cloud.walletconnect.com/sign-in walletConnectV2ProjectId: 'f502675c63610bfe4454080ac86d70e6', WalletConnectV2RelayAddresses: ['wss://relay.walletconnect.com'], onLoginPending: () => { uiPending(true) }, diff --git a/package-lock.json b/package-lock.json index 6f92072..3a21af1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -866,9 +866,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "version": "18.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.2.tgz", + "integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==", "dev": true }, "node_modules/@types/qrcode": { @@ -1127,6 +1127,7 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/@walletconnect/client/-/client-1.8.0.tgz", "integrity": "sha512-svyBQ14NHx6Cs2j4TpkQaBI/2AF4+LXz64FojTjMtV4VMMhl81jSO1vNeg+yYhQzvjcGH/GpSwixjyCW0xFBOQ==", + "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/", "dev": true, "dependencies": { "@walletconnect/core": "^1.8.0", @@ -1570,6 +1571,7 @@ "version": "1.8.0", "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-1.8.0.tgz", "integrity": "sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg==", + "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/", "dev": true }, "node_modules/@walletconnect/utils": { @@ -2081,12 +2083,15 @@ } }, "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/chai": { @@ -2182,14 +2187,14 @@ } }, "node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" + "wrap-ansi": "^7.0.0" } }, "node_modules/color-convert": { @@ -2340,12 +2345,15 @@ } }, "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/decode-uri-component": { @@ -2376,9 +2384,9 @@ "dev": true }, "node_modules/define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "dev": true, "dependencies": { "has-property-descriptors": "^1.0.0", @@ -3095,9 +3103,9 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "dev": true, "dependencies": { "function-bind": "^1.1.1", @@ -3109,15 +3117,15 @@ } }, "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.1.1", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -3566,9 +3574,9 @@ } }, "node_modules/js-sdsl": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", - "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", "dev": true, "funding": { "type": "opencollective", @@ -3870,47 +3878,13 @@ "url": "https://opencollective.com/mochajs" } }, - "node_modules/mocha/node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/mocha/node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/mocha/node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/mocha/node_modules/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, "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" + "balanced-match": "^1.0.0" } }, "node_modules/mocha/node_modules/minimatch": { @@ -3925,15 +3899,6 @@ "node": ">=10" } }, - "node_modules/mocha/node_modules/minimatch/node_modules/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, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/mocha/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -3955,59 +3920,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/mocha/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/mocha/node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mocha/node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -4557,6 +4469,142 @@ "node": ">=10.13.0" } }, + "node_modules/qrcode/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/qrcode/node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/qrcode/node_modules/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, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/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 + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "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" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/qrcode/node_modules/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, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", @@ -4664,9 +4712,9 @@ } }, "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.1.tgz", + "integrity": "sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==", "dev": true, "dependencies": { "inherits": "^2.0.3", @@ -5398,9 +5446,9 @@ "dev": true }, "node_modules/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==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "dependencies": { "ansi-styles": "^4.0.0", @@ -5408,7 +5456,10 @@ "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/wrappy": { @@ -5448,10 +5499,13 @@ } }, "node_modules/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 + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } }, "node_modules/yallist": { "version": "4.0.0", @@ -5460,129 +5514,45 @@ "dev": true }, "node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "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" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/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, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs-unparser/node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/yargs/node_modules/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, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/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, - "dependencies": { - "p-locate": "^4.1.0" + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/yargs/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=10" } }, - "node_modules/yargs/node_modules/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==", + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, "dependencies": { - "p-limit": "^2.2.0" + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/yn": { @@ -6212,9 +6182,9 @@ "dev": true }, "@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "version": "18.14.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.2.tgz", + "integrity": "sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==", "dev": true }, "@types/qrcode": { @@ -7227,9 +7197,9 @@ "dev": true }, "camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, "chai": { @@ -7301,14 +7271,14 @@ } }, "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" + "wrap-ansi": "^7.0.0" } }, "color-convert": { @@ -7441,9 +7411,9 @@ } }, "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true }, "decode-uri-component": { @@ -7468,9 +7438,9 @@ "dev": true }, "define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "dev": true, "requires": { "has-property-descriptors": "^1.0.0", @@ -8026,9 +7996,9 @@ "dev": true }, "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "dev": true, "requires": { "function-bind": "^1.1.1", @@ -8037,15 +8007,15 @@ } }, "glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.1.1", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -8354,9 +8324,9 @@ "dev": true }, "js-sdsl": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", - "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", "dev": true }, "js-sha3": { @@ -8602,40 +8572,13 @@ "yargs-unparser": "2.0.0" }, "dependencies": { - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "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": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "dependencies": { - "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" - } - } + "balanced-match": "^1.0.0" } }, "minimatch": { @@ -8645,17 +8588,6 @@ "dev": true, "requires": { "brace-expansion": "^2.0.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" - } - } } }, "ms": { @@ -8672,44 +8604,6 @@ "requires": { "has-flag": "^4.0.0" } - }, - "wrap-ansi": { - "version": "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" - } - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true } } }, @@ -9138,6 +9032,114 @@ "encode-utf8": "^1.0.3", "pngjs": "^5.0.0", "yargs": "^15.3.1" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "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" + } + }, + "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 + }, + "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" + } + }, + "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" + } + }, + "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 + }, + "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" + } + }, + "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" + } + } } }, "qs": { @@ -9211,9 +9213,9 @@ "dev": true }, "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.1.tgz", + "integrity": "sha512-+rQmrWMYGA90yenhTYsLWAsLsqVC8osOw6PKE1HDYiO0gdPeKe/xDHNzIAIn4C91YQ6oenEhfYqqc1883qHbjQ==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -9755,9 +9757,9 @@ "dev": true }, "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==", + "version": "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", @@ -9785,9 +9787,9 @@ "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==", + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, "yallist": { @@ -9797,72 +9799,25 @@ "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==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "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": { - "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" - } - } + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" } }, "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" - } + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true }, "yargs-unparser": { "version": "2.0.0", @@ -9874,20 +9829,6 @@ "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" - }, - "dependencies": { - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - } } }, "yn": {